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

Use typeguard to check types at runtime #160

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Andy-Grigg
Copy link
Collaborator

Closes #155
Closes #159

Use typeguard to perform run-time type-checking of public class constructors. As reported in the associated tickets, if the correct types are not used then the error messages aren't very clear. typeguard helps here.

Downsides of this approach:

  • It doesn't feel very Pythonic. We're using type hints, and any decent IDE or mypy will alert you to your mistake before you run anything.
  • Potential performance impacts, but they're not likely to be significant compared to the actual async import type. Also, typeguard will disable these checks if you run Python in 'production mode'.
  • It's inconsistent. We're not going to add it anywhere, so why just here?

@Andy-Grigg Andy-Grigg requested a review from da1910 November 15, 2024 20:57
@github-actions github-actions bot added enhancement New features or code improvements maintenance Package and maintenance related dependencies Related with project dependencies labels Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Related with project dependencies enhancement New features or code improvements maintenance Package and maintenance related
Projects
None yet
2 participants