hamilton icon indicating copy to clipboard operation
hamilton copied to clipboard

Refactors decorators to live in a separate subpackage

Open elijahbenizzy opened this issue 2 years ago • 1 comments

This makes it backwards compatible -- we previously had two files:

  1. function_modifiers.py
  2. 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:

  1. Create a function_modifiers subpackage
  2. Put everything that was in function_modifiers.py in init.py in that package (so imports work)
  3. Move function_modifiers_base.py over there
  4. 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

elijahbenizzy avatar Sep 18 '22 18:09 elijahbenizzy

Comments from @skrawcz:

(originally here): https://github.com/stitchfix/hamilton/pull/199#pullrequestreview-1112603506

I'm concerned about:

  1. commit history preservation - wouldn't want to lose some of the "why" for some of the decorators.
  2. 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?
  3. 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

elijahbenizzy avatar Sep 19 '22 17:09 elijahbenizzy

Closed in favor of #238

elijahbenizzy avatar Dec 19 '22 20:12 elijahbenizzy