abacusai.python_function_validator

Classes

_MonkeyPatch

Helper class to prepend to sys.path and undo monkeypatching of attributes

Functions

validate_function_locally(client, python_function_name)

Validates a Python function by running it with the given input values in an local environment. Taking Input Feature Group as either name(string) or Pandas DataFrame in kwargs.

Module Contents

abacusai.python_function_validator.validate_function_locally(client, python_function_name, kwargs=None)

Validates a Python function by running it with the given input values in an local environment. Taking Input Feature Group as either name(string) or Pandas DataFrame in kwargs.

Parameters:
  • client (ApiClient) – The AbacusAI client.

  • python_function_name (str) – The name of the Python function registered in Abacus.AI to execute.

  • kwargs (dict) – A dictionary mapping function arguments to values to pass to the function. Feature group names will automatically be converted into pandas dataframes.

Returns:

The result of executing the python function

Return type:

any

Raises:
  • TypeError – If an Input Feature Group argument has an invalid type or argument is missing.

  • Exception – If an error occurs while validating the Python function.

class abacusai.python_function_validator._MonkeyPatch
Helper class to prepend to sys.path and undo monkeypatching of attributes
syspath_prepend:

prepend to sys.path list of import locations

undo:

undo all changes made

_savesyspath: List[str] | None = None
classmethod context()
Return type:

Generator[_MonkeyPatch, None, None]

syspath_prepend(path)

Prepend path to sys.path list of import locations.

Return type:

None

undo()

Undo all monkeypatching done by this object.

Return type:

None