Configuration and context

When you import Caliber, it will initialize a context with configuration and data relevant for the current Caliber run. The configuration can be set using environment variables. See the full list of available environment variables. The context can be viewed by importing it, from caliber import context, and the current configuration can be found in context.config. The context is a caliber.config.Context and the configuration is a caliber.config.Config.


class caliber.config.Context[source]

Class containing configuration and data relevant for the context of the current Caliber run.

caliberignore

Files to ignore by transports.

Type:

CaliberIgnore

config

The Caliber configuration.

Type:

Config

g

Namespace object for storing data across different objects during a run.

Type:

Globals

transports

All registered transports.

Type:

dict

speckle

The Speckle Context.

Type:

SpeckleContext

thread_stopper

Internal flag for stopping execution from a thread.

Type:

threading.Event


class caliber.config.SpeckleContext(*, client: SpeckleClient | None = None, transport: ServerTransport | None = None, host: HttpUrl | None = None, project_id: str | None = None, project_url: str | None = None)[source]

Class containing attributes of the Speckle context.

get_context(reset: bool = False) Tuple[SpeckleClient, ServerTransport] | Tuple[None, None][source]

Get an authenticated Speckle client and initialized Speckle Server transport.

Parameters:

reset (bool) – Flag to force a reset of the context before getting it.


class caliber.config.Config[source]

Class for collecting Caliber configuration.

speckle

The Speckle configuration.

Type:

SpeckleConfig

zip

The Zip configuration.

Type:

ZipConfig

core

The core configuration.

Type:

CoreConfig


class caliber.config.SpeckleConfig(_case_sensitive: bool | None = None, _nested_model_default_partial_update: bool | None = None, _env_prefix: str | None = None, _env_file: DotenvType | None = WindowsPath('.'), _env_file_encoding: str | None = None, _env_ignore_empty: bool | None = None, _env_nested_delimiter: str | None = None, _env_nested_max_split: int | None = None, _env_parse_none_str: str | None = None, _env_parse_enums: bool | None = None, _cli_prog_name: str | None = None, _cli_parse_args: bool | list[str] | tuple[str, ...] | None = None, _cli_settings_source: CliSettingsSource[Any] | None = None, _cli_parse_none_str: str | None = None, _cli_hide_none_type: bool | None = None, _cli_avoid_json: bool | None = None, _cli_enforce_required: bool | None = None, _cli_use_class_docs_for_groups: bool | None = None, _cli_exit_on_error: bool | None = None, _cli_prefix: str | None = None, _cli_flag_prefix_char: str | None = None, _cli_implicit_flags: bool | None = None, _cli_ignore_unknown_args: bool | None = None, _cli_kebab_case: bool | None = None, _cli_shortcuts: Mapping[str, str | list[str]] | None = None, _secrets_dir: PathType | None = None, *, HOST: HttpUrl | None = None, PROJECT: str | None = None, TOKEN: str | None = None, MODEL_NAME: str | None = None)[source]

Class for collecting Speckle configuration. The configuration is read from the environment variables or from the file ‘.caliberenv’. All variables should be prefixed with ‘CALIBER_SPECKLE’ in the environment variable list or in the file.

HOST

The complete URL of the Speckle server to use a remote host. If no URL is provided, a local workflow queue will be used as default.

Type:

HttpUrl, optional

PROJECT

The Speckle project to use for data exchange. This is only relevant if HOST is not None.

Type:

str, optional

TOKEN

The token necessary to authenticate a Speckle client. This is only relevant if HOST is not None. If HOST is not None, and the provided URL corresponds to an account registered in Speckle Manager, and TOKEN is None, the token will be automatically found from the local account.

Type:

str, optional

MODEL_NAME

The model to use on the Speckle project. This is only relevant if HOST is not None. The default model is ‘caliber’.

Type:

str

Note that the class inherits from pydantic.BaseSettings.


class caliber.config.ZipConfig(*, FILENAME_READ: str | None = None, FILENAME_WRITE: str | None = None, OVERWRITE: bool = False, read_kwargs: Dict | None = None, write_kwargs: Dict | None = None)[source]

Class for collecting Zip configuration. The configuration is read from the environment variables or from the file ‘.caliberenv’. All variables should be prefixed with ‘CALIBER_ZIP’ in the environment variable list or in the file.

FILENAME_READ

The name of Zipfile to read from.

Type:

str

FILENAME_WRITE

The name of Zipfile to write to.

Type:

str


class caliber.config.CaliberIgnore[source]

Class containing the list of files and folders to ignore when searching for files to transport.

ignore_files

The list of files and folders to ignore. The entries in the list can be written using shell-style wildcards, see builtin module fnmatch.

Type:

list