From e7df8dfc9c9b70974ad5b509ad9d7ff4a3ead95c Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Sat, 16 Nov 2024 16:24:17 +0500 Subject: [PATCH 1/3] chore: remove numpy from deps, add mypy, add pandas 2.2 to free-thread test, use local mypy in pre-commit, add stubtest --- .github/workflows/CI.yml | 9 ++------- .pre-commit-config.yaml | 15 ++++++++++----- pyproject.toml | 5 +++-- python/python_calamine/pandas.py | 8 ++++++-- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0271642..25c2e7c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -36,9 +36,8 @@ jobs: pandas-version: "none" - python-version: "3.13" pandas-version: "2.2.*" - # https://github.com/pandas-dev/pandas/issues/60016 - python-version: "3.13" - pandas-version: "none" + pandas-version: "2.2.*" disable-gil: true runs-on: ubuntu-latest @@ -128,11 +127,7 @@ jobs: py ${{ env.pythonLocation }} - - run: pip install pre-commit - if: steps.cache-py.outputs.cache-hit != 'true' - - - run: pip install . - if: steps.cache-py.outputs.cache-hit != 'true' + - run: pip install .[dev] - run: pip freeze diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6496ca5..a235b51 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,13 +34,18 @@ repos: rev: 24.1.1 hooks: - id: black - - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.8.0 + - repo: local hooks: - id: mypy - additional_dependencies: - - pandas-stubs - exclude: ^tests/.*$ + name: mypy + entry: mypy + language: python + pass_filenames: false + - id: mypy-stubtest + name: stubtest python_calamine + entry: mypy + language: python + pass_filenames: false - repo: local hooks: - id: rust-linting diff --git a/pyproject.toml b/pyproject.toml index 58a05d8..a185d60 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,9 +19,9 @@ dynamic = ["version"] dev = [ "maturin~=1.0", "pre-commit~=3.0", + "mypy~=1.13", "pytest~=8.0", - "pandas[excel]~=2.0", - "numpy~=1.0", + "pandas[excel]~=2.2", ] [tool.isort] @@ -31,6 +31,7 @@ multi_line_output = 3 profile = "black" [tool.mypy] +files = ["python"] python_version = "3.8" ignore_missing_imports = false disallow_untyped_defs = true diff --git a/python/python_calamine/pandas.py b/python/python_calamine/pandas.py index a547ae3..c6c9611 100644 --- a/python/python_calamine/pandas.py +++ b/python/python_calamine/pandas.py @@ -7,8 +7,12 @@ import pandas as pd from packaging.version import Version, parse from pandas._typing import Scalar -from pandas.compat._optional import import_optional_dependency -from pandas.core.shared_docs import _shared_docs +from pandas.compat._optional import ( # type:ignore[import-untyped] # missing in pandas-stubs + import_optional_dependency, +) +from pandas.core.shared_docs import ( # type:ignore[import-untyped] # missing in pandas-stubs + _shared_docs, +) from pandas.io.excel import ExcelFile from pandas.io.excel._base import ( # type:ignore[attr-defined] # missing in pandas-stubs BaseExcelReader, From b16d6900ccaa439efb58995debc9a295eec20ad4 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Sat, 16 Nov 2024 16:34:06 +0500 Subject: [PATCH 2/3] add pandas-stubs~=2.2 --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index a185d60..b0436ce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ dev = [ "mypy~=1.13", "pytest~=8.0", "pandas[excel]~=2.2", + "pandas-stubs~=2.2", ] [tool.isort] From 7407ca789af00de1efb927e34d1a84fc61805af8 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Sat, 16 Nov 2024 16:35:24 +0500 Subject: [PATCH 3/3] fix ci --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 25c2e7c..6d88d2f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -128,6 +128,7 @@ jobs: ${{ env.pythonLocation }} - run: pip install .[dev] + if: steps.cache-py.outputs.cache-hit != 'true' - run: pip freeze