plesty.sdk.context

Cross-command context management.

Attributes

pass_app_context

Decorator to pass the application context to a Click command as the first argument.

Classes

DocumentationSettings

Settings for generating the documentation pages,

ApplicationContext

Container class for storing data shared across multiple commands.

Module Contents

class plesty.sdk.context.DocumentationSettings(project_directory: pathlib.Path, pyproject_toml: dict[str, Any])

Settings for generating the documentation pages, which can be configured in the pyproject.toml file.

Read the documentation settings specified by the user in the [tool.plesty.docs] section of the pyproject.toml file and set default values for missing settings.

Parameters:
  • project_directory (pathlib.Path) – The path to the Python project directory.

  • pyproject_toml (dict[str, Any]) – The parsed content of the pyproject.toml file.

site_name: str

The title of the website present on each page next to the Plesty logo.

project_directory: str

The path to the project directory (the autoapi package scan root).

docs_dir: str

The directory containing the .md or .rst files to generate the documentation from.

api_ignore: list[str]

Top-level package directory names excluded from the API reference scan.

toc_file: str | None

The path to the external TOC file.

module_type: str | None

The plesty module type (device/experiment/…), or None.

class plesty.sdk.context.ApplicationContext(project_dir: pathlib.Path, quiet: bool = False)

Container class for storing data shared across multiple commands.

Initialize the application context with option values from the top-level ‘plesty’ command and populate property backing fields.

Parameters:
  • project_dir (pathlib.Path) – The path to the directory of the target Python project, supplied via the –project-dir option.

  • quiet (bool) – Suppress progress and guidance output, supplied via the –quiet option.

project_directory: pathlib.Path

The path to the directory of the target Python project.

quiet: bool

Suppress progress and guidance output; failures and results still print.

_pyproject_toml: dict[str, Any] | None
_docs_settings: DocumentationSettings | None
property pyproject_toml: dict[str, Any]

The parsed content of the pyproject.toml file of the target Python project.

Return type:

dict[str, Any]

property docs_settings: DocumentationSettings

The documentation settings read from the pyproject.toml file.

Return type:

DocumentationSettings

ensure_docs_index() → None

Ensure that the docs directory exists and contains an index.md or index.rst file, as well as the external TOC file, if specified in the documentation settings.

Raises:

click.ClickException – If a required file is missing.

Return type:

None

plesty.sdk.context.pass_app_context

Decorator to pass the application context to a Click command as the first argument.