Repository navigation
Update pixi and use pyrefly as type checker - #137
Merged
Merged
Conversation
Configure Pyrefly alongside mypy and annotate existing method overrides required by the strict preset. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace untyped lambdas with annotated local helpers so strict Pyrefly can infer callback parameters without changing test behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Validate optional grids, callbacks, and calculator state before use so strict type checking reflects the runtime invariants. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Describe the worker JSON schema explicitly and construct RunConfig fields without heterogeneous keyword unpacking. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Accept both compile-compatible and e3nn Irreps at the symmetric-contraction boundary while preserving the caller's runtime representation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Accept the compile-compatible Irreps used by model construction and keep e3nn conversion internal to Clebsch-Gordan setup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Describe native PySCF factory fallbacks, preserve configured calculator types, and annotate generated modules and iterators accurately. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Implement the nominal PySCF integration contract, align override signatures, and reject unsupported integration modes explicitly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use strict Pyrefly as the repository's sole static type checker and remove obsolete mypy suppressions and configuration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Require e3nn 0.5 or newer to avoid import failures with supported PyTorch releases, while bounding the pre-1.0 dependency below 0.7. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Jens (JensWehner)
requested review from
Sebastian Ehlert (awvwgk)
and
a balanced review from Copilot
October 5, 2026 20:11
Contributor
There was a problem hiding this comment.
Note
Copilot was unable to run its full agentic suite in this review.
Copilot review overview
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR tightens typing across the codebase by migrating from mypy to Pyrefly, adding @override annotations, and strengthening runtime validation/typing in several APIs (PySCF integration, ASE calculator, and benchmark tooling).
Changes:
- Replace mypy configuration/hooks with Pyrefly (
pyrefly.toml, pre-commit, pixi tooling, docs). - Improve type safety via
typing_extensions.override, refined type hints, and safer test monkeypatch patterns. - Update PySCF/ASE integration behavior and add tests around error cases and interface contracts.
| File | Description |
|---|---|
| skala/tests/utils.py | Adds @override to a test functional implementation. |
| skala/tests/test_xc_integrator.py | Improves iterator return typing for model feature chunks. |
| skala/tests/test_pyscf_gradients.py | Adds @override annotations for gradient-related test functionals. |
| skala/tests/test_pyscf_classes.py | Adds a regression test for gradients requiring initialized UKS grids. |
| skala/tests/test_model_chunking.py | Replaces lambdas with named functions for monkeypatching; adds @override in test functional. |
| skala/tests/test_gradient_core.py | Adds @override for test functional override clarity. |
| skala/tests/test_gpu4pyscf_gradients.py | Removes type-ignores around torch streams; adds @override in test functionals. |
| skala/tests/test_gpu4pyscf_ao_screening.py | Adds assertions and local vars to satisfy stricter typing for grids. |
| skala/tests/test_evaluation.py | Avoids direct mutation on frozen dataclass by using setattr helper under pytest.raises. |
| skala/tests/test_ase.py | Adds parameter validation tests and reduces type-ignores by asserting calculator shape/types. |
| skala/tests/test_ao_screening.py | Strengthens typing, compilation monkeypatching, and adds NumInt contract/mode tests. |
| skala/src/skala/pyscf/xc_integrator.py | Refactors del statements (readability/type tooling). |
| skala/src/skala/pyscf/retry.py | Guards callback invocation with a None check. |
| skala/src/skala/pyscf/numint.py | Makes SkalaNumInt inherit PySCF NumInt and adds mode validation + libxc shim. |
| skala/src/skala/pyscf/memory_estimators.py | Tweaks memory arithmetic types under strict checking. |
| skala/src/skala/pyscf/grids.py | Removes type-ignore inheritance, adds overrides, and validates coords/weights before layout prep. |
| skala/src/skala/pyscf/gradients.py | Adds @override and explicit runtime error when grids are uninitialized. |
| skala/src/skala/pyscf/feature_math.py | Marks forward as an override for feature modules. |
| skala/src/skala/pyscf/dft.py | Adds a helper to require SkalaNumInt and adds @override annotations. |
| skala/src/skala/pyscf/backend.py | Removes unnecessary type-ignore around torch.from_dlpack. |
| skala/src/skala/pyscf/ao_evaluation.py | Adds @override, refactors context fields, and removes apply type-ignores. |
| skala/src/skala/pyscf/__init__.py | Refines typing of KS factory functions and generalizes config application with a TypeVar. |
| skala/src/skala/gpu4pyscf/grids.py | Removes type-ignore from grids inheritance. |
| skala/src/skala/gpu4pyscf/gradients.py | Removes type-ignore from gradient base classes. |
| skala/src/skala/gpu4pyscf/dft.py | Removes type-ignore around typing of xc swap for density fitting. |
| skala/src/skala/functional/traditional.py | Adds @override annotations to functional methods. |
| skala/src/skala/functional/load.py | Adds @override annotations and removes a torch.jit.load type-ignore. |
| skala/src/skala/dispersion.py | Cleans up type-ignores and adjusts import suppression for Pyrefly. |
| skala/src/skala/ase/calculator.py | Introduces validated frozen parameters dataclass and strengthens input/type handling. |
| pyrefly.toml | Adds strict Pyrefly configuration and missing-import allowlist. |
| pyproject.toml | Removes mypy tool configuration (migration). |
| pixi.toml | Updates Pixi requirements, adds pyrefly + typing-extensions, and reshapes environments. |
| model/tests/test_utils.py | Switches tests to use local Irreps wrapper directly. |
| model/src/skala_model/utils/symmetric_contraction.py | Migrates to local Irreps type and adds @override on forwards. |
| model/src/skala_model/utils/pad_ragged.py | Removes torch.jit tracing type-ignores. |
| model/src/skala_model/model.py | Adds @override, refines ignores for Pyrefly, and replaces type-ignores with asserts. |
| model/src/skala_model/layers.py | Adds @override annotations to module forward methods. |
| model/pyproject.toml | Pins e3nn version range. |
| gauxc/src/skala_gauxc/export.py | Removes structured dtype construction type-ignores. |
| benchmark/tests/test_timing.py | Adds unit tests for timeline mark type enforcement. |
| benchmark/tests/test_runner.py | Adds a JSON round-trip test for RunConfig. |
| benchmark/tests/test_orchestrator.py | Replaces lambda monkeypatch with named function for typing. |
| benchmark/tests/test_metrics.py | Adds tests for invalid iteration counts. |
| benchmark/tests/test_docs.py | Replaces generator-throw lambda with explicit failing function for typing. |
| benchmark/tests/test_cli.py | Replaces lambdas with typed fakes for monkeypatch targets. |
| benchmark/src/skala_benchmark/timing.py | Introduces typed CUDA mark protocol, type checks in timelines, and Generator return types. |
| benchmark/src/skala_benchmark/runner.py | Adds TypedDicts for JSON config parsing and tightens some types/casts. |
| benchmark/src/skala_benchmark/report/prose.py | Normalizes notes with an explicitly typed intermediate list. |
| benchmark/src/skala_benchmark/metrics.py | Avoids int(None) and improves robustness of iterations metric parsing. |
| benchmark/src/skala_benchmark/fitting.py | Refactors loops to remove None asserts and improve typing/clarity. |
| CONTRIBUTING.md | Updates dev instructions to Pixi 0.81 and new dev environment usage. |
| AGENTS.md | Updates environment/type-checking guidance from mypy to Pyrefly. |
| .pre-commit-config.yaml | Replaces mypy hook with pyrefly check. |
| .github/workflows/lint.yml | Uses a Pixi environment compatible with updated environment definitions. |
| .github/actions/setup-pixi/action.yml | Updates Pixi version to v0.81.0. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
99
to
+122
| def from_json(cls, path: str | Path) -> RunConfig: | ||
| with Path(path).open(encoding="utf-8") as fh: | ||
| data = json.load(fh) | ||
| data: _RunConfigJson = json.load(fh) | ||
| molecule = data["molecule"] | ||
| functional = data["functional"] | ||
| return cls( | ||
| **{ | ||
| **data, | ||
| "molecule": Molecule(**data["molecule"]), | ||
| "functional": FunctionalSpec( | ||
| name=data["functional"]["name"], | ||
| kind=FunctionalKind(data["functional"]["kind"]), | ||
| ), | ||
| "device": Device(data["device"]), | ||
| } | ||
| molecule=Molecule( | ||
| atomic_numbers=molecule["atomic_numbers"], | ||
| geometry_bohr=molecule["geometry_bohr"], | ||
| charge=molecule.get("charge", 0), | ||
| multiplicity=molecule.get("multiplicity", 1), | ||
| ), | ||
| basis=data["basis"], | ||
| functional=FunctionalSpec( | ||
| name=functional["name"], | ||
| kind=FunctionalKind(functional["kind"]), | ||
| ), | ||
| device=Device(data["device"]), | ||
| ansatz=data.get("ansatz", "UKS"), | ||
| density_fit=data.get("density_fit", True), | ||
| auxbasis=data.get("auxbasis"), | ||
| grid_level=data.get("grid_level", 3), | ||
| conv_tol=data.get("conv_tol", 5e-6), | ||
| conv_tol_grad=data.get("conv_tol_grad"), |
Sebastian Ehlert (awvwgk)
approved these changes
Oct 6, 2026
Sebastian Ehlert (awvwgk)
left a comment
Member
There was a problem hiding this comment.
Thank you, looks good to me.
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.

pixi env updates