pdoc
pdoc copied to clipboard
pdoc3 uses the soon to be deprecated distutils package
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
- Execute pdoc3
with python3.10 on a module. Simply running the --helpor--versioncommands does not work to trigger the deprecation warnings.
Additional info
- pdoc version:
pdoc3 0.10.0 - python version: 3.10.2
Thanks. I guess the needed work entails replacing uses of distutils.sysconfig.get_python_lib():
https://github.com/pdoc3/pdoc/blob/f358893e4fcfd7f29857a7ff5491b606ff146d39/pdoc/cli.py#L490-L491
https://github.com/pdoc3/pdoc/blob/2cce30a9b55eeeddc1ed826c8a2ada53777c3eea/pdoc/html_helpers.py#L625-L627
with appropriate calls to sysconfig.get_path()?
I guess this is the relevant replacement function sysconfig.get_path('platlib'), see https://bugs.python.org/issue41282#msg393018 for further infromations.
PR https://github.com/pdoc3/pdoc/pull/401
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'
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.
Adding a voice, would be great to have pydoc3 working in python 3.12, thanks