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).
Source code in src/pyrig_containers/rig/configs/container_file.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
content()
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
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
extension()
Return an empty string; Containerfile has no file extension.
Source code in src/pyrig_containers/rig/configs/container_file.py
21 22 23 | |
extension_separator()
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
25 26 27 28 29 30 31 32 | |
parent_path()
Return the project root directory.
Source code in src/pyrig_containers/rig/configs/container_file.py
74 75 76 | |
stem()
Return "Containerfile".
Source code in src/pyrig_containers/rig/configs/container_file.py
78 79 80 | |
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.
deploy
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.
DeployWorkflowConfigFile
Bases: DeployWorkflowConfigFile
Deploy workflow that adds a job to build and push a container image to GHCR.
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
container_image_tag_latest()
Build the project's image reference tagged latest.
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
185 186 187 | |
container_image_tag_version()
Build the project's image reference tagged with the project version.
The version is a shell substitution expression resolved when the workflow runs, not the literal version at generation time.
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
174 175 176 177 178 179 180 181 182 183 | |
insert_actor()
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
189 190 191 192 193 194 195 | |
job_container_image()
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
31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
jobs()
Add the container image publish job to the base jobs.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict combining the base jobs with the container image job. |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
20 21 22 23 24 25 26 27 28 29 | |
step_build_container_image(*, step=None)
Build a step that builds the container image.
Tags the built image with both the versioned tag and the latest tag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
dict[str, Any] | None
|
Additional keys to merge into the step configuration. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Step that runs |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
step_install_container_engine(*, step=None)
Build a step that installs podman on the runner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
dict[str, Any] | None
|
Additional keys to merge into the step configuration. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Step using |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
step_login_container_registry(*, step=None)
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
dict[str, Any] | None
|
Additional keys to merge into the step configuration. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Step that runs |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
step_push_container_image_latest(*, step=None)
Build a step that pushes the latest image tag to the registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
dict[str, Any] | None
|
Additional keys to merge into the step configuration. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Step that runs |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
step_push_container_image_version(*, step=None)
Build a step that pushes the versioned image tag to the registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
dict[str, Any] | None
|
Additional keys to merge into the step configuration. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Step that runs |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
steps_container_image()
Build the ordered steps for the publish-container-image job.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
Ordered list of step dicts: core setup, install the container |
list[dict[str, Any]]
|
engine, log in to the registry, build the image, then push the |
list[dict[str, Any]]
|
versioned tag and the latest tag. |
Source code in src/pyrig_containers/rig/configs/version_control/remote/workflows/deploy.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
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.
Source code in src/pyrig_containers/rig/tools/containers/engine.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
build_args(*args, tags=(), context='.')
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
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
dev_dependencies()
Return an empty tuple; podman is a system package, not a Python one.
Source code in src/pyrig_containers/rig/tools/containers/engine.py
18 19 20 | |
group()
Return Group.TOOLING.
Source code in src/pyrig_containers/rig/tools/containers/engine.py
22 23 24 | |
image_url()
Return the Shields.io badge URL for podman.
Source code in src/pyrig_containers/rig/tools/containers/engine.py
26 27 28 | |
link_url()
Return the URL of the podman project page.
Source code in src/pyrig_containers/rig/tools/containers/engine.py
30 31 32 | |
login_args(*args, registry, username, password)
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
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
name()
Return "podman".
Source code in src/pyrig_containers/rig/tools/containers/engine.py
34 35 36 | |
push_args(*args, tag)
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
93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
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.
Source code in src/pyrig_containers/rig/tools/containers/registry.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
dev_dependencies()
Return an empty tuple; the registry requires no Python package.
Source code in src/pyrig_containers/rig/tools/containers/registry.py
17 18 19 | |
group()
Return Group.PROJECT_INFO.
Source code in src/pyrig_containers/rig/tools/containers/registry.py
21 22 23 | |
host()
Return "ghcr.io".
Source code in src/pyrig_containers/rig/tools/containers/registry.py
63 64 65 | |
image_name()
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
50 51 52 53 54 55 56 57 58 59 60 61 | |
image_tag(tag)
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
39 40 41 42 43 44 45 46 47 48 | |
image_url()
Return the Shields.io badge URL for GHCR.
Source code in src/pyrig_containers/rig/tools/containers/registry.py
25 26 27 | |
link_url()
Return the URL of the project's GHCR container package page.
Source code in src/pyrig_containers/rig/tools/containers/registry.py
29 30 31 32 33 | |
name()
Return "ghcr".
Source code in src/pyrig_containers/rig/tools/containers/registry.py
35 36 37 | |
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.
Source code in src/pyrig_containers/rig/tools/packages/manager.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
container_image()
Return the image and paths for copying uv into a container image.
Returns:
| Type | Description |
|---|---|
tuple[str, str, str]
|
Tuple of |
Source code in src/pyrig_containers/rig/tools/packages/manager.py
13 14 15 16 17 18 19 | |