mwouts / jupytext

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

Replace toml package with tomli #1195

Closed wylliec closed 5 months ago

wylliec commented 9 months ago

The tomli package is faster and more standards compliant than the toml package.

tomli is fully compatible with TOML v1.0.0, while toml is not. tomli is the fastest pure Python parser at 2.4x as fast as toml. tomli is used by major packages like jupyterlab and pytest. tomli is even included in the Python Standard Library as tomllib starting in Python 3.11.

The change should be straightforward. Replace all import toml with import tomli, and replace all toml.load with tomli.load.

tomli is hosted on PyPI at https://pypi.org/project/tomli/

mwouts commented 9 months ago

Thanks @wylliec for suggesting this!

Indeed I see that the toml dependency for jupyterlab is "tomli;python_version<\"3.11\"", it would be great to use the same dependencies for jupytext.

mwouts commented 8 months ago

Hi @wylliec , would you mind to confirm that the PR above is what you were suggesting? Thanks!

wylliec commented 8 months ago

Looks good to me! Thanks for making this change.