Skip to content

Smoke-test bundled modules during inspect - #89

Merged
zsimic merged 2 commits into
mainfrom
smoke-test-bundled-modules
Dec 4, 2026
Merged

zsimic merged 2 commits into
mainfrom
smoke-test-bundled-modules

Conversation

@zsimic

@zsimic zsimic commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Check the python modules of a fresh build

A C extension that fails to build or link doesn't fail the CPython build: make only mentions it in its output, and the module is silently missing.

At the end of a build

The python modules relying on external modules are now imported and smoke tested in the freshly built python. How strictly depends on how the build provided the external module:

Outcome Check
static (compiled by this build), or listed in the new cpython-required-modules setting Build fails if the module is absent, broken, or reports another library version than the one compiled
shared (found on the build host) Warning only. A header on the host doesn't guarantee CPython can use it (the macOS SDK has tk.h, but _tkinter doesn't get built)
absent Not checked
  • External modules declare which python modules rely on them via a new m_provides attribute (for example, openssl provides _ssl _hashlib). Sub-modules share their parent's outcome.
  • The smoke tests live in SMOKE_TESTS in external/_inspect.py: compression round-trips, ssl.create_default_context(), a sha256 via _hashlib, an in-memory sqlite3 query, a ctypes callback (exercising libffi), a dbm write and read, and a Tcl expression. readline and _curses are only imported, since they need a terminal.
  • The version check catches a module that got linked against another copy of its library, for example the build host's.

With inspect

  • Each module in the report is marked: ✅ smoke test passed, ❌ failed (imports, but broken), no marker when it has no smoke test.
  • For a python built by portable-python, the static: entry of its .manifest.yml says what was compiled. Modules relying on those are checked strictly, and inspect exits non-zero if one isn't working. Other modules are only reported.
  • Also: _hashlib is in the default module list, _decimal and _curses now report their libmpdec and ncurses versions, tkinter gets a smoke test, and absent modules no longer show a stray None.

Docs

  • New module checks concept page.
  • The inspect page explains the markers, and that -m replaces the default module list (-m +name adds to it).
  • The config reference lists cpython-required-modules, and the add-a-module guide mentions m_provides.

Tested

  • Unit tests cover the expectations, version matching, manifest parsing, strict inspect, the smoke tests, and the markers.
  • On a macOS 3.14.10 build: _ssl, _hashlib, _lzma, _zstd and _decimal are checked strictly and pass, and _tkinter (shared, absent) gets a warning.
  • inspect passes on that build, on older portable-python builds, and on Apple's /usr/bin/python3.
  • Changing the expected OpenSSL version in memory makes inspect report the version mismatch.

🤖 Generated with Claude Code

@coveralls

coveralls commented Dec 4, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 47242357192

Coverage increased (+0.004%) to 99.969%

Details

  • Coverage increased (+0.004%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 3213
Covered Lines: 3212
Line Coverage: 99.97%
Coverage Strength: 5.0 hits per line

💛 - Coveralls

@zsimic
zsimic merged commit 456e6bd into main Dec 4, 2026
7 checks passed
@zsimic
zsimic deleted the smoke-test-bundled-modules branch December 4, 2026 01:28
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