-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document how to import notebooks with Jupytext #159
Comments
As documented above, with the freeze or active method we do have a way to comment out some cells in the Python representation. But maybe commenting out the code is a bit too much... in some cases a |
Hi @mwouts , I'm not sure I understand your two alternatives.
if you adopt this one, would frozen cells code stop being commented in the |
Well, I'm not saying that's a change we should make, I just wanted to discuss that with you: rather than commenting out inactive python cells, we could indent them and prefix them with The added value would be to make the resulting python file easier to refactor with editors or tools like black. But that requires that the code in the frozen cell is syntaxically correct. Maybe that's not an assumption we want to make... |
Yes I understand. Thanks for the clarification.
Personally, that's something I sometimes don't have.... Code in my frozen cells, can be very, very, wrong. In many ways :) |
That's an useful remark, thanks @andrethrill ! |
The README now has a short paragraph on Importing Jupyter notebooks as modules. |
Jupytext makes it very simple to import the code a notebook into another notebook. All that is required is to save the notebook as a Python script, and import that script in the other notebook.
This is significantly simpler than the official example.
Also, and we should document this: Jupytext may help solve one issue people find with importing notebooks, that is: they do not want to import cells with plots or computations, but only those where functions or classes are defined.
Currently, it is possible to comment out a given cell in the Python representation by using either the 'frozen_cell' mode of the freeze extension (#101 ), or by setting an
"active":"ipynb"
cell metadata for that cell (#108)The text was updated successfully, but these errors were encountered: