diff --git a/.github/setup/action.yaml b/.github/setup/action.yaml index 703efdba6..2162cee70 100644 --- a/.github/setup/action.yaml +++ b/.github/setup/action.yaml @@ -1,17 +1,17 @@ name: Install project dependencies +description: Install project dependencies inputs: python-version: + description: The python version to use required: true os: - required: true - numpy-version: + description: The OS to run on required: true runs: using: composite steps: - - name: Set up Python uses: actions/setup-python@v4 with: @@ -35,7 +35,3 @@ runs: - name: Install project dependencies shell: bash run: poetry install -vvv --no-root - - - name: Set numpy version - shell: bash - run: pip install numpy"${{ inputs. numpy-version }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e09b6df22..b04329fc4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,13 +19,9 @@ jobs: matrix: # Don't use macos-latest because it is arm64 os: [ubuntu-latest, windows-latest, macos-13] - python-version: ["3.9", "3.10", "3.11", "3.12"] - include: - - numpy-version: "<2.0" - - numpy-version: ">= 2.0" - os: ubuntu-latest + python-version: ["3.10", "3.11", "3.12"] - name: OS ${{ matrix.os }} - Python ${{ matrix.python-version }} - Numpy ${{ matrix.numpy-version }} + name: OS ${{ matrix.os }} - Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v3 @@ -35,7 +31,6 @@ jobs: with: os: ${{ matrix.os }} python-version: ${{ matrix.python-version }} - numpy-version: ${{ matrix.numpy-version }} - name: Run mypy on 'tests' (using the local stubs) and on the local stubs run: poetry run poe mypy diff --git a/docs/release_procedure.md b/docs/release_procedure.md index 3ba543955..60aa0fd37 100644 --- a/docs/release_procedure.md +++ b/docs/release_procedure.md @@ -7,7 +7,8 @@ ```shell rm dist/* -poetry publish --build # you will get prompted for your pypi username/password +poetry build +twine upload dist/* # Requires having the pypi API token allowing uploads git commit -a -m "Version a.b.c.yymmdd" git push upstream main git tag va.b.c.yymmdd @@ -15,5 +16,3 @@ git push upstream --tags ``` The conda bots will recognize that a new version has been uploaded to pypi, and generate a pull request sent to the maintainers to approve it. - -Note - Changes will need to be made to use pypi API tokens in the near future. diff --git a/docs/setup.md b/docs/setup.md index 747886368..402a18ecb 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -1,7 +1,7 @@ ## Set Up Environment -- Make sure you have `python >= 3.9` installed. -- Install poetry: `pip install 'poetry>=1.2'` +- Make sure you have `python >= 3.10` installed. +- Install poetry: `pip install 'poetry>=1.8'` - Install the project dependencies: `poetry update` - Enter the virtual environment: `poetry shell` - Run all tests: `poe test_all` diff --git a/pandas-stubs/core/dtypes/base.pyi b/pandas-stubs/core/dtypes/base.pyi index 4ce9ac70d..41c866f92 100644 --- a/pandas-stubs/core/dtypes/base.pyi +++ b/pandas-stubs/core/dtypes/base.pyi @@ -16,7 +16,7 @@ class ExtensionDtype: @property def kind( self, - ) -> Literal["b", "i", "u", "f", "c", "m", "M", "O", "S", "U", "V"]: ... + ) -> Literal["b", "i", "u", "f", "c", "m", "M", "O", "S", "U", "V", "T"]: ... @property def names(self) -> list[str] | None: ... def empty(self, size: int | tuple[int, ...]) -> type_t[ExtensionArray]: ... diff --git a/pyproject.toml b/pyproject.toml index 54da448ee..ef52aed8c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,9 +28,9 @@ packages = [{ "include" = "pandas-stubs" }] "Documentation" = "https://pandas.pydata.org/pandas-docs/stable" [tool.poetry.dependencies] -python = ">=3.9" +python = ">=3.10" types-pytz = ">= 2022.1.1" -numpy = ">= 1.23.5, <= 2.0.1" +numpy = ">= 1.23.5" [tool.poetry.group.dev.dependencies] mypy = "1.10.1" diff --git a/tests/test_scalars.py b/tests/test_scalars.py index 30315a22d..0f8bcb1c2 100644 --- a/tests/test_scalars.py +++ b/tests/test_scalars.py @@ -879,8 +879,8 @@ def test_timedelta_cmp() -> None: le = check(assert_type(c_dt_timedelta <= td, bool), bool) assert gt != le - gt_b = check(assert_type(c_timedelta64 > td, Any), bool) - le_b = check(assert_type(c_timedelta64 <= td, Any), bool) + gt_b = check(assert_type(c_timedelta64 > td, np.bool), bool) + le_b = check(assert_type(c_timedelta64 <= td, np.bool), bool) assert gt_b != le_b gt_a = check( @@ -947,8 +947,8 @@ def test_timedelta_cmp() -> None: ge = check(assert_type(c_dt_timedelta >= td, bool), bool) assert lt != ge - lt_b = check(assert_type(c_timedelta64 < td, Any), bool) - ge_b = check(assert_type(c_timedelta64 >= td, Any), bool) + lt_b = check(assert_type(c_timedelta64 < td, np.bool), bool) + ge_b = check(assert_type(c_timedelta64 >= td, np.bool), bool) assert lt_b != ge_b lt_a = check( @@ -1271,8 +1271,8 @@ def test_timestamp_cmp() -> None: check(assert_type(ts > c_series_dt64, "pd.Series[bool]"), pd.Series, np.bool_) check(assert_type(ts <= c_series_dt64, "pd.Series[bool]"), pd.Series, np.bool_) - check(assert_type(c_np_dt64 > ts, Any), bool) - check(assert_type(c_np_dt64 <= ts, Any), bool) + check(assert_type(c_np_dt64 > ts, np.bool), bool) + check(assert_type(c_np_dt64 <= ts, np.bool), bool) gt = check(assert_type(c_dt_datetime > ts, bool), bool) lte = check(assert_type(c_dt_datetime <= ts, bool), bool) @@ -1315,8 +1315,8 @@ def test_timestamp_cmp() -> None: lt = check(assert_type(c_dt_datetime < ts, bool), bool) assert gte != lt - check(assert_type(c_np_dt64 >= ts, Any), bool) - check(assert_type(c_np_dt64 < ts, Any), bool) + check(assert_type(c_np_dt64 >= ts, np.bool), bool) + check(assert_type(c_np_dt64 < ts, np.bool), bool) check(assert_type(c_datetimeindex >= ts, np_ndarray_bool), np.ndarray, np.bool_) check(assert_type(c_datetimeindex < ts, np_ndarray_bool), np.ndarray, np.bool_) diff --git a/tests/test_series.py b/tests/test_series.py index 21f368475..e68028cc4 100644 --- a/tests/test_series.py +++ b/tests/test_series.py @@ -15,6 +15,7 @@ TYPE_CHECKING, Any, Generic, + Literal, TypeVar, Union, cast, @@ -81,6 +82,23 @@ ) from pandas._typing import np_ndarray_int # noqa: F401 +# Tests will use numpy 2.1 in python 3.10 or later +# From Numpy 2.1 __init__.pyi +_DTypeKind: TypeAlias = Literal[ + "b", # boolean + "i", # signed integer + "u", # unsigned integer + "f", # floating-point + "c", # complex floating-point + "m", # timedelta64 + "M", # datetime64 + "O", # python object + "S", # byte-string (fixed-width) + "U", # unicode-string (fixed-width) + "V", # void + "T", # unicode-string (variable-width) +] + def test_types_init() -> None: pd.Series(1) @@ -1675,15 +1693,15 @@ def test_dtype_type() -> None: # GH 216 s1 = pd.Series(["foo"], dtype="string") check(assert_type(s1.dtype, DtypeObj), ExtensionDtype) - check(assert_type(s1.dtype.kind, str), str) + check(assert_type(s1.dtype.kind, _DTypeKind), str) s2 = pd.Series([1], dtype="Int64") check(assert_type(s2.dtype, DtypeObj), ExtensionDtype) - check(assert_type(s2.dtype.kind, str), str) + check(assert_type(s2.dtype.kind, _DTypeKind), str) s3 = pd.Series([1, 2, 3]) check(assert_type(s3.dtype, DtypeObj), np.dtype) - check(assert_type(s3.dtype.kind, str), str) + check(assert_type(s3.dtype.kind, _DTypeKind), str) def test_types_to_numpy() -> None: