-
Notifications
You must be signed in to change notification settings - Fork 386
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
Convert Jupyter notebooks to Hydrogen / VScode / Spyder compatible scripts, and back #59
Comments
This is implemented in the latest release candidate for Jupytext! Install the rc with
Corresponding documentation is the v0.7.0 branch. Please comment here if it works, if it doesn't, if that's easy to use or not... |
Following suggestions by the Spyder team, I will change the cell header to
with cell type either absent (code), or |
Available in v0.7.0 now! Please try it. |
The code from spyder
Is it supossed behaviour? (two cells rather than one, + visible percent signs) Another thing: Maybe is good to have an exemple of percent cells in the demo? |
Well, yes. You should add a least a second cell... this is briefly documented in the next README. Let me explain a bit more... When no format information is given, jupytext classifies percent scripts as such if they contain at least two explicit cells. What's happening here is that jupytext opens your script as a standard Python script, using the Note that if you generate the percent script using Jupytext, a YAML header with an explicit information on the file format will be added, and Jupyter will open it with the right format. |
@danieltomasz , thanks for your example. I just changed the format parser to make sure your example will open as a 'percent' script. The identification of spyder scripts now requires just one cell in the script, that's a simpler criterion! |
Many editors recognize code cells in python scripts as blocks that start with
# %%
, includingI found no specific marker for markdown () or raw cell yet. So let's be inventive and imagine a few specifications for that format: any cell starts with the above prefix. An optional cell type (among: code, markdown, raw) can be specified. An optional cell name can be stated (it cannot be any of code, markdown, raw). Then, if required, we add the cell metadata, in JSON format, like in the following:
Hydrogen and VS code execute python code with Jupyter kernels, so there's no need to escape Jupyter magics here.
The text was updated successfully, but these errors were encountered: