Hmm have you ever used Spyder?
The module auto loading works very well there. 

1) Initially i started using Pyzo (when it both a python distro and an 
editor)

2) then I switched to Spyder, because of the module reloading problem. The 
Spyder UMR (User Module Reloader) works quite  well and is something needed 
when you do scientific computaton 
where you typicallycan not always restart the shell but you are 
continuously adapting, updating and changing your functions

3) than I switched back to IEP, because on the other side the debugging in 
Spyder is very uncomfortable.

Now since both Spyder and IEP are just editors (which I find good) one can 
switch easily between the two depending on what is more important. But of 
course one would prefer to use
always the same tool. And in my opinion (having used both as a scientific 
user) personally I thing IEP is perhaps the better solution.

Some feature are already present in the ipython shell like the autoreload, 
and this was basically the rationale behind my question.

Perhaps IEP could implement the UMR as well? If you look at how it is 
implemented in Spyder it is something quite simple:  
https://github.com/spyder-ide/spyder/blob/master/spyder/utils/site/sitecustomize.py
I could contribute in this but I'm still missing the whole picture of the 
pyzo code. So I would have big difficulties to know where to put similar 
code.

Or perhaps there are other ways to achieve the same result don't know.

Bye,
Dietrich











Il giorno sabato 8 ottobre 2016 17:56:09 UTC+2, Almar Klein ha scritto:
>
> > 1) run/call a script from another script
>
>  
>
> code = open(filename, ‘rb’).read().decode()
>
> exec(code)  # look at the docs of exec for possible extra arguments
>
>  
>
> > make python use changes when you edit a file
>
>  
>
> This is not trivial; it would require a lot more than 2 lines :)  though 
> maybe there is a lib for that? 
>
>  
>
> The workflow in Pyzo would be to select a file as main file, so that you 
> can execute it while working on another file, and the run the main file 
> using Run > run main file as script, or better yet, use Ctrl+Shift+E.  
> Running as script is important because it will restart the shell and use 
> the latest version of all modules.
>
>  
>
> Regards,
>
>   Almar
>
>  
>
>  
>
> *From: *Dietrich Pescoller <javascript:>
> *Sent: *07 October 2016 14:54
> *To: *Pyzo <javascript:>
> *Cc: *dit...@gmail.com <javascript:>
> *Subject: *Re: [Pyzo] how to execute python magics from script
>
>  
>
> Is there another way to obtain the same result in python without using 
> magics?
> There are many use cases but at least I would like to be able at least to:
> 1) run/call a script from another script
>    this is achieved in ipython with %run -i myFile.py
> 2) make python use changes when you edit a file
>  this is achieved in ipython by calling
>
>   % load_ext autoreload
>
>   % autoreload 2
>
>  
>
> Thanks,
> Dietrich
>
>
>
> Il giorno martedì 27 settembre 2016 21:52:22 UTC+2, Almar Klein ha scritto:
>
> No, its not possible to use magics in the script. This is deliberate, 
> since it would be invalid Python. Not sure why the use of the ipython API 
> calls would not work. Pyzo’s IPython shell is not completely a proper 
> IPython shell, so it might be that we don’t do enough for this to be picked 
> up somehow…
>
>  
>
> What is the problem that you’re trying to fix, or workflow that you’re 
> trying to achieve? Maybe there are other ways to make it work.
>
>  
>
> - Almar
>
>  
>
>  
>
>  
>
> *From: *Dietrich Pescoller
> *Sent: *27 September 2016 18:22
> *To: *Pyzo
> *Subject: *[Pyzo] how to execute python magics from script
>
>  
>
> Is there a way to execute ipython magics from script in IEP.
> In particular I'm interested in startup script
>
> I tired something like this:
>
> from IPython import get_ipython
>
> get_ipython().magic('load_ext autoreload')
>
> get_ipython().magic('autoreload 2')
>
>  
>
> Which works in a standard ipython console but does not work when using IEP.
>
>
>
> Any suggestion would be apprecieated
>
> Thanks,
> Dietrich
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Pyzo" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to pyzo+uns...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>  
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Pyzo" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to pyzo+uns...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyzo+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to