Skip to content

Update pixi and use pyrefly as type checker - #137

Merged
Sebastian Ehlert (awvwgk) merged 32 commits into
mainfrom
update_pixi
Oct 6, 2026
Merged

Sebastian Ehlert (awvwgk) merged 32 commits into
mainfrom
update_pixi

Conversation

@JensWehner

@JensWehner Jens (JensWehner) commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor
  • Replace mypy 2.3.1 with strict Pyrefly 1.3.2 and resolve all resulting diagnostics.
  • Add consolidated dev and dev-gpu environments and update Pixi from 0.78 to 0.81.
  • Refresh the lockfile, including Python patch releases, NumPy/SciPy/pandas, DFT-D3, and CUDA 13 packages.
  • Strengthen typing and validation across PySCF, ASE, model, benchmark, and test code.

pixi env updates

  • Python 3.11.15 → 3.11.16 and 3.12.13 → 3.12.14
  • NumPy 2.5.2 → 2.5.3, SciPy 1.18.0 → 1.18.1, and pandas 3.0.5 → 3.0.6
  • DFT-D3 1.5 → 1.6
  • CUDA 13.3 → 13.4, cuDNN 9.25 → 9.26, NCCL 2.30 → 2.31, and cuTensor 2.7 → 2.8
  • GCC runtimes 16.1 → 16.2 and LLVM 22 → 23

Jens (JensWehner) and others added 30 commits September 29, 2026 10:48
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note

Copilot was unable to run its full agentic suite in this review.

Copilot review overview

Review effort: Lite
Findings: 1 Medium severity

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"),

@awvwgk Sebastian Ehlert (awvwgk) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you, looks good to me.

@awvwgk
Sebastian Ehlert (awvwgk) merged commit bca5064 into main Oct 6, 2026
56 of 58 checks passed
@awvwgk
Sebastian Ehlert (awvwgk) deleted the update_pixi branch October 6, 2026 07:01
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.

3 participants