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

Switch to jupytext MyST markdown #2221

Closed
wants to merge 4 commits into from
Closed

Switch to jupytext MyST markdown #2221

wants to merge 4 commits into from

Conversation

StFroese
Copy link
Member

@StFroese StFroese commented Jan 16, 2023

fixes #2099

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@maxnoe
Copy link
Member

maxnoe commented Jan 16, 2023

Can we use the same as gammapy here? I like that in that format, the notebooks are actually valid python scripts that can also be run normally.

@StFroese
Copy link
Member Author

Sure, I'll take a look at it. Just to be clear: The .md notebooks can be run by Jupyter without converting them again

@maxnoe
Copy link
Member

maxnoe commented Jan 16, 2023

Out of the box? Or with some extension installed?

@StFroese
Copy link
Member Author

Jupytext has to be installed in the environment

@StFroese StFroese changed the title Switch to jupytext MySt markdown Switch to jupytext MyST markdown Jan 16, 2023
@kosack
Copy link
Contributor

kosack commented Jan 16, 2023

fixes: #2099

@kosack
Copy link
Contributor

kosack commented Jan 16, 2023

Can we use the same as gammapy here? I like that in that format, the notebooks are actually valid python scripts that can also be run normally.

Does jupyter itself support the format GammaPy uses, or do they export to that after editing? With Jupytext, you can use jupyter directly to edit/view the files I think, which is nice.

@maxnoe
Copy link
Member

maxnoe commented Jan 16, 2023

The system gammapy uses is sphinx-gallery: https://sphinx-gallery.github.io/

@kosack
Copy link
Contributor

kosack commented Jan 16, 2023

The system gammapy uses is sphinx-gallery: https://sphinx-gallery.github.io/

That is nice as it lets you download the result as a notebook or a script...

@maxnoe
Copy link
Member

maxnoe commented Jan 16, 2023

Loading the script directly with jupytext also seems to work in that format

@maxnoe
Copy link
Member

maxnoe commented Jan 16, 2023

See https://jupytext.readthedocs.io/en/latest/formats.html#sphinx-gallery-scripts

@@ -130,7 +130,7 @@ jobs:
- name: Install doc dependencies
run: |
sudo apt update --yes && sudo apt install --yes git build-essential pandoc graphviz
pip install -U pip towncrier
pip install -U pip towncrier myst-nb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we not include those now in setup.cfg under options.extras_require.docs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. The docs are something the user should be able to build on their local install, without using the CI, so it should be a dependency

@maxnoe maxnoe mentioned this pull request Jun 30, 2023
@maxnoe
Copy link
Member

maxnoe commented Jun 30, 2023

@StFroese Could you make a new attempt here with the same format Gammapy uses and the current main?

Please add the newly needed packages to the correct extras in setup.cfg and to the conda development environment in environment.yml.

@StFroese
Copy link
Member Author

@maxnoe can do. I'll open a new PR for this

@kosack
Copy link
Contributor

kosack commented Jun 30, 2023

@StFroese Could you make a new attempt here with the same format Gammapy uses and the current main?

I have a quick question, not having worked with the sphinx-gallery text format. Can you open notebooks written in this format directly in Jupyter(lab)? Or do you have to convert to notebook first, edit, and convert back? Or is it just a different variant of format supported by the jupytext plugin?

@maxnoe
Copy link
Member

maxnoe commented Jun 30, 2023

@kosack When you have the jupytext extension installed, they open just fine in jupyter {lab,notebook}

@StFroese
Copy link
Member Author

StFroese commented Jun 30, 2023

Can you open notebooks written in this format directly in Jupyter(lab)? Or do you have to convert to notebook first, edit, and convert back? Or is it just a different variant of format supported by the jupytext plugin?

I'm a little confused about this too. Seems like you have to use .py script with sphinx-gallery instead of notebooks. Am I right @maxnoe?
This seems to be a kind of alternative maybe https://sphinx-nbexamples.readthedocs.io/en/latest/

@kosack
Copy link
Contributor

kosack commented Sep 8, 2023

Replaced by #2377

@kosack kosack closed this Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use jupytext for notebooks in the documentation?
4 participants