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

distuitils Version classes are deprecated #76

Closed
Samreay opened this issue Oct 9, 2023 · 2 comments · Fixed by #79
Closed

distuitils Version classes are deprecated #76

Samreay opened this issue Oct 9, 2023 · 2 comments · Fixed by #79

Comments

@Samreay
Copy link
Contributor

Samreay commented Oct 9, 2023

Hi @smarie!

Looks like a fairly simple change, but right now Im getting a ton of deprecation warnings:

generating gallery for /home/runner/work/ChainConsumer/ChainConsumer/docs/generated/gallery... :  80%|████████  | 4/5 [00:26<00:05,  5.45s/it]INFO    -  DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  File "/home/runner/work/ChainConsumer/ChainConsumer/.venv/lib/python3.10/site-packages/mkdocs_gallery/py_source_parser.py", line 109, in _get_docstring_and_rest
    if LooseVersion(sys.version) >= LooseVersion("3.7"):
  File "/home/runner/work/ChainConsumer/ChainConsumer/.venv/lib/python3.10/site-packages/setuptools/_distutils/version.py", line 55, in __init__
    warnings.warn(

Which boil down to:

DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.

Hopefully the fix is a simple swap here:

from distutils.version import LooseVersion

From

from distutils.version import LooseVersion

to

from packaging.version import Version

And then updating

    if LooseVersion(sys.version) >= LooseVersion("3.7"):

I believe you could also make use of from packaging.version import parse if you wanted too.

@smarie
Copy link
Owner

smarie commented Oct 17, 2023

Thanks @Samreay ! Indeed this is the correct fix. Also there is a need to update the install_requires as shown here : https://github.com/smarie/python-pytest-cases/pull/312/files

Do you feel like opening a PR ?

Samreay added a commit to Samreay/mkdocs-gallery that referenced this issue Oct 18, 2023
@Samreay
Copy link
Contributor Author

Samreay commented Oct 18, 2023

@smarie sure thing. Three new PRs now in your inbox awaiting your thoughts

@smarie smarie closed this as completed in #79 Nov 8, 2023
smarie added a commit that referenced this issue Nov 8, 2023
Fixes #76 - Swapping over to use package
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 a pull request may close this issue.

2 participants