Skip to content

Commit

Permalink
Unpin Mypy (#1301)
Browse files Browse the repository at this point in the history
* Unpin Mypy

fixes #1279

Looks like 1.10.1 fixed itself?

* Fix type errors

* Update pins

* Don't run Mypy on 3.8 too

* wtf

* Fix order
  • Loading branch information
hynek authored Jul 13, 2024
1 parent 6e25a0c commit 0b07265
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,24 @@ jobs:
- name: Prepare tox
run: |
V=${{ matrix.python-version }}
DO_MYPY=1
if [[ "$V" = pypy-* ]]; then
DO_MYPY=0
V=pypy3
IS_PYPY=1
else
if [[ "$V" == "3.7" || "$V" == "3.8" ]]; then
DO_MYPY=0
echo "skipping $V"
else
echo "not skipping $V"
fi
V=py$(echo $V | tr -d .)
IS_PYPY=0
fi
echo IS_PYPY=$IS_PYPY >>$GITHUB_ENV
echo DO_MYPY=$DO_MYPY >>$GITHUB_ENV
echo TOX_PYTHON=$V >>$GITHUB_ENV
python -Im pip install tox
Expand All @@ -68,7 +76,7 @@ jobs:

- run: python -Im tox run -e ${{ env.TOX_PYTHON }}-tests
- run: python -Im tox run -e ${{ env.TOX_PYTHON }}-mypy
if: env.IS_PYPY == '0' && matrix.python-version != '3.7'
if: env.DO_MYPY == '1'

- name: Upload coverage data
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ dynamic = ["version", "readme"]

[project.optional-dependencies]
tests-mypy = [
'pytest-mypy-plugins; platform_python_implementation == "CPython" and python_version >= "3.8" and python_version < "3.13"',
'pytest-mypy-plugins; platform_python_implementation == "CPython" and python_version >= "3.9" and python_version < "3.13"',
# Since the mypy error messages keep changing, we have to keep updating this
# pin.
'mypy>=1.6,<1.10; platform_python_implementation == "CPython" and python_version >= "3.8"',
'mypy>=1.10.1; platform_python_implementation == "CPython" and python_version >= "3.9"',
]
tests = [
# For regression test to ensure cloudpickle compat doesn't break.
Expand Down
8 changes: 4 additions & 4 deletions tests/test_mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@
x: Optional[T]
@classmethod
def clsmeth(cls) -> None:
reveal_type(cls) # N: Revealed type is "Type[main.A[T`1]]"
reveal_type(cls) # N: Revealed type is "type[main.A[T`1]]"
- case: testAttrsForwardReference
main: |
Expand Down Expand Up @@ -645,7 +645,7 @@
b: str = attr.ib()
@classmethod
def new(cls) -> A:
reveal_type(cls) # N: Revealed type is "Type[main.A]"
reveal_type(cls) # N: Revealed type is "type[main.A]"
return cls(6, 'hello')
@classmethod
def bad(cls) -> A:
Expand Down Expand Up @@ -680,7 +680,7 @@
@classmethod
def foo(cls, x: Union[int, str]) -> Union[int, str]:
reveal_type(cls) # N: Revealed type is "Type[main.A]"
reveal_type(cls) # N: Revealed type is "type[main.A]"
reveal_type(cls.other()) # N: Revealed type is "builtins.str"
return x
Expand Down Expand Up @@ -1411,4 +1411,4 @@
reveal_type(A) # N: Revealed type is "def () -> main.A"
if has(A):
reveal_type(A) # N: Revealed type is "Type[attr.AttrsInstance]"
reveal_type(A) # N: Revealed type is "type[attr.AttrsInstance]"

0 comments on commit 0b07265

Please sign in to comment.