mwouts / jupytext

Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts
https://jupytext.readthedocs.io
MIT License
6.65k stars 386 forks source link

`pre-commit` doesn't work #1117

Closed GarrisonD closed 1 year ago

GarrisonD commented 1 year ago

My config:

- repo: https://github.com/mwouts/jupytext
  rev: v1.15.0
  hooks:
    - id: jupytext

Output of pre-commit run -a:

jupytext.................................................................Failed
- hook id: jupytext
- exit code: 1

Traceback (most recent call last):
  File "/home/vscode/.cache/pre-commit/repovei544_n/py_env-python3.10/bin/jupytext", line 8, in <module>
    sys.exit(jupytext())
  File "/home/vscode/.cache/pre-commit/repovei544_n/py_env-python3.10/lib/python3.10/site-packages/jupytext/cli.py", line 397, in jupytext
    raise ValueError(
ValueError: Please provide one of --to, --output, --set-formats, --sync, --pipe, --diff, --check, --update-metadata, --format-options, --set-kernel or --execute
mwouts commented 1 year ago

Hey @GarrisonD , may I ask where you took the config from?

As the error message says, you need to tell jupytext what the pre-commit hook should do.

For instance, in our documentation there is an additional line: args: [--sync].

We also have a series of tests that document different configurations, see for instance test_pre_commit_1_sync.py or the other similarly named tests under tests.

GarrisonD commented 1 year ago

I was a terrible docs reader. Everything works perfectly now.

Thank you so much, and I apologize for taking up your time!

mwouts commented 1 year ago

Thank you for letting me know! No problem at all.