-
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
Magic cell languages vs magic cell commands #643
Comments
Hello, is there an expected date for the support of custom non python magic (e.g. |
Hi @lc5415 , custom magics are supported since Jupytext 1.6.0. Sorry I see it's not yet documented... see this comment for how to use them. |
Thanks for the reply @mwouts , I will try this tomorrow and I guess it should work. Is there a known way to set this up globally? And is there a way to set it up programmatically? Perhaps depending on the current environment/kernel? Custom magics could be detected automatically by comparing the current magics vs the default ones? (This may be too much/too specific, I'm just wondering about the options here) |
Yes, the option can be set in a The file can be local to your folder, or even global, cf. https://jupytext.readthedocs.io/en/latest/config.html#jupytext-configuration-file |
Not working with double magicHi @mwouts ,using %%time
%%sql
SELECT *
FROM table1 I would like this to be be commented too as the cell contains a non pythonic cell magic and I think it is a sensible default behaviour, what do you think? |
Hi @lc5415 , thanks for reporting the double magic case! I agree with you, the cell should be fully commented out in this case. I'll try and see if I can fix this in the next release. |
I was surprised when jupytext did not include the output from the %%timeit magic. Is this the correct place for this information, or should it be a separate issue? |
Hi @fm75 , thanks for asking. As @chrisjsewell and @choldgraf mentioned in the other discussion, the outputs are never stored in the Jupytext files (and this is not related to magic or not magic commands). You were probably expecting something closer to the output of
|
Following #513 and #622, I'd like to think a bit about how magic cells are/should be handled.
Here are my expectations
R
, that differs from the main notebook language, say e.g.python
, then.py
file```R
code cell in the.md
file.md
file. The cell magic should always be commented out in the.py
file. For some cell magics like%%time
or%%capture
it may not be necessary to comment out the cell content in the.py
file. For some other cell magics like%%script
, commenting out the full cell is required.I think (but would like to check) that we are actually doing that.
Currently the distinction between 1. and 2. is made based on
jupytext.languages._JUPYTER_LANGUAGES
(script
is one of them), plus the configurablecustom_cell_magics
. Do we cover all the use cases?The text was updated successfully, but these errors were encountered: