with_requirements

with_requirements(python_packages: list[str] = [], global_imports: list[str | ImportFromModule | Alias] = []) -> Callable[[Callable[~P, ~T]], FunctionWithRequirements[~T, ~P]]

Decorate a function with package and import requirements

Parameters:
NameDescription
python_packagesPackages required to function.

Can include version info..

Defaults to [].

Type: list[str]

Default: []
global_importsRequired imports.

Defaults to [].

Type: list[str | ImportFromModule | Alias]

Default: []
Returns:
TypeDescription
Callable[[Callable[~P, ~T]], FunctionWithRequirements[~T, ~P]]Callable[[Callable[P, T]], FunctionWithRequirements[T, P]]: The decorated function