Open manerotoni opened 1 year ago
Nice! Maybe we should then consider structuring our python code into such sections!
Yes, all new activities I am editing I restructure like this. What would be nice to have, would be a download function for the activity code. Then using the jupytext package participants get a nicely formatted jupyter notebook. Alternatively they copy paste in a text editor and load the activity into jupyter. I would add jupytext as extra pre-requisite to install. It will be very useful. What do you think @tischi ?
Can one somehow copy and paste one section into Jupyter such that it then renders two cells: a comment cell and a code cell?
Unfortunately no. You have to upload a .py document and it will be transformed
OK, yes, we could add instructions somewhere for how to load our .py files nicely formatted into Jupyter. Question is where... maybe in the tool installation module?
Tool installation module. Together with the additional package to install.
Are you editing the tool installation part? If yes you can make those changes
pip install jupytext
and some explanations on how to use the activities.
It could be part of the first run to see if the software works.
Ok I see you have a PR, I will add these changes in it during the review process.
To make openIJTIff always available in your environment add the path to your Pythonpath.
On windows and for my installation it is
set PYTHONPATH=D:\Code\training-resources\functions
This you have to do before you start jupyter notebook.
Disable the autosave function to avoid confusion (File > Jupytext > Autosave notebook (uncheck it))
It would be very nice to have a plain text python file that correctly configures as a jupyter notebook. This is indeed possible.
There are different ways to do this https://mljar.com/blog/convert-jupyter-notebook-python/
I tried with the package
jupytext
pip install jupytext
orconda install jupytext -c conda-forge
You then define in the
.py
file each beginning of a cell with# %%
. This also the way to create cells in some IDEs Loading the file in jupyter with an environment that hasjupytext
will correctly configure the cells.If you need a markdown cell use