-
Notifications
You must be signed in to change notification settings - Fork 439
Open
Description
Issue
This package currently has no PEP-561 py.typed marker, which means that static type checkers like Mypy or Pyright are unable to typecheck usages of it.
What would need to change
A py.typed marker signals to type checkers that a package's public type hints are assumed to be correct and (mostly?) complete, so it should only be added once that's the case.
So some changes may be needed to this project before it makes sense to add one. Maybe we can track these in this issue?
- Fix type errors that occur in typical usages of this project. I found out about these by manually adding a
py.typedfile to this library's directory and then using it inside a "typical" Django project, running Mypy instrictmode.- Anywhere
Columnor its subclasses are used, Mypy complains:Call to untyped function "Column" in typed context. To fix this:- Add type hints to
Column.__init__and the__init__methods of its subclasses.- As some of these parameters are
StrOrPromisetypes, this probably needs a dependency ondjango-stubs-ext😬
- As some of these parameters are
- Make
Library.registertyped so the@library.registerdecorator on all these classes doesn't lose cause loss of type information.
- Add type hints to
- ... probably more that I don't know about (if anyone finds any, leave a comment and I'll put it here)
- Anywhere
- There should maybe be a "type coverage report" in CI to make sure that changes at least don't decrease type completeness.
Metadata
Metadata
Assignees
Labels
No labels