Skip to content
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

Multi cell directives? #300

Closed
OriolAbril opened this issue Feb 20, 2021 · 3 comments
Closed

Multi cell directives? #300

OriolAbril opened this issue Feb 20, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@OriolAbril
Copy link
Contributor

I was wondering if it is possible (not even sure if it should be) to create directives with 4 or more backticks or with a special key so that it spans multiple cells.

The main use case I have in mind is having notebooks that can be written sequentially and can have cached execution where a tabbed directive contains some explanation plus a code cell within it.

Example

Here is how you would get MCMC samples:

````{tabbed} PyMC3
:multicell: true

```{code-cell} ipython
<some pymc3 code>
```

Maybe some comment about PyMC3 specifics
````

````{tabbed} Stan
:multicell: true

```{code-cell} ipython
<some stan code>
```
Maybe some comment about Stan specifics
````

Describe alternatives you've considered

I know I can write the exact same thing in myst and use ipython directives to get the code executed automatically but there are 2 reasons that still make me wish this was possible.

The first is to use that when writing guides of some time intensive features (i.e. in my case generally mcmc sampling) where having cached/manual execution would be great. Even with very simplified code, if I want to compare approaches and have multiple guides and pages in the docs, the execution times gets a bit over the top. As far as I know there is no caching for ipython directives.

The second and less important is being able to see real time the outputs of the code. I can write the code in an ide/notebook seeing the outputs real-time and then copy the source to a myst/sphinx compatible file. But I think there is no harm in dreaming, and maybe someone else has other usecases in mind.

Does it make sense to want something like this to work?

@OriolAbril OriolAbril added the enhancement New feature or request label Feb 20, 2021
@welcome
Copy link

welcome bot commented Feb 20, 2021

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@akhmerov
Copy link
Contributor

I fear, this would not be compatible with the myst-nb underlying design choices (see discussion in executablebooks/meta#143). You could consider https://github.com/jupyter/jupyter-sphinx (NB: I'm an author), but it's completely oblivious of the myst-nb execution model, and a lot less feature-complete.

@OriolAbril
Copy link
Contributor Author

Thanks! I will close the issue then 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants