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

Informative runtime error if myst is not installed #584

Merged
merged 4 commits into from
Aug 20, 2020

Conversation

mwouts
Copy link
Owner

@mwouts mwouts commented Jul 30, 2020

With this PR, the md:myst and md:pandoc are always included in the Jupytext formats, and an informative runtime
error will occur if the required dependencies, resp. myst-parser and pandoc, are not installed. (#556)

For instance, if I don't have myst-parser, jupytext README.md --to md:myst results into

[jupytext] Reading README.md in format md
[jupytext] Writing README.md in format md:myst (destination file replaced)
(...)
ImportError: The MyST Markdown format requires 'myst_parser>=0.8'. Install it with e.g. 'pip install jupytext[myst]'

A similar error message is displayed in Jupyter Notebook or Lab user if they opens a myst file without having installed myst.

I have also simplified the documentation of the --to option in jupytext --help to make md:myst easier to find:

  --to OUTPUT_FORMAT    The destination format: 'ipynb', 'markdown' or 'script', or a file
                        extension: 'md', 'Rmd', 'jl', 'py', 'R', ..., 'auto' (script extension
                        matching the notebook language), or a combination of an extension and a
                        format name, e.g. md:myst, md:pandoc, md:markdown or py:hydrogen,
                        py:nomarker, py:sphinx, py:percent, py:light. The default format for scripts
                        is the 'light' format, which uses few cell markers (none when possible).
                        Alternatively, a format compatible with many editors is the 'percent'
                        format, which uses '# %%' as cell markers. The main formats (markdown,
                        light, percent) preserve notebooks and text documents in a roundtrip. Use
                        the --test and and --test-strict commands to test the roundtrip on your
                        files. Read more about the available formats at
                        https://jupytext.readthedocs.io/en/latest/formats.html (default: None)

@codecov
Copy link

codecov bot commented Jul 30, 2020

Codecov Report

Merging #584 into master will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #584      +/-   ##
==========================================
- Coverage   99.00%   99.00%   -0.01%     
==========================================
  Files          90       90              
  Lines        8883     8933      +50     
==========================================
+ Hits         8795     8844      +49     
- Misses         88       89       +1     
Impacted Files Coverage Δ
jupytext/cli.py 96.75% <100.00%> (ø)
jupytext/formats.py 96.60% <100.00%> (-0.29%) ⬇️
jupytext/myst.py 97.40% <100.00%> (+0.09%) ⬆️
jupytext/pandoc.py 96.55% <100.00%> (+0.63%) ⬆️
tests/test_ipynb_to_myst.py 100.00% <100.00%> (ø)
tests/test_read_simple_pandoc.py 100.00% <100.00%> (ø)
tests/utils.py 100.00% <100.00%> (ø)

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 0359ce0...06dd749. Read the comment docs.

@mwouts mwouts force-pushed the improve_install_myst_message branch from 535766f to f5d8fe3 Compare August 1, 2020 07:54
@mwouts mwouts force-pushed the improve_install_myst_message branch from f5d8fe3 to 06dd749 Compare August 20, 2020 04:20
@mwouts mwouts merged commit b8c2a1c into master Aug 20, 2020
@mwouts mwouts deleted the improve_install_myst_message branch August 20, 2020 07:17
@parmentelat
Copy link
Contributor

thanks a lot; this is going to make first class a lot less tedious ;-)

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.

2 participants