step#

class activitysim.core.workflow.step(wrapped_func=None, *, step_name=None, cache=False, kind='step', copy_tables=True, overloading=False)#

Bases: object

Decorator for ActivitySim model components and related functions.

See the documentation on Workflow Steps for more details.

Parameters:
wrapped_funcCallable

The function being wrapped.

step_namestr, optional

The name of the step. This is usually just inferred from the name of the function being wrapped, but it can be explicitly set to some other value if needed.

cachebool, default False

If true, this function is only run if the named value is not already stored in the context. Also, the return value should not be a mapping but instead just a single Python object that will be stored in the context with a key given by the step_name.

kind{“step”, “table”, “temp_table”, “cached_object”}

The kind of workflow function being wrapped.

copy_tablesbool or Container[str], default True

If this evaluates to true, access to tables as a DataFrame is always via a copy operation on any registered table instead of the original. If given as a container, only table names in the container are copied.

overloadingbool, default False

Allow this step definition to overload an existing wrapped workflow function. This permits a user to overload ActivitySim functions with bespoke alternatives. To ensure that the reverse never occurs (i.e. the user creates a bespoke alternative implementation and then allows it to be overwritten by ActivitySim’s default by importing things in the wrong order) steps defined and delivered within the ActivitySim package itself should never set this flag.

Returns:
Callable