Skip to content
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

PEP 561 compatibility (py.typed) and explicit re-exports #125

Merged
merged 3 commits into from
Aug 7, 2024

Conversation

binaryDiv
Copy link
Contributor

@binaryDiv binaryDiv commented Aug 7, 2024

This PR is another small step towards full mypy support (#116).

It adds the py.typed file to make the package PEP 561 compatible (if this file is present, type checkers know that the library is properly typed and can rely on its type annotations).

It also introduces explicit re-exports in __init__.py files using the __all__ variable. This is necessary to enable the no-implicit-reexport mypy rule, not just for running mypy on the library itself, but also for projects that use validataclass. It's also just cleaner to explicitly re-export everything.

I also had to add a rule exception to one of the unit test files because mypy reported errors for it. I'm not sure why these errors only popped up now, though.

This is necessary to avoid errors from the no-implicit-reexport rule both in the library and in projects using the library. It's also cleaner to have explicit exports.
@binaryDiv binaryDiv added enhancement Improvements to existing features or smaller new features testing Related to testing (e.g. unit tests) labels Aug 7, 2024
@binaryDiv binaryDiv self-assigned this Aug 7, 2024
@binaryDiv binaryDiv mentioned this pull request Aug 7, 2024
12 tasks
Copy link

@l1f l1f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for me. I like the new import formatting

@binaryDiv binaryDiv merged commit 2b601de into main Aug 7, 2024
7 checks passed
@binaryDiv binaryDiv deleted the pep561-typed-package branch August 7, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to existing features or smaller new features testing Related to testing (e.g. unit tests)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants