Skip to content

Conversation

@slsh1o
Copy link
Member

@slsh1o slsh1o commented Aug 21, 2020

I'm not sure what else should I add to mypy.ini. Something related to tests or maybe to sphinx.

And also there are some errors which idk how to fix better.

Ref: #16

@slsh1o slsh1o added the enhancement New feature or request label Aug 21, 2020
@slsh1o slsh1o requested a review from webknjaz August 21, 2020 10:36
@slsh1o
Copy link
Member Author

slsh1o commented Aug 22, 2020

Slightly reorder mypy.ini but I'm still not sure how to cure raised errors.

@webknjaz
Copy link
Member

but I'm still not sure how to cure raised errors

First, try exploring what causes these errors. Then, we'll decide how to deal with each of them.

@webknjaz
Copy link
Member

src/sphinxcontrib/towncrier/_version.py:5: error: Cannot find implementation or library stub for module named 'towncrier._scm_version'
src/sphinxcontrib/towncrier/_version.py:5: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports

Try creating a stub file for _scm_version: https://mypy.readthedocs.io/en/stable/stubs.html.

@webknjaz
Copy link
Member

src/sphinxcontrib/towncrier/__init__.py:55: error: Incompatible types in assignment (expression has type "Tuple[str, str, str, str]", variable has type "Tuple[str, str]")

I guess mypy "sees" the initial declaration that is Tuple[str, str] and automatically decides that it's the final type. You should probably mark it as something like iterable explicitly.

@webknjaz
Copy link
Member

src/sphinxcontrib/towncrier/__init__.py:80: error: "Dict[str, Any]" has no attribute "release"
src/sphinxcontrib/towncrier/__init__.py:82: error: "Dict[str, Any]" has no attribute "version"

This is just an incorrect annotation. It's best to figure out what type it is really. Maybe stick a debugger there...

@slsh1o slsh1o force-pushed the mypy_pre-commit branch 2 times, most recently from 85df242 to f62f6a5 Compare August 23, 2020 19:43
@slsh1o slsh1o marked this pull request as ready for review August 23, 2020 19:46
@slsh1o slsh1o requested review from webknjaz and removed request for webknjaz August 23, 2020 19:46
@slsh1o slsh1o requested a review from webknjaz August 23, 2020 20:08
@slsh1o slsh1o requested a review from webknjaz August 23, 2020 20:51
@slsh1o slsh1o merged commit 11aa657 into sphinx-contrib:master Aug 23, 2020
@slsh1o slsh1o deleted the mypy_pre-commit branch August 23, 2020 21:30
@webknjaz webknjaz linked an issue Aug 24, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

⚙ Configure pre-commit tool

2 participants