diff --git a/pandas-stubs/_typing.pyi b/pandas-stubs/_typing.pyi index c532b5927..6edd32144 100644 --- a/pandas-stubs/_typing.pyi +++ b/pandas-stubs/_typing.pyi @@ -27,7 +27,7 @@ from typing import ( ) import numpy as np -from numpy import typing as npt +import numpy.typing from pandas.core.arrays import ExtensionArray from pandas.core.frame import DataFrame from pandas.core.generic import NDFrame @@ -42,6 +42,8 @@ from pandas._libs.tslibs import ( from pandas.core.dtypes.dtypes import ExtensionDtype +npt = numpy.typing + ArrayLike = Union[ExtensionArray, np.ndarray] AnyArrayLike = Union[Index, Series, np.ndarray] PythonScalar = Union[str, int, float, bool, complex] diff --git a/pyproject.toml b/pyproject.toml index 70f94071d..0a19b20e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ python = ">=3.8,<3.11" types-pytz = ">= 2022.1.1" [tool.poetry.dev-dependencies] -mypy = ">=0.961" +mypy = ">=0.971" pytest = ">=7.1.2" pyright = ">=1.1.255" poethepoet = ">=0.13.1" @@ -53,36 +53,15 @@ build-backend = "poetry.core.masonry.api" [tool.poe.tasks.test_all] help = "Run all tests" -script = "scripts.test:test(clean_cache, src=True, dist=True)" - - [[tool.poe.tasks.test_all.args]] - help = "remove cache folders (mypy and pytest)" - name = "clean-cache" - options = ["-c", "--clean_cache"] - default = false - type = "boolean" +script = "scripts.test:test(src=True, dist=True)" [tool.poe.tasks.test_src] help = "Run local tests (includes 'mypy_src', 'pyright_src', 'pytest', and 'style')" -script = "scripts.test:test(clean_cache, src=True)" - - [[tool.poe.tasks.test_src.args]] - help = "remove cache folders (mypy and pytest)" - name = "clean-cache" - options = ["-c", "--clean_cache"] - default = false - type = "boolean" +script = "scripts.test:test(src=True)" [tool.poe.tasks.test_dist] help = "Run tests on the installed stubs (includes 'mypy_dist' and 'pyright_dist')" -script = "scripts.test:test(clean_cache, dist=True)" - - [[tool.poe.tasks.test_dist.args]] - help = "remove cache folders (mypy and pytest)" - name = "clean-cache" - options = ["-c", "--clean_cache"] - default = false - type = "boolean" +script = "scripts.test:test(dist=True)" [tool.poe.tasks.pytest] help = "Run pytest" @@ -98,7 +77,7 @@ script = "scripts.test.run:mypy_src" [tool.poe.tasks.mypy_dist] help = "Run mypy on 'tests' using the installed stubs" -script = "scripts.test:test(clean_cache=False, dist=True, type_checker='mypy')" +script = "scripts.test:test(dist=True, type_checker='mypy')" [tool.poe.tasks.pyright_src] help = "Run pyright on 'tests' (using the local stubs) and on the local stubs" @@ -106,7 +85,7 @@ script = "scripts.test.run:pyright_src" [tool.poe.tasks.pyright_dist] help = "Run pyright on 'tests' using the installed stubs" -script = "scripts.test:test(clean_cache=False, dist=True, type_checker='pyright')" +script = "scripts.test:test(dist=True, type_checker='pyright')" diff --git a/scripts/test/__init__.py b/scripts/test/__init__.py index 84fc9fc0d..e6a0e1fe5 100644 --- a/scripts/test/__init__.py +++ b/scripts/test/__init__.py @@ -3,7 +3,6 @@ from scripts._job import run_job from scripts.test import _step -_CACHE_STEPS = [_step.clean_mypy_cache, _step.clean_pytest_cache] _SRC_STEPS = [_step.mypy_src, _step.pyright_src, _step.pytest, _step.style] _DIST_STEPS = [ _step.build_dist, @@ -17,15 +16,11 @@ def test( - clean_cache: bool = False, src: bool = False, dist: bool = False, type_checker: Literal["", "mypy", "pyright"] = "", ): steps = [] - if clean_cache: - steps.extend(_CACHE_STEPS) - if src: steps.extend(_SRC_STEPS) diff --git a/scripts/test/_step.py b/scripts/test/_step.py index 72f7d903c..73bf49430 100644 --- a/scripts/test/_step.py +++ b/scripts/test/_step.py @@ -1,8 +1,6 @@ from scripts._job import Step from scripts.test import run -clean_mypy_cache = Step(name="Clean mypy cache", run=run.clean_mypy_cache) -clean_pytest_cache = Step(name="Clean pytest cache", run=run.clean_pytest_cache) mypy_src = Step( name="Run mypy on 'tests' (using the local stubs) and on the local stubs", run=run.mypy_src, diff --git a/scripts/test/run.py b/scripts/test/run.py index 704994a0b..a4242f8df 100644 --- a/scripts/test/run.py +++ b/scripts/test/run.py @@ -1,5 +1,4 @@ from pathlib import Path -import shutil import subprocess @@ -14,7 +13,7 @@ def pyright_src(): def pytest(): - cmd = ["pytest"] + cmd = ["pytest", "--cache-clear"] subprocess.run(cmd, check=True) @@ -61,13 +60,3 @@ def restore_src(): Path(r"_pandas-stubs").rename("pandas-stubs") else: raise FileNotFoundError("'_pandas-stubs' folder does not exists.") - - -def clean_mypy_cache(): - if Path(".mypy_cache").exists(): - shutil.rmtree(".mypy_cache") - - -def clean_pytest_cache(): - if Path(".mypy_cache").exists(): - shutil.rmtree(".pytest_cache")