Skip to content

Commit

Permalink
Merge pull request #1 from invrs-io/cleanup
Browse files Browse the repository at this point in the history
Do not run mypy through pre-commit
  • Loading branch information
mfschubert authored Oct 25, 2023
2 parents 469de2d + 53ef0d7 commit 1070a84
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
pip install pre-commit
pre-commit run -a
validate-docstrings:
validate-types-and-docstrings:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -46,9 +46,11 @@ jobs:
python -m pip install --upgrade pip
pip install ".[tests,dev]"
- name: Validate docstrings
run: |
darglint src --strictness=short --ignore-raise=ValueError
- name: mypy type validation
run: mypy src

- name: darglint docstring validation
run: darglint src --strictness=short --ignore-raise=ValueError

tests:
runs-on: ubuntu-latest
Expand Down
7 changes: 0 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ repos:
args: [--exit-zero]
exclude: ^tests/

# Type annotation
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.0.1
hooks:
- id: mypy
exclude: ^(notebooks|tests)

# Linter
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.287
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ tests = [
dev = [
"bump-my-version",
"darglint",
"mypy",
"pre-commit",
]

Expand Down
8 changes: 6 additions & 2 deletions src/invrs_opt/lbfgsb/lbfgsb.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import jax.numpy as jnp
import numpy as onp
from jax import tree_util
from scipy.optimize._lbfgsb_py import _lbfgsb as scipy_lbfgsb # type: ignore[import-untyped]
from scipy.optimize._lbfgsb_py import ( # type: ignore[import-untyped]
_lbfgsb as scipy_lbfgsb,
)

from invrs_opt.lbfgsb import transform
from invrs_opt import base
Expand Down Expand Up @@ -185,7 +187,9 @@ def update_fn(
params, lbfgsb_state_dict = state
# Avoid in-place updates.
lbfgsb_state_dict = copy.deepcopy(lbfgsb_state_dict)
scipy_lbfgsb_state = ScipyLbfgsbState(**lbfgsb_state_dict) # type: ignore[arg-type]
scipy_lbfgsb_state = ScipyLbfgsbState(
**lbfgsb_state_dict # type: ignore[arg-type]
)

latent_params = _to_pytree(scipy_lbfgsb_state.x, params)
_, vjp_fn = jax.vjp(transform_fn, latent_params)
Expand Down

0 comments on commit 1070a84

Please sign in to comment.