pypa / pypa/setuptools

[BUG] setuptools' distutils override no longer shows DeprecationWarning

Open
#3,533 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

setuptools version

setuptools==65.0.1

Python version

any

OS

any

Additional environment information

No response

Description

Recent versions of setuptools override Python stdlib's distutils with setuptools._distutils via _distutils_hack. This version does not contain code to issue deprecation warnings. It's a deviation from upstream code. setuptools should keep the deprecation warning to inform users that they should move from distutils to setuptools.

See also https://github.com/pypa/setuptools/issues/3532

Expected behavior
$ venv/bin/pip install "setuptools==59.6.0"
$ venv/bin/python -Werror -c "import distutils"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.10/distutils/__init__.py", line 19, in <module>
    warnings.warn(_DEPRECATION_MESSAGE,
DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
How to Reproduce
  1. python3 -m venv venv
  2. Install recent setuptools, e,g. venv/bin/pip install "setuptools==65.0.1"
  3. Run venv/bin/python -Werror -c "import distutils"
Output

no output, command does not raise a deprecation warning

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting setuptools' _distutils_hack and compare its distutils override behavior with the Python standard-library warning shown in the issue. Reproduce the problem with python -Werror -c "import distutils" after installing setuptools 65.0.1. Done means the override emits the expected DeprecationWarning and the relevant behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.