Skip to content

Install the build toolchain, so a direct setup.py invocation works - #769

Merged
wbarnha merged 2 commits into
masterfrom
claude/setuptools-module-not-found-69fnuz
Aug 10, 2026
Merged

wbarnha merged 2 commits into
masterfrom
claude/setuptools-module-not-found-69fnuz

Conversation

@wbarnha

@wbarnha wbarnha commented Aug 10, 2026

Copy link
Copy Markdown
Member

USE_CYTHON=1 python setup.py build_ext --inplace fails in CI with
ModuleNotFoundError: No module named 'setuptools'.

Nothing installed setuptools. pip install . looks like it would --
it does read [build-system].requires -- but PEP 517 build isolation
provisions those packages into a throwaway environment that is
discarded once the wheel is built, leaving nothing behind on the
interpreter that ran pip. That was survivable while every build went
through pip. It stops being survivable the moment something drives
setup.py directly, which building the extensions in place requires:
a build into site-packages is never imported by the test suite, since
pytest runs from the repository root and import faust resolves to the
source tree.

Python 3.12 is where this turns into an error rather than a latent
assumption. PEP 632 removed distutils, ensurepip stopped seeding
setuptools along with it, and the interpreters actions/setup-python
provides now ship with none.

Add requirements/build.txt, mirroring [build-system].requires, and
pull it into test.txt so a test environment can build the extensions
rather than only consume them.

Cython belongs in it for a second, quieter reason. Without Cython
setup.py falls back to compiling pre-generated .c files, which this
repository does not track; ve_build_ext then swallows the resulting
error and re-runs setup with no ext_modules at all. build_ext --inplace exits 0 having built nothing, and the failure resurfaces
much later as accelerated imports silently falling back to pure Python.
Verified both halves against a bare interpreter: setuptools missing
fails loudly, setuptools present but Cython missing exits 0 and writes
no .so.

Two more instances of the same assumption, fixed here rather than left
to fail the same way:

  • dist.txt pinned setuptools>=30.3.0,<69.0.0, which contradicts the
    setuptools>=69 pyproject.toml asks for -- an environment built from
    that file could not run the project's own build. It now includes
    build.txt, plus the build frontend scripts/build needs.

  • scripts/build ran setup.py sdist bdist_wheel directly, so it dies
    on the same missing import on any 3.12+ interpreter. It now uses
    python -m build, which provisions the backend itself and names the
    sdist per PEP 625 as PyPI requires -- the same reason the release
    workflow's sdist job already uses it.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01DwJCsUD7opjiNRKdkQY87F

`USE_CYTHON=1 python setup.py build_ext --inplace` fails in CI with
`ModuleNotFoundError: No module named 'setuptools'`.

Nothing installed setuptools.  `pip install .` looks like it would --
it does read `[build-system].requires` -- but PEP 517 build isolation
provisions those packages into a throwaway environment that is
discarded once the wheel is built, leaving nothing behind on the
interpreter that ran pip.  That was survivable while every build went
through pip.  It stops being survivable the moment something drives
setup.py directly, which building the extensions *in place* requires:
a build into site-packages is never imported by the test suite, since
pytest runs from the repository root and `import faust` resolves to the
source tree.

Python 3.12 is where this turns into an error rather than a latent
assumption.  PEP 632 removed distutils, `ensurepip` stopped seeding
setuptools along with it, and the interpreters `actions/setup-python`
provides now ship with none.

Add requirements/build.txt, mirroring `[build-system].requires`, and
pull it into test.txt so a test environment can build the extensions
rather than only consume them.

Cython belongs in it for a second, quieter reason.  Without Cython
setup.py falls back to compiling pre-generated .c files, which this
repository does not track; `ve_build_ext` then swallows the resulting
error and re-runs setup with no `ext_modules` at all.  `build_ext
--inplace` exits 0 having built nothing, and the failure resurfaces
much later as accelerated imports silently falling back to pure Python.
Verified both halves against a bare interpreter: setuptools missing
fails loudly, setuptools present but Cython missing exits 0 and writes
no .so.

Two more instances of the same assumption, fixed here rather than left
to fail the same way:

- dist.txt pinned `setuptools>=30.3.0,<69.0.0`, which contradicts the
  `setuptools>=69` pyproject.toml asks for -- an environment built from
  that file could not run the project's own build.  It now includes
  build.txt, plus the `build` frontend scripts/build needs.

- scripts/build ran `setup.py sdist bdist_wheel` directly, so it dies
  on the same missing import on any 3.12+ interpreter.  It now uses
  `python -m build`, which provisions the backend itself and names the
  sdist per PEP 625 as PyPI requires -- the same reason the release
  workflow's sdist job already uses it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DwJCsUD7opjiNRKdkQY87F
@codecov

codecov Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.07%. Comparing base (0866b77) to head (0c4e8f4).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #769      +/-   ##
==========================================
+ Coverage   96.05%   96.07%   +0.01%     
==========================================
  Files         103      103              
  Lines       11081    11081              
  Branches     1189     1189              
==========================================
+ Hits        10644    10646       +2     
+ Misses        345      343       -2     
  Partials       92       92              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Two leftovers from the same shrinking surface, both already visible as
warnings in every CI build:

    _DeprecatedInstaller: setuptools.installer and fetch_build_eggs
    are deprecated
      dist.fetch_build_eggs(dist.setup_requires)
    UserWarning: Unknown distribution option: 'tests_require'

`setup_requires=["setuptools_scm"]` is resolved by `fetch_build_eggs()`,
the easy_install-era installer setuptools is winding down, and it is
redundant twice over: setuptools_scm is in `[build-system].requires`, so
any PEP 517 build has it, and requirements/build.txt now provides it for
a direct setup.py call.  Dropping it does not change the derived version
-- verified, still 0.13.2.dev7+ga87a5f16 from setuptools_scm, and the
wheel and sdist both still build.

`tests_require` only ever fed `setup.py test`.  setuptools 72.0.0 deleted
that command, which is why setuptools now reports the option as unknown
and discards it; requirements/test.txt is what actually installs the test
dependencies.

The same setuptools release is behind issue #638.  Not faust's code --
intervaltree's, whose setup.py imported `setuptools.command.test`, gone
as of 72.0.0 (confirmed against the wheels: present in 71.1.0, absent in
72.0.0, released 2024-07-29, the day the issue was filed).  Every
intervaltree release from 3.0.1 to 3.1.0 shipped an sdist and no wheel,
so installing it had to run that setup.py, and pip and uv provision the
newest setuptools into the isolated build environment -- so faust
installs broke on a dependency the day it shipped.

intervaltree 3.2.0 (2025-12-19), its first release in five years, drops
setup.py for a hatchling backend and publishes wheels; neither half can
recur.  It was already resolving to 3.2.1 in CI, but the requirement was
unpinned, so a lock or constraint file could still land on a broken one.
Floor it at 3.2.0.  Its requires-python covers every interpreter faust
supports.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DwJCsUD7opjiNRKdkQY87F
@wbarnha
wbarnha merged commit e2d801a into master Aug 10, 2026
30 checks passed
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.

2 participants