Skip to content

Proof of Principle for inline variables#382

Closed
chrisjsewell wants to merge 75 commits into
masterfrom
pop-md-variables
Closed

Proof of Principle for inline variables#382
chrisjsewell wants to merge 75 commits into
masterfrom
pop-md-variables

Conversation

@chrisjsewell

@chrisjsewell chrisjsewell commented Jan 13, 2022

Copy link
Copy Markdown
Member

See https://myst-nb--382.org.readthedocs.build/en/382/use/inline_execution.html 🎉

(this is based on top of #380, see also jupyter/nbclient#160)

The idea at present, is that these inline variables are restricted to matching the regex r"^[a-zA-Z_][a-zA-Z0-9_]*$", i.e. they should be variable names, so that when they are called by the kernel, they do not change its state, e.g. you can call a, but not a=3.
This is not strictly necessary (you can call kernel execution at any point during the parse), but it means you maintain the "mapping" with other notebook environments, wherby only code cells change the state of the kernel.

The only drawback really, is that caching execution would be a little tricky, since you would basically have to run the full docutils/sphinx parse, to see if any new variables have been inserted.

@codecov

codecov Bot commented Jan 13, 2022

Copy link
Copy Markdown

Codecov Report

Merging #382 (ccd3565) into master (619f388) will decrease coverage by 8.09%.
The diff coverage is 78.91%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #382      +/-   ##
==========================================
- Coverage   87.35%   79.25%   -8.10%     
==========================================
  Files          12       15       +3     
  Lines        1368     1986     +618     
==========================================
+ Hits         1195     1574     +379     
- Misses        173      412     +239     
Flag Coverage Δ
pytests 79.25% <78.91%> (-8.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
myst_nb/nb_glue/elements.py 61.13% <61.13%> (ø)
myst_nb/loggers.py 61.70% <61.70%> (ø)
myst_nb/execute.py 66.34% <66.34%> (ø)
myst_nb/__init__.py 71.42% <71.42%> (-15.67%) ⬇️
myst_nb/docutils_.py 76.00% <76.00%> (ø)
myst_nb/read.py 79.51% <79.51%> (ø)
myst_nb/render.py 82.08% <82.08%> (ø)
myst_nb/nb_glue/domain.py 90.90% <87.50%> (+0.26%) ⬆️
myst_nb/preprocess.py 87.80% <87.80%> (ø)
myst_nb/sphinx_.py 88.31% <88.31%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 619f388...ccd3565. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant