The moment just before
Sto per partire does not mean I'm leaving and it does not mean I will leave. It means I'm about to leave: I am standing at the door with my suitcase. The action has not started, but it starts within moments.
Sto per partire.
I'm about to leave.
Sta per piovere.
It's about to rain.
Sto per arrivare, sono a due minuti.
I'm about to arrive, I'm two minutes away.
Scusa, sta per iniziare la riunione.
Sorry, the meeting is about to start.
Il treno sta per partire, sbrigati!
The train is about to leave, hurry up!
Il film sta per finire.
The film is about to end.
In the imperfect
With stavo, stava, stavamo ... you say that something was about to happen, often with a different outcome. English says I was about to. Apart from the present and the imperfect the construction hardly occurs: nobody says starò per partire.
Stavo per chiamarti, poi mi hai scritto tu.
I was about to call you, then you texted me.
Stavamo per uscire quando ha iniziato a piovere.
We were about to go out when it started to rain.
Not to be confused
The future looks ahead as far as you like; stare per only a moment. English going to stretches happily (I'm going to leave tomorrow); stare per does not take a distant time expression: not Sto per partire domani, but Parto domani or Partirò domani.
Two distances
stare per + infinitive
L'aereo sta per atterrare.
The plane is about to land.
Futuro
L'aereo atterrerà alle sette.
The plane will land at seven.
Both constructions start with stare. Without per comes a gerund and the action is already running. With per comes an infinitive and it starts any second.
Sto mangiando.
I'm eating (right now).
Sto per mangiare.
I'm about to eat.