Remove curried methods and toolz library - #31
Merged
Conversation
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
…replace_curry_with_typed
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.
What?
Replaces the curried
extract_query/extract_sorthelpers inrepositories/base.pywith fully typed generic functions, and removes the now-unusedtoolzlibrary from project dependencies.Files changed:
pyfastapi/repositories/base.py— removed@currydecorators, addedTypeVarfor type-safe genericspyfastapi/repositories/country.py— replacedtoolz.composewith direct sequential callspyfastapi/repositories/person.py— replacedtoolz.composewith direct sequential callstests/unit_tests/repositories/test_base.py— updated tests to call functions with all argumentspyproject.toml— removedtoolzdependencyuv.lock— regenerated withouttoolzWhy?
toolz.curryapproach required# type: ignoreannotations, breakingmypy --strictsafetytoolz.composewas unnecessarily complex for simple SQLAlchemy query buildingtoolzwas the only remaining consumer of functional-programming patterns in the repository layer; removing it reduces external dependenciesHow?
Before — partial application via currying:
After — plain generic functions with a
TypeVar:Testing?
uv run pytest— 65/65 tests passuv run flake8 .— 0 issuesuv run mypy --strict .— 0 errors across 51 source filesScreenshots (optional)
N/A — internal refactor only.
Anything Else?
toolzis no longer imported anywhere inpyfastapi/ortests/AI Summary (optional)
Refactored repository query builders from
toolz-based curried functions to plain typed generics, eliminating# type: ignoreannotations and removing thetoolzruntime dependency entirely.