Build --dry-run combined with --push raises an unhandled RuntimeError
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 69/100
Research direction
Start at the CLI handling for build --dry-run --push in pycontainer/cli.py (the traceback points near line 693), then trace the dry-run and push behavior into pycontainer/builder.py around push(). Check the existing CLI tests for dry-run and push combinations. Done when this combination either completes a no-mutation preview or returns an actionable usage error without an unhandled traceback.
Written by the indexing model from the issue text.
Description
Summary
Combining the documented build --dry-run and --push options raises an unhandled exception after printing a build plan. The documentation describes --dry-run as a preview without creating artifacts, but does not define the combined flags' behavior.
Environment
- pycontainer-build
0.4.0, release v0.4.0, commit241887ed82e2f884c030c954fc5e813d67e8c43f - Wheel SHA-256:
775345dd1c17890ce4d4598c87cfd52bf6174d25af049ea09312ad6b3562be7f - Windows 11 x64, Python 3.12.10, uv 0.13.9; isolated home, Docker configuration and caches
Reproduction
Create pyproject.toml:
[project]
name = "dogfood-zero"
version = "0.1.0"
requires-python = ">=3.12"
description = "Synthetic zero-config dogfood application"
[project.scripts]
dogfood-zero = "zero_runtime:main"
Create src/zero_runtime.py:
import json
import os
import platform
import sys
def main():
print(json.dumps({
"application": "zero-runtime",
"mode": os.environ.get("DOGFOOD_MODE", "zero"),
"python": platform.python_version(),
"implementation": platform.python_implementation(),
"executable": os.path.basename(sys.executable),
}, sort_keys=True))
if __name__ == "__main__":
main()
Run from the project directory:
pycontainer build --tag docker.io/spboyer/dogfood-never-publish:v1 --dry-run --push
Expected
Either provide a successful no-mutation preview or reject the combination as a usage error with an actionable diagnostic. Neither behavior should raise an unhandled traceback.
Actual
The command exits 1 and reports:
DRY RUN: Would build image docker.io/spboyer/dogfood-never-publish:v1
Traceback (most recent call last):
... pycontainer/cli.py, line 693, in main
pushed = builder.push(**push_options)
... pycontainer/builder.py, line 1195, in push
raise RuntimeError("Must call build() before push()")
RuntimeError: Must call build() before push()
The output also includes Built: docker.io/spboyer/dogfood-never-publish:v1. The existing local OCI layout was unchanged and no registry mutation occurred. This makes the documented preview and push flags unsuitable for a combined preflight and exposes an internal traceback instead of a clear user-facing result.
Related work
#258 addresses Windows image target rejection and references the unbuilt-image push guard; it does not address --dry-run --push.
- Dominant language
- Python
- Stars
- 10
- Forks
- 1
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 129
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from spboyer/pycontainer-build
-
priority:p2 release:backlog squad:verdandi testing type:chore
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
spboyer/pycontainer-build#275 · 3 comments ·
Maintainers usually reply within 1 day
-
bug configuration priority:p1 python release:backlog type:bug ux
Difficulty 3/5 1-2 days Newbie friendliness 69/100
spboyer/pycontainer-build#285 · 2 comments ·
Maintainers usually reply within 1 day
-
agent:tracking
Difficulty 5/5 Over a week Newbie friendliness 1/100
spboyer/pycontainer-build#283 ·
Maintainers usually reply within 1 day
-
Release v0.5.0Openagent:tracking release:v0.5.0 type:roadmap
Difficulty 5/5 Over a week Newbie friendliness 15/100
spboyer/pycontainer-build#282 ·
Maintainers usually reply within 1 day
-
go:needs-research priority:p2 release:backlog squad:njord tooling type:chore
Difficulty 4/5 3-5 days Newbie friendliness 35/100
spboyer/pycontainer-build#278 · 4 comments ·
Maintainers usually reply within 1 day
All issues in spboyer/pycontainer-build
Similar issues
-
Test: to_hijri() accepts datetime.datetime and uses only the date partPossibly taken A pull request linked to this issue is open or already merged. Opengood first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
omarelshamy25x/shamy-hijri#63 · 3 comments ·
Maintainers usually reply within 1 day