Workaround for jinja substitutions in code blocks #544
Unanswered
OriolAbril
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
We have an example gallery of PyMC usage, built with sphinx from jupyter notebook examples. Most notebooks depend on pymc+optional dependencies only so the install needed for this to work is the same for all, but some have extra dependencies to show for example integration of pymc with fenics or keras.
I was thinking about writing down a small
installation.md
that we could then include in the relevant files that would have a couple sentences about the need for extra installs and the conda/pip (or both with tabs) commands that should be executed. As those external dependencies change from notebook to notebook, I thought we could use jinja substitutions to cover that:extra_installs
installation.md
that has a substitution forextra_installs
and should use the one defined in the frontmatter (I think)However, we can use
pip install {{ extra_installs }}
as it won't be substituted. Is there any workaround? Maybe some clever jinja operations like takeextra_installs
prependpip install
and encase between backticks? Should we try to define a myst specific directive/role for "code with substitutions"?Beta Was this translation helpful? Give feedback.
All reactions