Skip to content

feat: ❄️ add Nix flake and update dependencies - #23

Merged
Panadestein merged 10 commits into
mainfrom
feat/nix-flake
Sep 2, 2026
Merged

feat: ❄️ add Nix flake and update dependencies#23
Panadestein merged 10 commits into
mainfrom
feat/nix-flake

Conversation

@Panadestein

@Panadestein Panadestein commented Sep 1, 2026

Copy link
Copy Markdown
Member

Two related pieces of environment work.

1. Nix flake dev shell

  • flake.nix + flake.lock: a devShells.default for x86_64-linux, aarch64-linux and aarch64-darwin providing uv, git and gh. Entering the shell runs uv sync --all-groups and puts the project venv on PATH, so Python and every project dependency stay under uv's control — the flake only supplies the native libraries (libstdc++, zlib) that binary wheels dlopen at runtime. GPU extras are intentionally not synced since they are CUDA/ROCm specific.
  • .envrc (use flake) for direnv users, and .gitignore entries for result, result-*, .direnv/.
  • README gains an Alternative: Nix flake subsection. Nothing in CI depends on the flake and the DevContainer flow is unchanged.

2. Python 3.12-3.14

requires-python moves from >=3.11,<3.14 to >=3.12,<3.15.

Raising the floor is the substantive part: numpy 2.5 requires >=3.12, so with our numpy>=2.4.4,<3 constraint a 3.11 user was silently pinned to numpy 2.4.x. Python 3.11 is also in security-only mode until Oct 2027.

  • .python-version, docpages.yml and copilot-setup-steps.yml now use 3.14. The benchmark job deliberately stays on 3.13: it builds both the base and the PR checkout in a single run, so its interpreter must satisfy requires-python on both sides.
  • The test matrix covers the ends of the range, 3.12 and 3.14, instead of 3.11 and 3.13.
  • ruff's target-version and pyright's pythonVersion deliberately stay at py312: they must track the oldest supported interpreter, otherwise they would green-light syntax that breaks for users on 3.12.

BREAKING CHANGE: Python 3.11 is no longer supported.

Validation

  • nix flake check --all-systems — all checks passed, no eval warnings.
  • nix develop on a clean checkout, and uv sync --all-groups on 3.14: Python 3.14.4, pytest -m 'not slow and not perf' gives 21 passed, 1 skipped (no CuPy).
  • --extra gpu-nvidia resolves and installs on 3.14. --extra gpu-rocm cannot be built here, but it fails identically on 3.11 — the cupy sdist needs a local ROCm toolchain, so this is pre-existing, not a regression.

Provides a `nix develop` shell with uv, git and gh plus the native libs
binary wheels need, as an alternative to the DevContainer. Python and all
project dependencies stay managed by uv. Also drops the duplicate arXiv
link from the README abstract.
@Panadestein Panadestein changed the title feat: add Nix flake dev shell feat: ❄️ add Nix flake dev shell Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Test Results

  4 files  ±0    4 suites  ±0   2m 5s ⏱️ -1s
 37 tests ±0   36 ✅ ±0  1 💤 ±0  0 ❌ ±0 
128 runs  ±0  126 ✅ ±0  2 💤 ±0  0 ❌ ±0 

Results for commit a839559. ± Comparison against base commit 4a18982.

♻️ This comment has been updated with latest results.

Validated with nix flake check --all-systems and a full dev shell run.

- Commit flake.lock, pinning nixpkgs.
- Drop x86_64-darwin: unsupported by nixpkgs-unstable since 26.11.
- Use stdenv.hostPlatform.isLinux and pkgs.nixfmt (deprecation warnings).
- Activate the venv via UV_PROJECT_ENVIRONMENT instead of sourcing
  .venv/bin/activate, which hardcodes paths and misses relocated venvs.
The file was invalid JSON, so cSpell silently fell back to its defaults.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an optional Nix flake–based development environment for src_method, complementing the existing DevContainer workflow, and updates developer documentation/spellcheck configuration accordingly.

Changes:

  • Add a flake.nix/flake.lock providing a devShell with uv, git, gh, and required runtime native libs.
  • Add direnv support via .envrc and ignore Nix/direnv artifacts in .gitignore.
  • Update README.md to document the Nix workflow and clean up minor documentation content; fix cspell.json validity and extend its word list.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Documents the Nix flake workflow and adjusts link/reference content.
flake.nix Defines the Nix dev shell environment and shell initialization behavior.
flake.lock Pins the nixpkgs input revision for reproducible flake evaluation.
cspell.json Fixes invalid JSON and adds relevant dictionary words.
.gitignore Ignores Nix build outputs and direnv state.
.envrc Enables automatic nix develop entry for direnv users.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread README.md Outdated
Comment thread README.md
numpy 2.5 requires >=3.12, so a 3.11 floor silently capped users at
numpy 2.4.x; 3.11 is also security-only until Oct 2027. Raise the floor to
3.12 and add 3.14.

- requires-python >=3.12,<3.15 and matching classifiers.
- .python-version, docpages, copilot-setup-steps and the Sonar job use 3.14.
- Test matrix covers the range ends: 3.12 and 3.14.
- ruff target-version and pyright pythonVersion track the *oldest* supported
  version, so they stay one step behind the default at 3.12.

BREAKING CHANGE: Python 3.11 is no longer supported.
@Panadestein Panadestein changed the title feat: ❄️ add Nix flake dev shell feat: add Nix flake dev shell and move to Python 3.12-3.14 Sep 1, 2026
@Panadestein Panadestein changed the title feat: add Nix flake dev shell and move to Python 3.12-3.14 feat: add Nix flake dev shell and update deps Sep 1, 2026
@Panadestein Panadestein changed the title feat: add Nix flake dev shell and update deps feat: add Nix flake and update dependencies Sep 1, 2026
@Panadestein Panadestein changed the title feat: add Nix flake and update dependencies feat: ❄️ add Nix flake and update dependencies Sep 1, 2026
Panadestein and others added 6 commits September 1, 2026 16:21
The pre-commit config still referenced the retired charliermarsh/ruff-pre-commit
mirror, but update-ruff.yml only rewrites revs for astral-sh/ruff-pre-commit, so
the hook silently stayed on v0.12.11 while pyproject moved to 0.16.5.

Point the hook at astral-sh and pin both to 0.16.5, which lets the monthly
workflow keep them in sync from now on.

Fixes the B008 this uncovered: random_mpo built its default Generator in the
signature, so every caller that omitted rng shared one generator and test data
depended on execution order.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Ramón L. Panadés-Barrueta <rpana92@gmail.com>
The job benchmarks the base commit and the PR commit in one run, so pinning
it to 3.14 broke it: main still declares requires-python <3.14 and uv refused
to sync the base checkout. Use 3.13, which satisfies both ranges.
Signed-off-by: Ramón L. Panadés-Barrueta <rpana92@gmail.com>
Git text-merged the two lockfiles and produced an ipython entry without a
source field, so every job died at 'uv sync' with:

  error: Failed to parse `uv.lock`
    Caused by: Dependency `ipython` has missing `source` field but has more
    than one matching package

Lockfiles cannot be merged line by line; reset to main's copy and re-resolved
against the merged pyproject.
The comparison runs on a shared ubuntu-latest runner, where PRs that touch
no source file have drifted by 10.8%, 12.4% and 20.2%. At 10% the check
reported noise as a regression often enough to be ignored, which defeats
the point of having it.
@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

@Panadestein
Panadestein merged commit 9dad224 into main Sep 2, 2026
12 checks passed
@Panadestein
Panadestein deleted the feat/nix-flake branch September 3, 2026 07:07
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