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

Replacing pkg_resources.parse_version with packaging.version.parse and equivalents #1085

Closed fast-90 closed 1 year ago

fast-90 commented 1 year ago

Is there any reason why jupytext is using pkg_resources.parse_version over packaging.version.parse?

Currently I am using Jupytext in a virtualenv, and I am trying to convert a qmd file into a ipynb notebook which results in the following error:

  File "/home/duy/repos2/bayvar/.venv/lib/python3.11/site-packages/jupytext/jupytext.py", line 379, in reads
    notebook = reader.reads(text, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/duy/repos2/bayvar/.venv/lib/python3.11/site-packages/jupytext/jupytext.py", line 100, in reads
    return qmd_to_notebook(s)
           ^^^^^^^^^^^^^^^^^^
  File "/home/duy/repos2/bayvar/.venv/lib/python3.11/site-packages/jupytext/quarto.py", line 77, in qmd_to_notebook
    raise_if_quarto_is_not_available()
  File "/home/duy/repos2/bayvar/.venv/lib/python3.11/site-packages/jupytext/quarto.py", line 49, in raise_if_quarto_is_not_available
    raise QuartoError("Please install pkg_resources")
jupytext.quarto.QuartoError: Please install pkg_resources

My understanding is that this is because of I don't have setuptools installed in my virtualenv, and installing it for Jupytext only seems like an overkill. Using packaging would allow people to just install packaging if needed.

Happy to make a PR if needed, but wanted to check-in first in case I'm missing something.