Skip to content

Commit

Permalink
Adds group to docs
Browse files Browse the repository at this point in the history
We hadn't exposed it. This adds that and corrects the doc string
that will be exposed.
  • Loading branch information
skrawcz committed Apr 24, 2023
1 parent bfc2300 commit d167945
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/reference/api-reference/decorators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Classes to help with @parameterize:

.. autoclass:: hamilton.function_modifiers.value

.. autoclass:: hamilton.function_modifiers.group


Actual decorators:
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
10 changes: 7 additions & 3 deletions hamilton/function_modifiers/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,15 @@ def group(
This means that it gets injected into a list of dependencies that are grouped together. E.G.
dep=group(source("foo"), source("bar")) for the function:
def f(dep: List[pd.Series]) -> pd.Series:
return ...
.. code-block:: python
@inject(dep=group(source("foo"), source("bar")))
def f(dep: List[pd.Series]) -> pd.Series:
return ...
Would result in dep getting foo and bar dependencies injected.
:param dependencies: Dependencies, list of dependencies
:param dependency_args: Dependencies, list of dependencies (e.g. source("foo"), source("bar"))
:param dependency_kwargs: Dependencies, kwarg dependencies (e.g. foo=source("foo"))
:return:
"""
_validate_group_params(dependency_args, dependency_kwargs)
Expand Down

0 comments on commit d167945

Please sign in to comment.