Skip to content

[debt] Remove distutils hack #5264

Description

@jaraco

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)

Phase 2 — Public API (pypa/distutils)

Phase 3 — Migration docs (pypa/setuptools)

Phase 4 — Retire the hack (pypa/setuptools; gated on Phases 1–3)

Extraction

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions