canibuild 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. {canibuild-0.3.0 → canibuild-0.4.0}/CHANGELOG.md +17 -0
  2. {canibuild-0.3.0 → canibuild-0.4.0}/PKG-INFO +39 -6
  3. {canibuild-0.3.0 → canibuild-0.4.0}/README.md +38 -5
  4. {canibuild-0.3.0 → canibuild-0.4.0}/action.yml +1 -1
  5. {canibuild-0.3.0 → canibuild-0.4.0}/docs/validation.md +33 -0
  6. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/__init__.py +1 -1
  7. canibuild-0.4.0/src/canibuild/capi.py +471 -0
  8. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/check.py +57 -3
  9. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/cli.py +5 -1
  10. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/fixes.py +27 -0
  11. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/rules.py +45 -1
  12. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/sdist.py +15 -1
  13. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/target.py +47 -7
  14. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/verify.py +12 -3
  15. canibuild-0.4.0/tests/test_capi.py +307 -0
  16. {canibuild-0.3.0 → canibuild-0.4.0}/tests/test_check.py +130 -3
  17. {canibuild-0.3.0 → canibuild-0.4.0}/tests/test_fixes.py +35 -0
  18. {canibuild-0.3.0 → canibuild-0.4.0}/tests/test_rules.py +61 -0
  19. {canibuild-0.3.0 → canibuild-0.4.0}/tests/test_sdist.py +37 -0
  20. {canibuild-0.3.0 → canibuild-0.4.0}/tests/test_target.py +34 -0
  21. {canibuild-0.3.0 → canibuild-0.4.0}/tests/test_verify.py +52 -0
  22. {canibuild-0.3.0 → canibuild-0.4.0}/.github/workflows/integrations.yml +0 -0
  23. {canibuild-0.3.0 → canibuild-0.4.0}/.github/workflows/tests.yml +0 -0
  24. {canibuild-0.3.0 → canibuild-0.4.0}/.gitignore +0 -0
  25. {canibuild-0.3.0 → canibuild-0.4.0}/.pre-commit-hooks.yaml +0 -0
  26. {canibuild-0.3.0 → canibuild-0.4.0}/LICENSE +0 -0
  27. {canibuild-0.3.0 → canibuild-0.4.0}/action/run.sh +0 -0
  28. {canibuild-0.3.0 → canibuild-0.4.0}/examples/broken/requirements.txt +0 -0
  29. {canibuild-0.3.0 → canibuild-0.4.0}/examples/clean/pyproject.toml +0 -0
  30. {canibuild-0.3.0 → canibuild-0.4.0}/examples/clean/uv.lock +0 -0
  31. {canibuild-0.3.0 → canibuild-0.4.0}/examples/git/requirements.txt +0 -0
  32. {canibuild-0.3.0 → canibuild-0.4.0}/pyproject.toml +0 -0
  33. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/__main__.py +0 -0
  34. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/lockfiles.py +0 -0
  35. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/model.py +0 -0
  36. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/py.typed +0 -0
  37. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/pypi.py +0 -0
  38. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/report.py +0 -0
  39. {canibuild-0.3.0 → canibuild-0.4.0}/src/canibuild/sources.py +0 -0
  40. {canibuild-0.3.0 → canibuild-0.4.0}/tests/conftest.py +0 -0
  41. {canibuild-0.3.0 → canibuild-0.4.0}/tests/fixtures/base.txt +0 -0
  42. {canibuild-0.3.0 → canibuild-0.4.0}/tests/fixtures/pylock.toml +0 -0
  43. {canibuild-0.3.0 → canibuild-0.4.0}/tests/fixtures/requirements.txt +0 -0
  44. {canibuild-0.3.0 → canibuild-0.4.0}/tests/fixtures/uv-direct-sources.pyproject.toml +0 -0
  45. {canibuild-0.3.0 → canibuild-0.4.0}/tests/fixtures/uv-direct-sources.uv.lock +0 -0
  46. {canibuild-0.3.0 → canibuild-0.4.0}/tests/fixtures/uv.lock +0 -0
  47. {canibuild-0.3.0 → canibuild-0.4.0}/tests/test_cli.py +0 -0
  48. {canibuild-0.3.0 → canibuild-0.4.0}/tests/test_lockfiles.py +0 -0
  49. {canibuild-0.3.0 → canibuild-0.4.0}/tests/test_model.py +0 -0
  50. {canibuild-0.3.0 → canibuild-0.4.0}/tests/test_pypi.py +0 -0
  51. {canibuild-0.3.0 → canibuild-0.4.0}/tests/test_report.py +0 -0
  52. {canibuild-0.3.0 → canibuild-0.4.0}/tests/test_sources.py +0 -0
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0 (2026-12-05)
4
+
5
+ - Free-threaded targets: `--python 3.14t` (or `cp314t`, or the running free-threaded
6
+ interpreter) matches `cp314t` wheels and no longer counts `abi3` wheels, which don't
7
+ install there; on 3.15t `abi3t` wheels (PEP 803) count. `--verify` builds with the
8
+ free-threaded interpreter.
9
+ - New `no-wheel-for-python` warning: the release has compiled wheels, but none for the
10
+ target (for example wheels up to `cp313` when checking 3.15 or 3.14t), so pip/uv will
11
+ build it from the sdist. When the build also has a real problem, the other wheels are
12
+ noted on that finding. Upgrades suggested for it must have a matching wheel.
13
+ - New `c-api-removed` rule for Python 3.15+: unguarded calls in C/C++ sources to the
14
+ functions What's New in Python 3.15 lists as removed (`PyWeakref_GetObject`,
15
+ `PyImport_ImportModuleNoBlock`, `Py_GetPrefix` and others).
16
+ - New `free-threading-limited-api` rule for 3.13t and 3.14t: builds that enable the
17
+ limited C API, which those interpreters reject.
18
+ - `--verify` recognises the compiler and setuptools errors for both new rules.
19
+
3
20
  ## 0.3.0 (2026-12-05)
4
21
 
5
22
  - Git, path and URL dependencies are now checked instead of listed as not checked.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: canibuild
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Check a lockfile for dependencies that will fail to build from source, before you install.
5
5
  Project-URL: Homepage, https://github.com/driftwright/canibuild
6
6
  Project-URL: Issues, https://github.com/driftwright/canibuild/issues
@@ -115,11 +115,41 @@ imports, and parses them with `ast`. It never runs code from a package.
115
115
  | `distutils` | `setup.py` imports `distutils` on Python 3.12+ and setuptools isn't in the build |
116
116
  | `missing-build-requires` | `setup.py` imports a module at top level (such as `torch` or `numpy`) that the sdist doesn't declare in `build-system.requires`, so the isolated build can't import it |
117
117
  | `no-installable-file` | there is no wheel for the target and no sdist |
118
+ | `c-api-removed` | Python 3.15+: a C or C++ source calls a function that [Python 3.15 removed](https://docs.python.org/3.15/whatsnew/3.15.html#removed-c-apis), such as `PyWeakref_GetObject` or `Py_GetPrefix`, outside any version check |
119
+ | `free-threading-limited-api` | free-threaded 3.13t or 3.14t: the build enables the limited C API (`py_limited_api` in `setup.cfg` or `setup.py`, or `Py_LIMITED_API` defined in a source file or `define_macros`), which [these builds reject](https://github.com/python/cpython/issues/111506) |
118
120
 
119
121
  An import inside a `try: ... except ImportError` is ignored. An import inside a function
120
122
  is reported as a warning, since it fails only if that code runs during the build.
121
123
  Packages that build from source with no known problem are listed as such, with a note
122
- when they compile native code.
124
+ when they compile native code. When such a package has compiled wheels, just none for
125
+ the target (say, wheels up to `cp313` but not `cp315` or `cp314t`), it is reported as a
126
+ `no-wheel-for-python` warning, since the build is probably unexpected and needs a
127
+ compiler; the fix names the first newer release with a matching wheel.
128
+
129
+ ### New Python versions and free-threaded builds
130
+
131
+ Pass `--python 3.15` to check a new Python before its wheels are out, and
132
+ `--python 3.14t` (or `cp314t`) for the free-threaded build. Wheel matching follows the
133
+ interpreter: `abi3` wheels don't install on free-threaded 3.13t and 3.14t, and on 3.15t
134
+ only `abi3t` wheels ([PEP 803](https://peps.python.org/pep-0803/)) do.
135
+
136
+ Two checks read the C sources of packages that would be built:
137
+
138
+ - `c-api-removed` looks for calls to the functions listed under "Removed C APIs" in
139
+ What's New in Python 3.15. With GCC 14+ or Clang 16+ the build fails with an implicit
140
+ declaration error; older compilers build a module that fails on import. Calls are
141
+ skipped when they sit inside an `#if` on `PY_VERSION_HEX`, `PY_MINOR_VERSION`,
142
+ `Py_LIMITED_API`, `PYPY_VERSION` or a Cython switch (or a macro defined from one of
143
+ those), when the package defines the name itself (a compat header), and under
144
+ `tests/`, `docs/` and `examples/`. Comments and strings are ignored.
145
+ - `free-threading-limited-api` flags builds that turn on the limited API for 3.13t or
146
+ 3.14t. CPython 3.13 and 3.14 stop the compile with `#error "The limited API is not
147
+ currently supported in the free-threaded build"`, and setuptools refuses
148
+ `py_limited_api` there. Settings behind a `Py_GIL_DISABLED` check are not reported.
149
+
150
+ For example, `pygame==2.6.1` on 3.15 (it calls `PyWeakref_GetObject` in
151
+ `src_c/surface.c`) and `pycryptodome==3.19.0` on 3.14t (`py-limited-api = cp35` in
152
+ `setup.cfg`); `--verify` confirms both.
123
153
 
124
154
  ### Git, path and URL dependencies
125
155
 
@@ -271,7 +301,8 @@ canibuild [check] LOCKFILE... [--python X.Y] [--platform P] [--format text|json]
271
301
  - `LOCKFILE`: one or more of `uv.lock`, `pylock.toml` (or `pylock.NAME.toml`), or a requirements file.
272
302
  Requirements files may include other files with `-r`. Unpinned requirements are checked
273
303
  at the newest release that matches and supports the target Python.
274
- - `--python`: the target Python, such as `3.12`. Defaults to the running interpreter, or
304
+ - `--python`: the target Python, such as `3.12`, `3.15`, or `3.14t` for a free-threaded
305
+ build. Defaults to the running interpreter, or
275
306
  to the oldest version a `uv.lock` or `pylock.toml` allows when the running one is outside
276
307
  its `requires-python`.
277
308
  - `--platform`: `linux-x86_64`, `linux-aarch64`, `musllinux-x86_64`, `musllinux-aarch64`,
@@ -294,7 +325,7 @@ or `$CANIBUILD_CACHE_DIR`).
294
325
 
295
326
  ```yaml
296
327
  - uses: actions/checkout@v4
297
- - uses: driftwright/canibuild@v0.3.0
328
+ - uses: driftwright/canibuild@v0.4.0
298
329
  with:
299
330
  lockfiles: uv.lock # default: every uv.lock, pylock*.toml, requirements*.txt
300
331
  python: "3.12" # default: as for --python below
@@ -317,7 +348,7 @@ when `platform` is the runner's own.
317
348
  ```yaml
318
349
  repos:
319
350
  - repo: https://github.com/driftwright/canibuild
320
- rev: v0.3.0
351
+ rev: v0.4.0
321
352
  hooks:
322
353
  - id: canibuild
323
354
  # args: [--python, "3.12"]
@@ -332,7 +363,9 @@ network access to PyPI.
332
363
  (Mercurial, Subversion, Bazaar) are listed as not checked. Private git repositories work
333
364
  only if `git` can reach them without a prompt.
334
365
  - The checks are static. A `setup.py` that fails for a reason not in the table above, or
335
- that needs a compiler or system library you don't have, isn't caught.
366
+ that needs a compiler or system library you don't have, isn't caught. The C checks only
367
+ cover the removed 3.15 functions and the limited-API conflict; other free-threading
368
+ problems (thread safety, `Py_mod_gil`) and C files over 512 KiB are not inspected.
336
369
  - Requirements files are not resolved: only the packages they list are checked, not their
337
370
  dependencies. Use a lockfile (`uv.lock`, `pylock.toml`, or `pip-compile` output) for the
338
371
  full tree.
@@ -83,11 +83,41 @@ imports, and parses them with `ast`. It never runs code from a package.
83
83
  | `distutils` | `setup.py` imports `distutils` on Python 3.12+ and setuptools isn't in the build |
84
84
  | `missing-build-requires` | `setup.py` imports a module at top level (such as `torch` or `numpy`) that the sdist doesn't declare in `build-system.requires`, so the isolated build can't import it |
85
85
  | `no-installable-file` | there is no wheel for the target and no sdist |
86
+ | `c-api-removed` | Python 3.15+: a C or C++ source calls a function that [Python 3.15 removed](https://docs.python.org/3.15/whatsnew/3.15.html#removed-c-apis), such as `PyWeakref_GetObject` or `Py_GetPrefix`, outside any version check |
87
+ | `free-threading-limited-api` | free-threaded 3.13t or 3.14t: the build enables the limited C API (`py_limited_api` in `setup.cfg` or `setup.py`, or `Py_LIMITED_API` defined in a source file or `define_macros`), which [these builds reject](https://github.com/python/cpython/issues/111506) |
86
88
 
87
89
  An import inside a `try: ... except ImportError` is ignored. An import inside a function
88
90
  is reported as a warning, since it fails only if that code runs during the build.
89
91
  Packages that build from source with no known problem are listed as such, with a note
90
- when they compile native code.
92
+ when they compile native code. When such a package has compiled wheels, just none for
93
+ the target (say, wheels up to `cp313` but not `cp315` or `cp314t`), it is reported as a
94
+ `no-wheel-for-python` warning, since the build is probably unexpected and needs a
95
+ compiler; the fix names the first newer release with a matching wheel.
96
+
97
+ ### New Python versions and free-threaded builds
98
+
99
+ Pass `--python 3.15` to check a new Python before its wheels are out, and
100
+ `--python 3.14t` (or `cp314t`) for the free-threaded build. Wheel matching follows the
101
+ interpreter: `abi3` wheels don't install on free-threaded 3.13t and 3.14t, and on 3.15t
102
+ only `abi3t` wheels ([PEP 803](https://peps.python.org/pep-0803/)) do.
103
+
104
+ Two checks read the C sources of packages that would be built:
105
+
106
+ - `c-api-removed` looks for calls to the functions listed under "Removed C APIs" in
107
+ What's New in Python 3.15. With GCC 14+ or Clang 16+ the build fails with an implicit
108
+ declaration error; older compilers build a module that fails on import. Calls are
109
+ skipped when they sit inside an `#if` on `PY_VERSION_HEX`, `PY_MINOR_VERSION`,
110
+ `Py_LIMITED_API`, `PYPY_VERSION` or a Cython switch (or a macro defined from one of
111
+ those), when the package defines the name itself (a compat header), and under
112
+ `tests/`, `docs/` and `examples/`. Comments and strings are ignored.
113
+ - `free-threading-limited-api` flags builds that turn on the limited API for 3.13t or
114
+ 3.14t. CPython 3.13 and 3.14 stop the compile with `#error "The limited API is not
115
+ currently supported in the free-threaded build"`, and setuptools refuses
116
+ `py_limited_api` there. Settings behind a `Py_GIL_DISABLED` check are not reported.
117
+
118
+ For example, `pygame==2.6.1` on 3.15 (it calls `PyWeakref_GetObject` in
119
+ `src_c/surface.c`) and `pycryptodome==3.19.0` on 3.14t (`py-limited-api = cp35` in
120
+ `setup.cfg`); `--verify` confirms both.
91
121
 
92
122
  ### Git, path and URL dependencies
93
123
 
@@ -239,7 +269,8 @@ canibuild [check] LOCKFILE... [--python X.Y] [--platform P] [--format text|json]
239
269
  - `LOCKFILE`: one or more of `uv.lock`, `pylock.toml` (or `pylock.NAME.toml`), or a requirements file.
240
270
  Requirements files may include other files with `-r`. Unpinned requirements are checked
241
271
  at the newest release that matches and supports the target Python.
242
- - `--python`: the target Python, such as `3.12`. Defaults to the running interpreter, or
272
+ - `--python`: the target Python, such as `3.12`, `3.15`, or `3.14t` for a free-threaded
273
+ build. Defaults to the running interpreter, or
243
274
  to the oldest version a `uv.lock` or `pylock.toml` allows when the running one is outside
244
275
  its `requires-python`.
245
276
  - `--platform`: `linux-x86_64`, `linux-aarch64`, `musllinux-x86_64`, `musllinux-aarch64`,
@@ -262,7 +293,7 @@ or `$CANIBUILD_CACHE_DIR`).
262
293
 
263
294
  ```yaml
264
295
  - uses: actions/checkout@v4
265
- - uses: driftwright/canibuild@v0.3.0
296
+ - uses: driftwright/canibuild@v0.4.0
266
297
  with:
267
298
  lockfiles: uv.lock # default: every uv.lock, pylock*.toml, requirements*.txt
268
299
  python: "3.12" # default: as for --python below
@@ -285,7 +316,7 @@ when `platform` is the runner's own.
285
316
  ```yaml
286
317
  repos:
287
318
  - repo: https://github.com/driftwright/canibuild
288
- rev: v0.3.0
319
+ rev: v0.4.0
289
320
  hooks:
290
321
  - id: canibuild
291
322
  # args: [--python, "3.12"]
@@ -300,7 +331,9 @@ network access to PyPI.
300
331
  (Mercurial, Subversion, Bazaar) are listed as not checked. Private git repositories work
301
332
  only if `git` can reach them without a prompt.
302
333
  - The checks are static. A `setup.py` that fails for a reason not in the table above, or
303
- that needs a compiler or system library you don't have, isn't caught.
334
+ that needs a compiler or system library you don't have, isn't caught. The C checks only
335
+ cover the removed 3.15 functions and the limited-API conflict; other free-threading
336
+ problems (thread safety, `Py_mod_gil`) and C files over 512 KiB are not inspected.
304
337
  - Requirements files are not resolved: only the packages they list are checked, not their
305
338
  dependencies. Use a lockfile (`uv.lock`, `pylock.toml`, or `pip-compile` output) for the
306
339
  full tree.
@@ -15,7 +15,7 @@ inputs:
15
15
  description: Directory the lockfile paths are relative to.
16
16
  default: "."
17
17
  python:
18
- description: Target Python version (X.Y). Defaults to the oldest version the lockfile allows.
18
+ description: Target Python version, such as 3.13 or 3.14t (free-threaded). Defaults to the oldest version the lockfile allows.
19
19
  default: ""
20
20
  platform:
21
21
  description: Target platform, e.g. linux-x86_64, macos-arm64, windows-amd64. Defaults to the runner.
@@ -116,3 +116,36 @@ reference:
116
116
  `flash-attn` 2.8.3.post2 (OmniNWM) with `torch` added to its build through
117
117
  `extra-build-dependencies` gets past the missing import and then fails on
118
118
  `CUDA_HOME environment variable is not set`, which `--verify` now reports.
119
+
120
+ ## Python 3.15 and free-threaded 3.14t
121
+
122
+ Run on 2026-12-05 with the 0.4.0 code, with uv-managed CPython 3.15.2 and
123
+ 3.14.10+freethreaded, GCC 14, on linux-x86_64.
124
+
125
+ The 13 lockfiles above, checked with `--python 3.15` and `--python 3.14t`:
126
+
127
+ | Target | `no-wheel-for-python` | `c-api-removed` | `free-threading-limited-api` |
128
+ | --- | --- | --- | --- |
129
+ | 3.15 | 55 pins (PyYAML 6.0.1, aiohttp 3.11.16, cffi 1.17.1, greenlet 3.3.1, numpy 1.26.4, pydantic-core 2.33.2, ...) | psycopg2-binary 2.9.9 (nvidia-chain-server) | n/a |
130
+ | 3.14t | 59 pins (the above plus bcrypt 5.0.0, hf-xet 1.2.0, regex 2024.11.6, ...) | n/a | none |
131
+
132
+ Real builds of the C findings, and of packages that look similar but are fine:
133
+
134
+ | Package | Target | canibuild | Real build |
135
+ | --- | --- | --- | --- |
136
+ | pygame 2.6.1 | 3.15 | `c-api-removed` (`PyWeakref_GetObject`, `src_c/surface.c`) | fails: `implicit declaration of function 'PyWeakref_GetObject'`, confirmed by `--verify` |
137
+ | psycopg2-binary 2.9.9 | 3.15 | `c-api-removed` (`psycopg/connection_int.c:1050`) | fails with the same error, confirmed |
138
+ | pycryptodome 3.19.0 | 3.14t | `free-threading-limited-api` (`py-limited-api = cp35` in `setup.cfg`) | fails: setuptools `` `Py_LIMITED_API` is incompatible with `Py_GIL_DISABLED` ``, confirmed |
139
+ | sentencepiece 0.2.0 | 3.15 | builds from source (SWIG code under `#ifdef SWIGPYTHON_BUILTIN`) | builds |
140
+ | psycopg2 2.9.13, pycurl 7.49.0, PyQt5-sip 12.20.1, msgpack 1.2.4 | 3.15 | builds from source (calls behind `PY_VERSION_HEX` checks) | build |
141
+ | psutil 7.2.2, pycryptodome 3.23.0, gssapi 1.12.0 | 3.14t | builds from source (limited API only when `Py_GIL_DISABLED` is unset) | not built; the settings are visibly conditional |
142
+
143
+ The sentencepiece run and a first version that also reported cffi 1.17.1 (a header it
144
+ ships for generated modules) and sip 6.17.3 (C templates in a pure-Python package) led
145
+ to the rules for optional `#ifdef` branches, included headers and pure-Python builds.
146
+ With those, 32 current releases of common C-extension packages, forced to build with
147
+ `--no-binary :all:`, produce no C findings on either target.
148
+
149
+ Not caught: other reasons a build fails on a new Python. numpy 1.26.4, for example, is
150
+ only reported as building from source on 3.15; whether it compiles there is not
151
+ checked.
@@ -1,3 +1,3 @@
1
1
  """Find the dependencies in a lockfile that will fail to build from source."""
2
2
 
3
- __version__ = "0.3.0"
3
+ __version__ = "0.4.0"