-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementImprovements to existing features or smaller new featuresImprovements to existing features or smaller new featuresrefactoringCode refactoring, clean up and other code maintenance work.Code refactoring, clean up and other code maintenance work.testingRelated to testing (e.g. unit tests)Related to testing (e.g. unit tests)
Milestone
Description
This issue consists of two major parts: First, integrate mypy as a static type checker in the dev and build process of the library (and fix issues that mypy finds). Second, try to find out how to make validataclass compatible with mypy (i.e. in projects that use validataclass and mypy).
Use mypy to check the library code
- Add mypy to the dev environment (tox, Makefile) as an optional step for now.
- Only add
/srcto the target files for now, but add a comment to add/testslater too. - (The tests will probably require the full validataclass-mypy compatibility.)
- Only add
- Fix all low-hanging fruit issues detected by mypy (some issues might need a bit more work)
- Try to fix the more complicated issues (if necessary, mark them as
# type: ignorefor now, maybe create issues for them) - When all issues are resolved or ignored, make mypy a required (i.e. default) step in the Tox config.
- Integrate mypy into the test and build CI pipelines
- Fix typing issues in the unit tests that are not related to how typing in validataclasses works (don't permanently add
/teststo the mypy config yet)
Make validataclass fully mypy-compatible
- Make package PEP 561 compatible: PEP 561 compatibility (py.typed) and explicit re-exports #125
- Run mypy on validataclass example code (e.g. the unit tests) and examine the issues.
- Assigning validators to fields in validataclasses:
foo: int = IntegerValidator()- it's a validator, not an int. - Subclasses of validataclasses with incompatible field type overrides (e.g. subclass changes field type from
inttoOptionalUnset[int]) - Sentinels: Checking
x is not UnsetValuedoes not narrow down the type, and evaluating as booleanif x:doesn't either. (For the latter: would it help to declare the type ofUnsetValueType.__bool__asLiteral[False]?)
- Assigning validators to fields in validataclasses:
- Write mypy plugin.
- ???
- Tests and documentation
- Document how to use mypy with validataclass (best practices etc.)
Metadata
Metadata
Assignees
Labels
enhancementImprovements to existing features or smaller new featuresImprovements to existing features or smaller new featuresrefactoringCode refactoring, clean up and other code maintenance work.Code refactoring, clean up and other code maintenance work.testingRelated to testing (e.g. unit tests)Related to testing (e.g. unit tests)