diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8174c5515af1f..cc1c735719a46 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -150,6 +150,14 @@ repos: types: [pyi] args: [scripts/run_stubtest.py] stages: [manual] + - id: ty + # note: assumes python env is setup and activated + name: ty + entry: ty check + language: system + pass_filenames: false + types: [python] + stages: [manual] - id: inconsistent-namespace-usage name: 'Check for inconsistent use of pandas namespace' entry: python scripts/check_for_inconsistent_pandas_namespace.py diff --git a/environment.yml b/environment.yml index 2a566773b884a..a547d31304cf5 100644 --- a/environment.yml +++ b/environment.yml @@ -77,6 +77,7 @@ dependencies: # code checks - flake8=7.1.0 # run in subprocess over docstring examples - mypy=1.13.0 # pre-commit uses locally installed mypy + - ty=0.0.1a14 # pre-commit uses locally installed ty - tokenize-rt # scripts/check_for_inconsistent_pandas_namespace.py - pre-commit>=4.2.0 diff --git a/pyproject.toml b/pyproject.toml index e013222f8fe79..7c7fac6b8017a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -663,6 +663,30 @@ module = [ ] ignore_errors = true +[tool.ty.src] +include = ["pandas"] + +### TODO: Enable gradually +[tool.ty.rules] +unresolved-attribute = "ignore" +invalid-return-type = "ignore" +unsupported-operator = "ignore" +invalid-assignment = "ignore" +invalid-argument-type = "ignore" +unresolved-import = "ignore" +no-matching-overload = "ignore" +possibly-unbound-attribute = "ignore" +call-non-callable = "ignore" +missing-argument = "ignore" +non-subscriptable = "ignore" +unknown-argument = "ignore" +not-iterable = "ignore" +unresolved-reference = "ignore" +invalid-context-manager = "ignore" +too-many-positional-arguments = "ignore" +invalid-type-form = "ignore" +parameter-already-assigned = "ignore" + # To be kept consistent with "Import Formatting" section in contributing.rst [tool.isort] known_pre_libs = "pandas._config" diff --git a/requirements-dev.txt b/requirements-dev.txt index 3e2e637927389..ed796585e684c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -54,6 +54,7 @@ moto asv>=0.6.1 flake8==7.1.0 mypy==1.13.0 +ty==0.0.1a14 tokenize-rt pre-commit>=4.2.0 gitpython