Thanks Nicolas.

I should have looked closer at ox-ipynb since the problem is in there.
It should make use of  `org-export-unravel-code' and it doesn't. Instead
it trims leading white spaces from the src code.
I'll report it to the scimax github repository.

Best regards,

2017-05-17 15:08 GMT+02:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:
Fabrice Popineau <fabrice.popineau@gmail.com> writes:

> I mean that in the Org buffer I have for example :
>
> #+BEGIN_SRC ipython :session
>   def fact(n):
>       if n == 1:
>           return 1
>       else:
>           return n * fact(n-1)
> #+END_SRC
>
> That is, there is a 2 spaces indentation of the whole code block, and the
> code block is properly indented.
> When I export it, I get :
>
> def fact(n):
>       if n == 1:
>           return 1
>       else:
>           return n * fact(n-1)

FWIW I cannot reproduce it. You may want to debug
`org-export-unravel-code', `org-export-format-code' or
`org-export-format-code-default'.

Regards,