Framework for Python

Workflow

scaffold()

Prepare the current Python session for work in the project.

Call it at the top of every notebook and script. It:

  • finds the project root and loads its .env and settings,
  • creates framework.db if needed and records the scaffold time,
  • sets the random seed when seed_on_scaffold is on (or FW_SEED is set),
  • puts the project's functions folder on the import path, and
  • runs scaffold.py from the project root, if there is one.

Usage

scaffold(settings_file: str | Path | None = None) -> Path

Arguments

Name Type Default Description
settings_file str | Path | None None

The project's settings file. Default: the settings.yml or config.yml found in the current directory or its parents.

Value

The project root.

Details

The working directory is not changed: Framework resolves project paths from the root wherever the notebook runs.

Raises

  • ProjectNotFoundError: When no settings file is found.