methods

A lot of fellings work is behind the scenes, these are the only methods you’ll normally interact with

felling.configure(log_path: Path | str | None = None, log_file_name: str | None = None, file_log_level: str | None = 'DEBUG', std_out_log_level: str | None = 'INFO', error_only_modules: module | Sequence[module] | str | Sequence[str] | None = None, modules_to_debug: module | Sequence[module] | str | Sequence[str] | None = None, package_versions_to_log: module | List[module] | None = None)

Configure logging for this run time

Parameters:
  • log_path (Union[Path, str, None], optional) – The path to save logs to, by default None

  • log_file_name (Optional[str], optional) – The log file name, by default None

  • file_log_level (Optional[str], optional) – The minimum log level to write to file, by default “DEBUG”

  • std_out_log_level (Optional[str], optional) – The minimum log level to write to std out, by default “INFO”

  • error_only_modules (Optional[ Union[ModuleType, Sequence[ModuleType], str, Sequence[str]] ], optional) – Modules to only log errors. If module(s) is provided __name__ will be used, if str(s) are provided they will be used, by default None

  • modules_to_debug (Optional[ Union[ModuleType, Sequence[ModuleType], str, Sequence[str]] ], optional) – Modules to log debug logs. If module(s) is provided __name__ will be used, if str(s) are provided they will be used, by default None

  • package_versions_to_log (Optional[ModuleType], optional) – Packages to log versions for, by default None

felling.send_email(to: List[str] | str, sender: str | None = None, password: str | None = None, subject: str | None = None, content: str | None = None, smtp_server: str = 'Smtp.office365.com')

A method to easily send emails

If the email fails to send the error is logged be and error isn’t raised

Parameters:
  • to (Union[List[str], str]) – The recipients as a list of strings or an individual string

  • sender (Optional[str], optional) – The senders email address if None will look for the environment variable felling_email_sender, by default None

  • password (Optional[str], optional) – The senders password, it is reccomended this is stored as an environment variable if None will look for the environment variable felling_email_password, by default None

  • subject (Optional[str], optional) – The email subject, if none will try to infer from content, by default None

  • content (Optional[str], optional) – The email content, if none will try to infer from subject. Html code can be provided, e.g. from pandas to_html, by default None

  • smtp_server (str, optional) – The smtp_server to use, currently only tested on office365, by default “Smtp.office365.com”

Raises:

TypeError – If the smtp server is of incorrect type raise this error