[debt] Remove distutils hack
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
Although distutils_hack is deprecated (#4137), there are still consumers that rely on the presence of distutils or access to its internals to conduct some business (see the distutils deprecation tag).
One aspect of this deprecation is to make the compilers module independent. Some work has been done on that by moving the compilers into distutils.compilers with the intention of eventually releasing that functionality as a third-party compliers.C package. Before that can happen, those modules need to be decoupled from distutils (and any interaction with distutils made a formal interface). There is some work already drafted (and even some merged) in https://github.com/pypa/distutils/tree/debt/compilers-deps.
Let's finish the work. Let's provide solutions for each of the distutils deprecation issues and decouple the compilers functionality. Some backward incompatibility may be acceptable, but we'll aim to remain compatible where feasible.
Plan
End-state: compilers.C fully decoupled from distutils and extractable as a standalone distribution under jaraco/compilers.C. compilers stays a namespace package so future compilers.<lang> siblings can be added. Removal of the top-level distutils hack is gated on these replacements shipping.
The work is broken into the sub-issues tracked above. Grouped into phases:
Phase 1 — Decouple compilers.C from distutils internals (pypa/distutils)
- #5265 — Fix mingw bare
-Ounder-m32(closes #4873) - #5266 — Inline logging (drop
distutils._log) - #5267 — Vendor small build/filesystem helpers
- #5268 — Replace version & platform-compat shims
- #5269 — Move to stdlib
sysconfig+ injection shim (investigation) - #5270 — Consolidate compiler exceptions at
compilers.errors
Phase 2 — Public API (pypa/distutils)
- #5271 — Public API for
compilers.C(resolves #2806, #4540)
Phase 3 — Migration docs (pypa/setuptools)
- #5272 — Fill migration-guide gaps for ccompiler / new_compiler / get_platform (resolves doc half of #2806)
Phase 4 — Retire the hack (pypa/setuptools; gated on Phases 1–3)
- #5273 — Retire the distutils hack (see also #3625, #3622)
Extraction
- #5274 — Stand up standalone
jaraco/compilers.Cdistribution
Design decisions: the standalone library defaults to stdlib sysconfig (behavior change acceptable), with a possibly-deprecated shim for distutils/setuptools to inject specialized behavior; no setuptools re-export layer — consumers import from the compilers package directly.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the Phase 1–4 sub-issues (#5265–#5273) and the drafted pypa/distutils branch debt/compilers-deps. Trace the distutils_hack, distutils.compilers, and compilers.C boundaries described in the plan. The work is done when compilers.C is decoupled, its public API and migration docs are complete, and the hack can be retired after the listed replacements ship.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system, devtools
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100