pyinfra.api.metadata module

Support parsing pyinfra-metadata.toml

Currently just parses plugins and their metadata.

class pyinfra.api.metadata.Plugin(*, name: str, path: str, type: Literal['operation', 'fact', 'connector', 'deploy'], tags: list[Tag])

Bases: BaseModel

Representation of a pyinfra plugin.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
path: str
tags: list[Tag]
type: Literal['operation', 'fact', 'connector', 'deploy']
class pyinfra.api.metadata.Tag(*, value: Literal['boot', 'containers', 'database', 'service-management', 'package-manager', 'python', 'ruby', 'javascript', 'configuration-management', 'security', 'storage', 'system', 'rust', 'version-control-system'])

Bases: BaseModel

Representation of a plugin tag.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

property title_case: str
value: Literal['boot', 'containers', 'database', 'service-management', 'package-manager', 'python', 'ruby', 'javascript', 'configuration-management', 'security', 'storage', 'system', 'rust', 'version-control-system']
pyinfra.api.metadata.parse_plugins(metadata_text: str) list[Plugin]

Given the contents of a pyinfra-metadata.toml parse out the plugins.