Move type annotations inline and complete them #419
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Now that the project is Python 3.6+, it can safely use inline type
annotations. Doing so helps ensure that the types remain accurate and
useful both internally and both projects that consume freezegun. For
example, the pip project currently ignores missing freezegun types:
https://github.com/pypa/pip/blob/135faabfd62f8c3566fd4f99a5688316302cf1c8/tests/unit/test_self_check_outdated.py#L7
The CI system runs mypy on all support Python platforms as the stdlib
API can change between releases. The code has been altered to use
PEP-484 compliant version and platform checking as outlined at:
https://www.python.org/dev/peps/pep-0484/#version-and-platform-checking
The type checker already found a couple of mistakes with internal API
usage. This should help catch bugs in new pull requests earlier during
CI.
The py.typed file is now installed alongside the package to be compliant
with PEP-561:
https://www.python.org/dev/peps/pep-0561/#packaging-type-information
Using the spec "type: ignore" comment and cast calls were only done as a
last resort when the type checker couldn't be satisfied using more
conventional approaches.
By switching to using the setuptools explicit package_data approach, the
MANIFEST.in file was simplified.