feat: ❄️ add Nix flake and update dependencies - #23
Merged
Conversation
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.
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.
There was a problem hiding this comment.
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.lockproviding adevShellwithuv,git,gh, and required runtime native libs. - Add direnv support via
.envrcand ignore Nix/direnv artifacts in.gitignore. - Update
README.mdto document the Nix workflow and clean up minor documentation content; fixcspell.jsonvalidity 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.
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.
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Two related pieces of environment work.
1. Nix flake dev shell
flake.nix+flake.lock: adevShells.defaultforx86_64-linux,aarch64-linuxandaarch64-darwinprovidinguv,gitandgh. Entering the shell runsuv sync --all-groupsand puts the project venv onPATH, 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.gitignoreentries forresult,result-*,.direnv/.2. Python 3.12-3.14
requires-pythonmoves from>=3.11,<3.14to>=3.12,<3.15.Raising the floor is the substantive part: numpy 2.5 requires
>=3.12, so with ournumpy>=2.4.4,<3constraint 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.ymlandcopilot-setup-steps.ymlnow 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 satisfyrequires-pythonon both sides.ruff'starget-versionand pyright'spythonVersiondeliberately stay atpy312: 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 developon a clean checkout, anduv sync --all-groupson 3.14: Python 3.14.4,pytest -m 'not slow and not perf'gives 21 passed, 1 skipped (no CuPy).--extra gpu-nvidiaresolves and installs on 3.14.--extra gpu-rocmcannot be built here, but it fails identically on 3.11 — thecupysdist needs a local ROCm toolchain, so this is pre-existing, not a regression.