Python package install best practice?

virantha's Avatar

virantha

16 Nov, 2016 02:13 AM

Hi. I'm trying to add a few scripts in python to my MD2017 and I'm wondering what's the best way to install PyPI packages such that they are picked up by the built in Python runner.

Right now I'm kind of hacking it by pip installing into a virtual environment and then manually adding the venv site-packages directory to sys.path before my import statements. Any way I can directly install packages into the MD install?

  1. 1 Posted by virantha on 16 Nov, 2016 05:03 PM

    virantha's Avatar

    Also, does the python runner in MD2017 have any known limitations with the number of files? For example, if my main file imports another local file (say a script instantiating a swing JFrame), I find that reinstalling the extension does not pick up any changes in any imported file. Kind of annoying to have to put all my code into the single file that gets run. Is there any way to force a 'recompile' of all the imports when running a script? I've verified that the file timestamps are new.

  2. 2 Posted by virantha on 29 Nov, 2016 07:07 PM

    virantha's Avatar

    Ok, so just to answer my own question immediately above where MD was not re-importing imports during development, the work-around is to reload(module).

    import my_module  
    reload(my_module)
    
  3. System closed this discussion on 28 Feb, 2017 07:10 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac