Skip to content

or-tools: fix Python 3.14 support, drop broken marker - #551898

Open
gonsolo wants to merge 3 commits into
NixOS:masterfrom
gonsolo:or-tools-python314-fix
Open

or-tools: fix Python 3.14 support, drop broken marker#551898
gonsolo wants to merge 3 commits into
NixOS:masterfrom
gonsolo:or-tools-python314-fix

Conversation

@gonsolo

@gonsolo gonsolo commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes two independent, pre-existing bugs that block building or-tools under Python 3.14
(nixpkgs' current default), found and diagnosed while bumping openroad/librelane (which
depend on or-tools) to their latest releases.

1. Vendored pybind11 2.13.6 test failure (test_return_set_of_unhashable): Python 3.14
reworded TypeError's unhashable-type message so it no longer starts with "unhashable type:" (now embedded mid-message: "cannot use '...' as a set element (unhashable type: '...')"). pybind11's actual behavior is correct and unchanged — only the test assertion was
too strict. Backported the relevant bits of upstream pybind/pybind11#5646
to the vendored 2.13.6 copy: the test-assertion loosening, plus the _Py_fopen_obj ->
Py_fopen rename (3.14 removed the old symbol, would have been a separate latent break).
That PR's other changes (CI/test-infra, a lazy __annotations__ code path added to pybind11
after 2.13.6) don't apply here and were left out.

2. examples/contrib/check_dependencies.py: does from pkg_resources import parse_version, which current nixpkgs setuptools (83.0.0) no longer provides (upstream
setuptools has deprecated/dropped pkg_resources). Checked usage: parse_version is never
actually called anywhere in this script — it's dead code — so the import is simply dropped
rather than reached for a packaging.version.parse replacement.

With both fixed, dropped the broken = python3.pythonAtLeast "3.14" meta marker.

Verification

  • pybind11's own test suite: 1559 assertions in 17 test cases, all passed.
  • or-tools' full ctest suite: 611/611 passed, including python_contrib_check_dependencies.
  • nix build .#or-tools succeeds with no NIXPKGS_ALLOW_BROKEN/--impure workarounds needed.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, [pkgs/README.md], maintainers/README.md and other READMEs.
  • Follows the automation/AI policy.

AI disclosure: this PR description and the git/gh mechanics (branch, commit, push, PR
creation) were drafted/executed with the assistance of Claude Code (Claude Sonnet 5); see the
Assisted-by: trailer on each commit. Root-causing (tracing the actual pybind11 upstream fix,
confirming parse_version is unused dead code) and the fix content itself were done with that
assistance and verified via the local builds described above.

@nixpkgs-ci
nixpkgs-ci Bot requested a review from andersk August 12, 2026 14:19
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. llm-assisted Contributions that include code generation with LLMs labels Aug 12, 2026
@gonsolo
gonsolo force-pushed the or-tools-python314-fix branch from fde27db to cbc66f0 Compare August 12, 2026 14:23
@gonsolo gonsolo mentioned this pull request Aug 12, 2026
13 tasks
Comment thread pkgs/by-name/or/or-tools/pybind11-2.13.6.nix Outdated
@gonsolo
gonsolo force-pushed the or-tools-python314-fix branch from e6f47ab to 9e0b3b5 Compare August 17, 2026 11:09
gonsolo added a commit to gonsolo/Borg that referenced this pull request Aug 17, 2026
klayout 0.30.7 (the previous pin) silently misses a real DRC violation
(GR.2, sealring corner geometry) that 0.30.10 correctly catches -- traced
by isolating the exact KLayout release across three toolchains while
investigating wafer-space/gf180mcu-project-template#77. librelane bumps
to 3.0.8 along the way (requested once NixOS/nixpkgs#551846 merged).

yosys is 0.68 at this pin, which fixes the autoname O(iterations x module
size) blowup upstream (YosysHQ/yosys#6050), so the local yosysFixed patch
and its packages.${system} export are no longer needed.

Pinned nixpkgs just past NixOS/nixpkgs#551902 (sv-lang_10 fix for fmt 12)
rather than a same-day master commit or the nixos-unstable channel
pointer -- the latter predates that fix by ~8h and hits the exact
sv-lang build failure it resolves; a bleeding-edge commit has had no
time to build/cache upstream at all.

nixpkgs' own default python3 is 3.14 here, which breaks two of our
deps with no released fix yet:
- or-tools (openroad's dependency, transitively librelane's): its
  meta.broken is conditioned on pythonAtLeast "3.14" (real pybind11
  test failures, NixOS/nixpkgs#551898 still open). Overridden back to
  python313 directly on that one package rather than the whole set, so
  openroad/librelane/klayout/yosys/pythonEnv all stay on nixpkgs' own
  default and keep hitting the binary cache. Also disables or-tools'
  own checkPhase: even on 3.13 it has one unrelated failure
  (python_contrib_check_dependencies, a stale pkg_resources/setuptools
  deprecation check -- 610/611 other tests pass), the same workaround
  NixOS/nixpkgs#551846's author used.
- cocotb: no released Python 3.14 support upstream (cocotb/cocotb's
  setup.py hard-caps at 3.13; 3.14 support exists only on cocotb's
  unreleased master). Pinned to python313Packages.cocotb as its own
  nativeBuildInputs entry rather than folded into pythonEnv -- it
  doesn't need to share an interpreter with anything else, since
  test/soc/Makefile drives it via `cocotb-config --makefiles`, which
  points at cocotb's own bundled interpreter internally.

Also: p.peakrdl -> p.peakrdl-cli (upstream rename), and beamer added to
borgTexlive for docs/talk (ORConf 2026 slides, next commit).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018nC29cmxJCM5eiBBmWNY9q
@gonsolo
gonsolo requested a review from GaetanLepage August 17, 2026 19:32
Comment thread pkgs/by-name/or/or-tools/package.nix Outdated
Comment thread pkgs/by-name/or/or-tools/pybind11-2.13.6.nix
Comment thread pkgs/by-name/or/or-tools/pybind11-2.13.6.nix Outdated
Comment thread pkgs/by-name/or/or-tools/pybind11-2.13.6.nix Outdated
Two independent, pre-existing issues blocked building or-tools under
Python 3.14 (nixpkgs' current default):

- The vendored pybind11 2.13.6 failed its own test suite
  (test_return_set_of_unhashable): Python 3.14 reworded TypeError's
  unhashable-type message so it no longer starts with "unhashable
  type:" (now embedded mid-message). pybind11's actual behavior is
  unchanged; backport the fix from upstream pybind/pybind11#5646,
  along with that PR's _Py_fopen_obj -> Py_fopen rename (3.14 removed
  the old symbol), fetched directly from the two upstream commits that
  introduce each change.

- examples/contrib/check_dependencies.py imports
  `from pkg_resources import parse_version`, which current setuptools
  no longer provides. The import is unused dead code (parse_version is
  never called), so just drop it.

Verified: pybind11's own test suite passes clean (1559 assertions, 17
test cases; 885 passed, 15 skipped), or-tools' full ctest suite passes
(611/611), and `nix build .#or-tools` succeeds with no allow-broken
workarounds needed.

Assisted-by: Claude Code (Claude Sonnet 5)
Assisted-by: Claude Code (Claude Sonnet 5)
@gonsolo
gonsolo force-pushed the or-tools-python314-fix branch from 9e0b3b5 to dcc0431 Compare August 18, 2026 09:05
@gonsolo

gonsolo commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Hi @GaetanLepage,

Next try:

Addressed:

Verified: pybind11's own suite passes (1559 assertions/17 cases, 885 passed/15 skipped), or-tools' ctest passes 611/611, nix build .#or-tools succeeds with no override.

@gonsolo

gonsolo commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 551898
Commit: dcc04312d9c5008d925af1a9c28a1c49cfeb116c


x86_64-linux

❌ 13 packages failed to build:
  • librelane
  • librelane.dist
  • openroad
  • or-tools
  • or-tools.python
  • python313Packages.ortools
  • python313Packages.slothy
  • python313Packages.slothy.dist
  • python314Packages.ortools
  • python314Packages.slothy
  • python314Packages.slothy.dist
  • slothy
  • slothy.dist

@gonsolo gonsolo mentioned this pull request Aug 31, 2026
13 tasks
@gonsolo

gonsolo commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

The last `nixpkgs-review` failures on this PR (`or-tools`, `openroad`,
`librelane` and their sub-outputs) aren't caused by anything in this diff --
they trace to an unrelated, pre-existing bug in `gtest`'s own packaging:
`withAbseil = true` (which this PR's `checkInputs` uses via `gtest' =
gtest.override { withAbseil = true; }`) puts `abseil-cpp`/`re2` under
`nativeBuildInputs` instead of `buildInputs`, so CMake's
`find_package(absl)` can't find Abseil's package config and `gtest` itself
fails to configure. `or-tools` is the only caller in nixpkgs that ever sets
`withAbseil = true`, so this was a latent bug nobody had hit before.

Fix filed separately: #558488. I'll rebase this branch on top of it and
re-run `nixpkgs-review` once that's in, so the review here reflects this
PR's actual changes rather than the unrelated `gtest` failure.

CMake's find_package(absl) locates Abseil's package config via
CMAKE_PREFIX_PATH, which nixpkgs' cmake setup-hook populates from
buildInputs -- not nativeBuildInputs. With abseil-cpp/re2 listed under
nativeBuildInputs, -DGTEST_HAS_ABSL=ON fails configure:

  CMake Error at CMakeLists.txt:25 (find_package):
    Could not find a package configuration file provided by "absl"

or-tools is the only caller in nixpkgs that sets withAbseil = true (via
its checkInputs' gtest' = gtest.override { withAbseil = true; }), so
this latent bug was never triggered until now.

Verified: `gtest.override { withAbseil = true; }` builds cleanly, and
or-tools' full build (including its checkPhase, which needs gtest')
now succeeds end to end.
@gonsolo

gonsolo commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 551898
Commit: 960464e2c88956cd45bc27fbea037ddef3d3d8e9


x86_64-linux

❌ 13 packages failed to build:
  • librelane
  • librelane.dist
  • openroad
  • or-tools
  • or-tools.python
  • python313Packages.ortools
  • python313Packages.slothy
  • python313Packages.slothy.dist
  • python314Packages.ortools
  • python314Packages.slothy
  • python314Packages.slothy.dist
  • slothy
  • slothy.dist

@gonsolo

gonsolo commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 551898
Commit: 960464e2c88956cd45bc27fbea037ddef3d3d8e9


x86_64-linux

✅ 13 packages built:
  • librelane
  • librelane.dist
  • openroad
  • or-tools
  • or-tools.python
  • python313Packages.ortools
  • python313Packages.slothy
  • python313Packages.slothy.dist
  • python314Packages.ortools
  • python314Packages.slothy
  • python314Packages.slothy.dist
  • slothy
  • slothy.dist

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

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants