Skip to content

Adopt the standalone compilers packages - #430

Open
jaraco wants to merge 2 commits into
mainfrom
feature/adopt-compilers-package
Open

jaraco wants to merge 2 commits into
mainfrom
feature/adopt-compilers-package

Conversation

@jaraco

@jaraco jaraco commented Sep 10, 2026

Copy link
Copy Markdown
Member

Adopt the standalone compilers distributions that were extracted from distutils, completing the extraction side of the compilers-decoupling epic (pypa/setuptools#5264, pypa/setuptools#5274).

What

  • Declare runtime dependencies on compilers.C, compilers.common, and compilers.errors (published from coherent-oss).
  • Delete the vendored distutils/compilers/ tree (its contents now live in, and are CI-tested by, those packages).
  • Rewire the ~10 internal references from distutils.compilers.* to the top-level packages:
    • the compiler shims (ccompiler, unixccompiler, _msvccompiler, cygwinccompiler, zosccompiler) → compilers.C.*
    • errors → compilers.C.errors + compilers.errors
    • util → compilers.common.platform
    • compat.numpy → compilers.C.base
  • The compiler tests move out with the tree; conftest.py drops the now-orphaned suppress_path_mangle fixture and repoints disable_macos_customization at compilers.common.platform.macos.

The public shims are unchanged in behavior — distutils.ccompiler.CCompiler is compilers.C.base.Compiler, distutils.errors.CCompilerError is compilers.errors.Error, distutils.util.get_platform() routes through compilers.common.platform.detect, etc.

There's no dependency cycle: compilers.C imports distutils only lazily on deprecated paths (deprecated Compiler.spawn, debug_print) and deliberately doesn't declare it (coherent-oss/compilers.C#1), so this is a clean one-way distutils → compilers.C dependency.

Verification

With the three packages installed, the full suite passes (220 passed, 9 skipped) and ruff is clean.

Notes

  • No newsfragment here by design — the changelog entry will be added when this syncs into setuptools.
  • Companion setuptools work is required: setuptools vendors distutils as setuptools/_distutils, so once distutils depends on compilers.C, setuptools must bundle or depend on compilers.C/compilers.common/compilers.errors for its _distutils to keep working. That's the pivot into Phase 4 (Retire the distutils hack (remove top-level distutils injection) setuptools#5273) and will be handled separately.

jaraco and others added 2 commits September 10, 2026 16:20
Depend on the extracted compilers.C, compilers.common, and
compilers.errors distributions (published from coherent-oss) and delete
the vendored distutils/compilers/ tree. The compiler shims
(ccompiler/unixccompiler/_msvccompiler/cygwinccompiler/zosccompiler),
errors, util, and compat.numpy now import from the top-level compilers
packages instead of distutils.compilers.

The compiler tests move out with the tree (they're tested in compilers.C
now); drop the orphaned suppress_path_mangle fixture and repoint
disable_macos_customization at compilers.common.platform.macos.

Ref pypa/setuptools#5264, pypa/setuptools#5274.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pin lower bounds to the versions that ship a py.typed marker so mypy
(and downstream type checkers) recognize the compilers imports as typed.

Ref coherent-oss/coherent.build#72

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jaraco

jaraco commented Sep 11, 2026

Copy link
Copy Markdown
Member Author

CI is green except the expected ci_setuptools integration failure:

setuptools/_distutils/errors.py: from compilers.C.errors import ...
ModuleNotFoundError: No module named 'compilers'

That job drops the current distutils into setuptools' vendored _distutils, whose (synced) errors.py now imports from compilers.C — but setuptools' environment doesn't have the compilers.* packages installed. Resolving it is the companion setuptools change (bundle or depend on compilers.C/compilers.common/compilers.errors), i.e. Phase 4 of pypa/setuptools#5264 (pypa/setuptools#5273). Everything else — full test matrix, mypy, docs, coverage — passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant