Skip to content

TYP: mypy complaint isocalendar does not match supertype #43807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
jbrockmendel opened this issue Sep 29, 2021 · 4 comments · Fixed by #43812
Closed
3 tasks done

TYP: mypy complaint isocalendar does not match supertype #43807

jbrockmendel opened this issue Sep 29, 2021 · 4 comments · Fixed by #43812
Labels
Typing type annotations, mypy/pyright type checking
Milestone

Comments

@jbrockmendel
Copy link
Member

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the master branch of pandas.

Reproducible Example

When I run mypy locally (this has happened for a while and I've been ignoring it) I get


pandas/_libs/tslibs/timestamps.pyi:160: error: Return type "Tuple[int, int, int]" of "isocalendar" incompatible with return type "_IsoCalendarDate" in supertype "datetime"  [override]
pandas/_libs/tslibs/timestamps.pyi:160: error: Return type "Tuple[int, int, int]" of "isocalendar" incompatible with return type "_IsoCalendarDate" in supertype "date"  [override]


### Issue Description

N/A

### Expected Behavior

N/A

### Installed Versions

py39, master
@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 29, 2021
@twoertwein
Copy link
Member

Python 3.9 changed it to a namedtuple https://docs.python.org/3/library/datetime.html#datetime.date.isocalendar

@jbrockmendel
Copy link
Member Author

OK. So i should continue to ignore it until the CI's mypy runs on py39?

@twoertwein
Copy link
Member

twoertwein commented Sep 30, 2021

I think the best would be to add python_version = "3.8" to pyproject.toml (I didn't test whether that helps - I have been ignoring this error as well)

edit:
setting python_version = "3.8" fixed it :)

@twoertwein twoertwein added Typing type annotations, mypy/pyright type checking and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 30, 2021
@jreback jreback added this to the 1.4 milestone Sep 30, 2021
@simonjayhawkins
Copy link
Member

OK. So i should continue to ignore it until the CI's mypy runs on py39?

If we want to to use mypy to help catch errors for our minimum supported versions, we should probably keep type checking pinned to Python 3.8 until we drop support for it. That does not stop us running mypy on a later version of Python.

Similarly we have the mypy config setup to check against Linux otherwise we get clipboard related errors reported on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants