Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Commit

Permalink
Adds migration section in README for decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
elijahbenizzy committed Aug 8, 2022
1 parent e2340b2 commit 75c5109
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 16 additions & 0 deletions decorators.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,22 @@ to make the parameterization decorators more consistent! But we will not break y

*Note*: that the different input variables must all have compatible types with the original decorated input variable.

## Migrating @parameterized

As we've said above, we're planning on deprecating the following:

- `@parameterized_inputs` (replaced by `@parameterize_inputs`)
- `@parametrized` (replaced by `@parameterize_values`, as that's what its really doing)
- `@parametrized_input` (gotten rid of in its original form, replaced by `@parameterize_inputs` as that is more versatile.)

In other words, we're aligning around the following `@parameterize` implementations:

- `@parameterize` -- this does everything you want
- `@parameterize_values` -- this just changes the values, does not change the input source
- `@parameterize_inputs`-- this just changes the source of the inputs

The only non-drop-in change you'll have to do is for `@parameterized`. We won't update this until `hamilton==2.0.0`, though,
so you'll have time.


## @extract_columns
Expand Down
6 changes: 3 additions & 3 deletions hamilton/function_modifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def __init__(self, parameter: str, assigned_output: Dict[Tuple[str, str], Any]):
fail_starting=(2, 0, 0),
use_this=parameterize_values,
explanation='We now support three parametrize decorators. @parameterize, @parameterize_values, and @parameterize_inputs',
migration_guide='https://github.com/stitchfix/hamilton/blob/main/decorators.md'
migration_guide='https://github.com/stitchfix/hamilton/blob/main/decorators.md#migrating-parameterized'
)
class parametrized(parameterize_values):
pass
Expand Down Expand Up @@ -283,7 +283,7 @@ def __init__(self, **parameterization: Dict[str, Dict[str, str]]):
fail_starting=(2, 0, 0),
use_this=parameterize_inputs,
explanation='We now support three parametrize decorators. @parameterize, @parameterize_values, and @parameterize_inputs',
migration_guide='https://github.com/stitchfix/hamilton/blob/main/decorators.md'
migration_guide='https://github.com/stitchfix/hamilton/blob/main/decorators.md#migrating-parameterized'
)
class parametrized_input(parameterize):
def __init__(self, parameter: str, variable_inputs: Dict[str, Tuple[str, str]]):
Expand Down Expand Up @@ -318,7 +318,7 @@ def __init__(self, parameter: str, variable_inputs: Dict[str, Tuple[str, str]]):
fail_starting=(2, 0, 0),
use_this=parameterize_inputs,
explanation='We now support three parametrize decorators. @parameterize, @parameterize_values, and @parameterize_inputs',
migration_guide='https://github.com/stitchfix/hamilton/blob/main/decorators.md' # TODO -- add a migration guide
migration_guide='https://github.com/stitchfix/hamilton/blob/main/decorators.md#migrating-parameterized'
)
class parameterized_inputs(parameterize_inputs):
pass
Expand Down

0 comments on commit 75c5109

Please sign in to comment.