diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c46a1f25f..6fe39830cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,6 @@ jobs: default_python: "3.12" envs: | - linux: check-dependencies - - linux: check-types latest_crds_contexts: uses: ./.github/workflows/contexts.yml crds_context: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2b039994e5..808abb072d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,6 +22,10 @@ repos: - id: ruff args: ["--fix"] - id: ruff-format + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.6.1 # Use the latest stable version + hooks: + - id: mypy - repo: https://github.com/numpy/numpydoc rev: v1.8.0 hooks: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c21b35ef6a..c259c29889 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -427,14 +427,10 @@ The following three style checks are performed: required for contributions. If type hints are used, though, their compliance with [PEP-484](https://peps.python.org/pep-0484/) standards is enforced using [mypy](https://mypy.readthedocs.io/en/stable/index.html). - To run these checks locally, first `pip install mypy` then use the command + To run these checks locally, use the command - >> mypy . + >> pre-commit run mypy - from within the `jwst` repository. This check is not run through pre-commit; - it's instead handled separately from a different CI workflow. This means that if you are - using type hints, you may encounter a situation where `pre-commit` passes locally but - the CI checks fail on a pull request. --- **Note:** At time of writing, many submodules in the repository do not yet conform to the style rules; diff --git a/jwst/badpix_selfcal/badpix_selfcal.py b/jwst/badpix_selfcal/badpix_selfcal.py index c2fd84bbfd..5f38f393b7 100644 --- a/jwst/badpix_selfcal/badpix_selfcal.py +++ b/jwst/badpix_selfcal/badpix_selfcal.py @@ -12,7 +12,7 @@ def badpix_selfcal(minimg: np.ndarray, flagfrac_lower: float = 0.001, flagfrac_upper: float = 0.001, kernel_size: int = 15, - dispaxis=None) -> tuple: + dispaxis=None) -> np.ndarray: """ Flag residual artifacts as bad pixels in the DQ array of a JWST exposure diff --git a/pyproject.toml b/pyproject.toml index 504908e12b..eab9a05d5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -274,6 +274,7 @@ warn_return_any = true warn_unused_configs = true disable_error_code = "import-untyped" # do not check imports exclude = ["build"] +python_version = "3.10" [[tool.mypy.overrides]] # don't complain about the installed c parts of this library diff --git a/tox.ini b/tox.ini index 77df7bbe27..8813c9998a 100644 --- a/tox.ini +++ b/tox.ini @@ -13,14 +13,6 @@ envlist = # tox -l -v # -[testenv:check-types] -description = check type hints, e.g. with mypy -deps = - mypy - types-requests -commands = - mypy jwst --config-file pyproject.toml - [testenv:check-dependencies] description = verify that install_requires in setup.cfg has correct dependencies # `extras` needs to be empty to check modules without additional dependencies