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

pdoc3 uses the soon to be deprecated distutils package #392

Open
991jo opened this issue Apr 4, 2022 · 6 comments
Open

pdoc3 uses the soon to be deprecated distutils package #392

991jo opened this issue Apr 4, 2022 · 6 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@991jo
Copy link

991jo commented Apr 4, 2022

Apparently distutils is getting deprecated in Python 3.12. For more details see PEP-632

Expected Behavior

Not getting spammed with deprecation warnings.

Actual Behavior

I see some deprecation warnings.

$ pdoc3 <my module here>
<path to venv>/lib/python3.10/site-packages/pdoc/cli.py:490: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.sysconfig import get_python_lib
<path to venv>/lib/python3.10/site-packages/pdoc/cli.py:490: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
  from distutils.sysconfig import get_python_lib
<actual command output>

Steps to Reproduce

  1. Execute pdoc3 with python3.10 on a module. Simply running the --help or --version commands does not work to trigger the deprecation warnings.

Additional info

  • pdoc version: pdoc3 0.10.0
  • python version: 3.10.2
@kernc
Copy link
Member

kernc commented Apr 4, 2022

Thanks. I guess the needed work entails replacing uses of distutils.sysconfig.get_python_lib():

pdoc/pdoc/cli.py

Lines 490 to 491 in f358893

from distutils.sysconfig import get_python_lib
libdir = get_python_lib(prefix=venv_dir)

pdoc/pdoc/html_helpers.py

Lines 625 to 627 in 2cce30a

from distutils.sysconfig import get_python_lib
for prefix_path in (_git_project_root() or os.getcwd(),
get_python_lib()):

with appropriate calls to sysconfig.get_path()?

@kernc kernc added bug Something isn't working good first issue Good for newcomers labels Apr 4, 2022
@braniii
Copy link

braniii commented Apr 24, 2022

I guess this is the relevant replacement function sysconfig.get_path('platlib'), see https://bugs.python.org/issue41282#msg393018 for further infromations.

@timkofu
Copy link

timkofu commented May 16, 2022

PR #401

@LostInDarkMath
Copy link

LostInDarkMath commented Dec 30, 2023

Is there any progress here? It seems like pdoc3 does not work with Python 3.12 due to this issue: pdoc3 --html --output-dir docs foo --force gives the error

Traceback (most recent call last):
  File "/home/willi/Documents/GitHub/pedantic-python-decorators/.venv/bin/pdoc3", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/willi/Documents/GitHub/pedantic-python-decorators/.venv/lib/python3.12/site-packages/pdoc/cli.py", line 490, in main
    from distutils.sysconfig import get_python_lib
ModuleNotFoundError: No module named 'distutils'

@briansturgill
Copy link

briansturgill commented Jan 9, 2024

Temporarily, I've edited the file: lib/python3.10/site-packages/pdoc/cli.py
Replacing lines 490, 491 with:
from sysconfig import get_path
libdir = get_path('platlib')

This is working for me just fine.

@mshadbolt
Copy link

Adding a voice, would be great to have pydoc3 working in python 3.12, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
7 participants