You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This myst-nb PR incorporates an experimental syntax to bring code in from a file using :load: in code-cell directives such as:
```{code-cell}
:load: <some-file.py>
```
There has been a lot of discussion focused on the "best" place to implement this feature as having it in myst_nb means it is not technically part of the core myst syntax -- but rather a feature to myst_nb + jupyter-book users. There are a couple of options to consider for migrating this from myst_nb in the future:
jupytext with directive like support for metadata parsing of :load:. This is similar to how ipython magics work as the cell needs to be executed once to act on the action and then again to act on the code
papermill (?)
myst-nb extension
another option is to convert this to be a sphinx-extension to support myst as per this suggestion from @choldgraf
Though one thought for the long term, could we add an extension point to the myst nb sphinx extension ? Eg if you could register a function that would take a notebook as input, and then hook that up to either a pre or post execute callback, then this kind of functionality could just be a sphinx extension rather than supported natively by myst nb.
We could look at papermill for some inspiration https://papermill.readthedocs.io/en/latest/extending-overview.html
(Or to be honest I wonder if there is some way we could use papermill under the hood for these use cases? That might be more complex tho)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This
myst-nb
PR incorporates anexperimental
syntax to bringcode
in from afile
using:load:
incode-cell
directives such as:There has been a lot of discussion focused on the "best" place to implement this feature as having it in
myst_nb
means it is not technically part of the coremyst
syntax -- but rather a feature tomyst_nb
+jupyter-book
users. There are a couple of options to consider for migrating this frommyst_nb
in the future:jupytext
withdirective
like support formetadata parsing
of:load:
. This is similar to howipython magics
work as the cell needs to beexecuted
once to act on theaction
and then again to act on thecode
papermill
(?)myst-nb
extensionanother option is to convert this to be a
sphinx-extension
to supportmyst
as per this suggestion from @choldgrafBeta Was this translation helpful? Give feedback.
All reactions