hamilton
hamilton copied to clipboard
Refactors decorators to live in a separate subpackage
This makes it backwards compatible -- we previously had two files:
- function_modifiers.py
- function_modfiers_base.py
We now create a module function_modifiers.py
which enables us to separate out decorators, as the file is getting unwieldy and ugly.
That said, we need to maintain backwards compatibility on import. To do this, we:
- Create a function_modifiers subpackage
- Put everything that was in function_modifiers.py in init.py in that package (so imports work)
- Move function_modifiers_base.py over there
- Create a "dummy" function_modifiers_base.py that just imports everything from the actual one.
Will need to test this out on sample workflows prior to publishing.
[Short description explaining the high-level reason for the pull request]
Changes
Testing
Notes
Checklist
- [ ] PR has an informative and human-readable title (this will be pulled into the release notes)
- [ ] Changes are limited to a single goal (no scope creep)
- [ ] Code can be automatically merged (no conflicts)
- [ ] Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
- [ ] Passes all existing automated tests
- [ ] Any change in functionality is tested
- [ ] New functions are documented (with a description, list of inputs, and expected output)
- [ ] Placeholder code is flagged / future TODOs are captured in comments
- [ ] Project documentation has been updated if adding/changing functionality.
- [ ] Reviewers requested with the Reviewers tool :arrow_right:
Testing checklist
Python - local testing
- [ ] python 3.6
- [ ] python 3.7
Comments from @skrawcz:
(originally here): https://github.com/stitchfix/hamilton/pull/199#pullrequestreview-1112603506
I'm concerned about:
- commit history preservation - wouldn't want to lose some of the "why" for some of the decorators.
- Any reason function_modifiers_base needs to exist? Where is it being used? Can we add a deprecation warning if we can't migrate things ourselves?
- Shouldn't there be a base.py in the function_modifiers module now?
- 2 code comments:
- https://github.com/stitchfix/hamilton/pull/199#discussion_r974491540
- https://github.com/stitchfix/hamilton/pull/199#discussion_r974494130
Response here: https://github.com/stitchfix/hamilton/pull/199#issuecomment-1251323399
Closed in favor of #238