API¶
Pyrig plugin that integrates container support into a project.
rig ¶
Mirrored namespace through which this plugin extends pyrig's scaffolding.
Mirrors the pyrig.rig package layout so pyrig's cross-package plugin
discovery finds this plugin's configuration and tooling customizations
automatically.
configs ¶
Configuration files this plugin contributes to pyrig's discovery scope.
container_file ¶
Containerfile configuration management.
ContainerfileConfigFile ¶
Bases: StringConfigFile
The project's Containerfile, built from a Python slim base image.
Copies in the uv binary, installs runtime dependencies with uv, and runs
the project as a non-root user (appuser, UID 1000).
content ¶
content() -> str
Build the required Containerfile text.
Returns:
| Type | Description |
|---|---|
str
|
Dockerfile instructions that copy in the |
str
|
the project's runtime dependencies, and run the project as the |
str
|
non-root |
Source code in src/pyrig_containers/rig/configs/container_file.py
extension_separator ¶
extension_separator() -> str
Return an empty string, overriding the default . separator.
Prevents a trailing dot from being appended when the extension is
empty, so the filename remains Containerfile instead of
Containerfile..
Source code in src/pyrig_containers/rig/configs/container_file.py
version_control ¶
Version control config overrides this plugin contributes to pyrig.
remote ¶
Container-specific extensions to GitHub remote repository configuration.
workflows ¶
Container-aware overrides for the project's GitHub Actions workflow configs.
Extension of the deploy workflow that builds and pushes a container image.
Runs after a release and tags the image with both the release version and
latest.
Bases: DeployWorkflowConfigFile
Deploy workflow that adds a job to build and push a container image to GHCR.
container_image_tag_latest() -> str
Build the project's image reference tagged latest.
container_image_tag_version() -> str
Build the project's image reference tagged with the project version.
Returns:
| Type | Description |
|---|---|
str
|
Image reference tagged with the bare project version. |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
insert_actor() -> str
Return the expression that resolves to the workflow actor.
Returns:
| Type | Description |
|---|---|
str
|
GitHub Actions expression for |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
Build the job that builds and pushes the container image to GHCR.
Requests packages: write permission at the job level, required to
push to GHCR.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict mapping the derived job ID to its configuration. |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
Build a step that builds the container image.
Tags the built image with both the versioned tag and the latest tag.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Step that runs |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
Build a step that logs podman in to the container registry.
Authenticates as the workflow actor, using the automatic
GITHUB_TOKEN secret as the password.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Step that runs |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
Build a step that pushes the latest image tag to the registry.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Step that runs |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
Build a step that pushes the versioned image tag to the registry.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Step that runs |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
Build the ordered steps for the publish-container-image job.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
Ordered list of step dicts: core setup, log in to the registry, |
list[dict[str, Any]]
|
build the image, then push the versioned tag and the latest tag. |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
tools ¶
Container-specific overrides and additions for pyrig's CLI tool wrappers.
containers ¶
Tools for building and publishing container images.
engine ¶
Podman command construction for authenticating, building, and publishing images.
ContainerEngine ¶
Bases: Tool
podman command wrapper.
Constructs podman command arguments for authenticating with a registry
and building and pushing container images. Typical usage: call
login_args to authenticate, build_args to build and tag the image,
then push_args to publish each tag to the registry.
Build args to build and tag an image from the build context.
Constructs podman build --tag=<tag>... <context>, repeating
--tag for each provided tag and inserting *args before the
context. No --file is passed, so podman discovers the
Containerfile in the build context automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args
|
str
|
Additional arguments appended before the context (e.g.
|
()
|
tags
|
Iterable[str]
|
Image references to tag the built image with. Defaults to none. |
()
|
context
|
str
|
Build context directory. Defaults to the current directory. |
'.'
|
Returns:
| Type | Description |
|---|---|
Args
|
Args for the |
Source code in src/pyrig_containers/rig/tools/containers/engine.py
Build args to authenticate the container engine with a registry.
Constructs podman login <registry> --username=<username>
--password=<password>, appending *args at the end.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args
|
str
|
Additional arguments appended to the command. |
()
|
registry
|
str
|
Registry host to authenticate against (e.g. |
required |
username
|
str
|
Account name to log in as. |
required |
password
|
str
|
Token or password for the account. |
required |
Returns:
| Type | Description |
|---|---|
Args
|
Args for the |
Source code in src/pyrig_containers/rig/tools/containers/engine.py
Build args to push a tagged image to its registry.
Constructs podman push <tag>, appending *args at the end.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args
|
str
|
Additional arguments appended to the command. |
()
|
tag
|
str
|
Fully qualified image reference to push (e.g.
|
required |
Returns:
| Type | Description |
|---|---|
Args
|
Args for the |
Source code in src/pyrig_containers/rig/tools/containers/engine.py
registry ¶
Container registry identity and badge metadata for publishing images.
ContainerRegistry ¶
Bases: Tool
GitHub Container Registry (GHCR) wrapper.
Provides the registry host, the project's fully qualified image reference within it, and badge metadata for GHCR.
image_name() -> str
Build the project's fully qualified image name without a tag.
Combines the registry host with the lowercased repository owner and project name, as GHCR requires image names to be lowercase.
Returns:
| Type | Description |
|---|---|
str
|
Image name in the form |
Source code in src/pyrig_containers/rig/tools/containers/registry.py
Build the project's image reference for the given tag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag
|
str
|
Tag to append to the image name (e.g. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Image reference in the form |
Source code in src/pyrig_containers/rig/tools/containers/registry.py
packages ¶
Container-specific overrides for pyrig's package-manager tool.
manager ¶
Container-specific conventions for the project's package manager.
PackageManager ¶
Bases: PackageManager
uv package manager, extended with a container-image convention.
Adds container_image, which supplies the image and paths needed to
embed the uv binary in a container image.