diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6e17fdce9..2c3be4e01 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,6 +20,14 @@ repos: entry: mypy --install-types --non-interactive files: ^numpyro/ + - id: ty + name: ty check + language: python + entry: ty + args: [check, --config-file, ty.toml] + pass_filenames: false + always_run: true + additional_dependencies: [ty] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 @@ -30,9 +38,9 @@ repos: exclude: notebooks/ - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.1 hooks: - id: codespell stages: [pre-commit, commit-msg] - args: - [--ignore-words-list, "Teh,aas,ans,dout", --check-filenames, --skip, "*.ipynb"] + args: [--ignore-words-list, "Teh,aas,ans,dout", --check-filenames, --skip, "*.ipynb"] + diff --git a/Makefile b/Makefile index f9cce9207..4dae4e6b3 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ lint: FORCE ruff format . --check python scripts/update_headers.py --check mypy --install-types --non-interactive numpyro + ty check -vvv --config-file ty.toml --exit-zero license: FORCE python scripts/update_headers.py diff --git a/setup.py b/setup.py index 02d951b1a..33b3eea55 100644 --- a/setup.py +++ b/setup.py @@ -57,6 +57,7 @@ "pyro-api>=0.1.1", "scikit-learn", "scipy>=1.9", + "ty>=0.0.4", ], "dev": [ "dm-haiku>=0.0.14; python_version >= '3.10'", diff --git a/ty.toml b/ty.toml new file mode 100644 index 000000000..fbd8e2264 --- /dev/null +++ b/ty.toml @@ -0,0 +1,22 @@ +[environment] +python-version = "3.12" + +[rules] +unresolved-import = "ignore" + +[src] +include = ["numpyro"] +exclude = [ + "numpyro.contrib.control_flow.*", + "numpyro.contrib.funsor.*", + "numpyro.contrib.hsgp.*", + "numpyro.contrib.stochastic_support.*", + "numpyro.diagnostics.*", + "numpyro.handlers.*", + "numpyro.infer.elbo.*", + "numpyro.optim.*", + "numpyro.primitives.*", + "numpyro.patch.*", + "numpyro.util.*", +] +respect-ignore-files = true \ No newline at end of file