feat: add comprehensive type annotations#856
feat: add comprehensive type annotations#856huynguyengl99 wants to merge 21 commits intojazzband:masterfrom
Conversation
ff479d3 to
86f03cf
Compare
|
Hi @bckohan and @JohananOppongAmoateng, this PR is based on the type annotations I added in the |
|
Hi @bckohan, could you re-approve the workflow run? I’ve updated the tests, so I expect it should pass now. There are still quite a few typing errors, but I think we can address them in future commits in this PR—either when I have more time, or with the help of @JohananOppongAmoateng. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #856 +/- ##
==========================================
+ Coverage 90.98% 91.16% +0.18%
==========================================
Files 28 28
Lines 1730 1879 +149
Branches 267 274 +7
==========================================
+ Hits 1574 1713 +139
- Misses 104 110 +6
- Partials 52 56 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @bckohan , could you re-approve the workflow run? |
|
Hi @bckohan, cc @JohananOppongAmoateng I’ve finished addressing all remaining typing issues in the recent commits on this branch. Here’s a brief summary of the current state and some context around the decisions made: Summary
Rationale
Supporting both typed and non-typed users I’ve tried to ensure compatibility for both typed and non-typed users. For example: _ModelT = TypeVar(
"_ModelT",
bound=PolymorphicModel,
default=PolymorphicModel,
)
if TYPE_CHECKING:
_ModelAdminBase = admin.ModelAdmin[_ModelT]
else:
_ModelAdminBase = admin.ModelAdmin
class PolymorphicChildModelAdmin(_ModelAdminBase, Generic[_ModelT]):
...
On cast(...) vs type: ignore
return cast(type[BaseGenericPolymorphicInlineFormSet], FormSet)
Looking forward to your feedback. Thanks a lot for taking the time to review this — I hope we can get this PR merged soon. |
3e89b53 to
9e80624
Compare
…type hint test to examples
* Updated documentation * A tested and robust type hint usage example * Justfile recipes have been adapted to run with minimal dependencies * Tests are now run isolated from all unnecessary dependencies (including type checkers)
Close #647