Skip to content

Fix ty errors - #97

Merged
gerlero merged 7 commits into
mainfrom
typing
Aug 25, 2026
Merged

Fix ty errors#97
gerlero merged 7 commits into
mainfrom
typing

Conversation

@gerlero

@gerlero gerlero commented Aug 18, 2026

Copy link
Copy Markdown
Owner

No description provided.

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.

Pull request overview

This PR updates type annotations across Frontx (core solvers, inverse routines, and tests/examples) to resolve ty type-checker errors by removing Any usage, tightening array/Callable signatures, and adding a few targeted ty: ignore[...] suppressions.

Changes:

  • Replace broad np.ndarray[Any, Any] annotations with more specific NumPy/JAX array typings across the public API and tests.
  • Adjust several return/parameter types to jax.Array (or unions including it) to better reflect JAX-centric execution.
  • Add/adjust ty: ignore[...] comments where library stubs or overload resolution still conflict with intended usage.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/test_neural/test_exact.py Updates test helper typing for PINN diffusivity callable.
tests/test_finite.py Tightens Callable type for parametrized diffusivity models used by the finite solver tests.
src/frontx/neural.py Refines PINN and training API annotations; aligns several internal training values with JAX types.
src/frontx/models.py Updates model callable signatures and parameter field types to include jax.Array and narrower NumPy dtypes.
src/frontx/finite.py Refines solver/fit API typings and the Diffrax term typing; adjusts several outputs to jax.Array.
src/frontx/examples/neural/grenoblesand.py Adds a ty suppression for example-only attribute access.
src/frontx/examples/neural/exact.py Updates example diffusivity callable typing and removes unused Any.
src/frontx/_util.py Simplifies vmap typing by removing overloads and using a single precise signature.
src/frontx/_inverse/sorptivity.py Tightens input typing and allows scalar parameters to be jax.Array.
src/frontx/_inverse/param.py Updates Param bounds typing and broadens some typing around optimizer integration.
src/frontx/_inverse/interpolated.py Tightens array typing for interpolated solution construction and evaluation.
src/frontx/_inverse/fit.py Refines inverse-fit signatures (including max_steps) and several call/return types.
src/frontx/_forward.py Tightens callable signatures and adjusts several property return types to jax.Array.
src/frontx/_boltzmann.py Refines Boltzmann transform overloads and AbstractSolution typing around callable solution evaluation.
Suppressed comments (1)

src/frontx/finite.py:199

  • max_steps is forwarded to de_fit(...), which ultimately passes it to SciPy's differential_evolution(maxiter=...) and requires a Python int. Allowing jax.Array here can lead to runtime type errors.
    max_steps: int | jax.Array = 15,

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

Comment thread src/frontx/finite.py
Comment thread src/frontx/finite.py Outdated
Comment thread src/frontx/_inverse/fit.py Outdated
Comment thread src/frontx/_boltzmann.py Outdated
Comment thread src/frontx/_inverse/param.py Outdated
gerlero and others added 3 commits August 18, 2026 15:21
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: gerlero <15150530+gerlero@users.noreply.github.com>
@gerlero

gerlero commented Aug 19, 2026

Copy link
Copy Markdown
Owner Author

@copilot fix the remaining typing issues

Co-authored-by: gerlero <15150530+gerlero@users.noreply.github.com>

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

@copilot fix the remaining typing issues

Fixed in 2a39389.

@gerlero

gerlero commented Aug 25, 2026

Copy link
Copy Markdown
Owner Author

@copilot just format with Ruff

Co-authored-by: gerlero <15150530+gerlero@users.noreply.github.com>

Copilot AI commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

@copilot just format with Ruff

Fixed in 2cb2ec5.

@codecov-commenter

codecov-commenter commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.34146% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.05%. Comparing base (ab02377) to head (2cb2ec5).

Files with missing lines Patch % Lines
src/frontx/finite.py 50.00% 2 Missing ⚠️
src/frontx/_boltzmann.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #97      +/-   ##
==========================================
- Coverage   86.12%   86.05%   -0.08%     
==========================================
  Files          13       13              
  Lines         555      552       -3     
==========================================
- Hits          478      475       -3     
  Misses         77       77              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gerlero
gerlero merged commit fd68425 into main Aug 25, 2026
8 checks passed
@gerlero
gerlero deleted the typing branch August 25, 2026 18:14
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.

4 participants