Improve type hint docs, restructure tests (#31)#39
Merged
Conversation
- Update README type hint recommendation from `deleted_at: datetime` to `deleted_at: Mapped[datetime | None]` for proper SQLAlchemy support - Remove global_rewriter singleton, attach rewriter to generated mixin class as `_sqlalchemy_easy_softdelete_rewriter` for better isolation - Restructure tests into isolated "worlds" to enable testing different mixin configurations: - tests/default_config/ - default mixin configuration - tests/custom_deleted_field_name/ - custom field name (removed_at) - tests/custom_method_names/ - custom method names (soft_delete/restore) - tests/disabled_methods/ - disabled delete/undelete methods - tests/custom_default_value/ - custom default value function - tests/integer_field_type/ - integer field type instead of DateTime - Add comprehensive tests for all mixin configuration options
5b79157 to
190027a
Compare
14714bd to
e076715
Compare
e076715 to
b0f2ad6
Compare
- Add mypy configuration to pyproject.toml - Add `make typecheck-hints` target to validate type hints test file - This ensures the Mapped[datetime | None] type hint is verified at compile time
nathan2slime
approved these changes
Jan 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #31
# type: ignore[misc]for dynamic mixin and optional method stubsglobal_rewritersingleton, attach rewriter to generated mixin class as_sqlalchemy_easy_softdelete_rewriterfor better test isolationmake typechecknow checks both source and testsTest Worlds
Each world has its own model base, soft delete mixin, and tests with globally unique names:
tests/default_config/tests/custom_deleted_field_name/removed_at)tests/custom_method_names/soft_delete/restore)tests/disabled_methods/tests/custom_default_value/tests/integer_field_type/Test plan
make typecheckpasses (source + tests)make lintpasses