|
|
|
|
|
by mrwebmaster
2272 days ago
|
|
Thanks! I'm learning OOP and data analysis. For OOP I use Pycharm and for data analysis I use Jupyter Notebooks (in Lab or VS Code). Sometimes I write some reusable code in .py modules and call them from my notebooks. Anyway, I didn't fully undertand your proposal to use importlib.reload but will try to research about it. For exploratory data analysis, I guess notebooks are better that IDEs. |
|
- Always use a virtualenv when working with python
- Create proper package structure for your python project. This means your directory structure will look like this
- Google for how to create a minimal setup.py. Just put what you need in there, it's not much.- Now, with your virtualenv activated, so that `which pip` resolves to `myvirtualenv/bin/pip`, do this:
- That pip command will execute your setup.py and "install" your library into the virtualenv. But it will install it in such a way that you can edit the code and the edits will be picked up by the installed version (it uses symlinks).- Now install jupyter in that same virtualenv and start your notebook. You should now be able to do `from myproject import mymodule` and `reload(mymodule)`. And your project is now a real python library so you can create subdirectories, etc e.g. `from myproject/plots import create_boxplot`.