Skip to main content

coding.func_with_reqs

with_requirements

def with_requirements(
python_packages: List[str] = [],
global_imports: List[Import] = []
) -> Callable[[Callable[P, T]], FunctionWithRequirements[T, P]]

Decorate a function with package and import requirements

Arguments:

  • python_packages List[str], optional - Packages required to function. Can include version info.. Defaults to [].
  • global_imports List[Import], optional - Required imports. Defaults to [].

Returns:

Callable[[Callable[P, T]], FunctionWithRequirements[T, P]]: The decorated function

to_stub

def to_stub(
func: Union[Callable[..., Any], FunctionWithRequirementsStr]) -> str

Generate a stub for a function as a string

Arguments:

  • func Callable[..., Any] - The function to generate a stub for

Returns:

  • str - The stub for the function