Skip to content

fix(devcontainer): remove the init options that change nothing #6486

Done

Description

@dan-petty

Problem

devops devcontainer init has two options that change nothing:

  • --published / -p (default True): init in src/devops_cli/commands/devcontainer.py never reads the value. It sets is_published from --image alone.
  • --python: init gives the value to devcontainer.json.j2, but the template does not read it. The template always writes the published image or the image that --image names. fix: drop copied tool versions from generated files #6412 deletes the last branch of the template that read it (a python:<version>-trixie image that no call reached).

The help says "Use published GHCR image (defaults to True)" and "Python version for base template", so a user thinks that the options do something.

Change

  • Remove --published and --python from devops devcontainer init, and stop the render call from giving python_version and the published flag that only --image sets, if the template can read the image alone.
  • Keep --python of devops devcontainer update, which uses it.
  • Regenerate the command reference, and change docs/DEVCONTAINER_USAGE.md (it shows init --published) and the tests that pass --published.

Renovate. None.

Risk. Low. A script that passes --published or --python to init gets a usage error.

Proof

  • uv run devops devcontainer init --help shows no --published and no --python.
  • Scoped pytest of tests/commands/test_devcontainer.py and tests/core/test_template_rendering.py passes.

Depends on: #6412

Alternatives check of 2026-11-20: none.
Tool: none found.
Reason: Searches for a tool that finds or removes unused Typer/Click CLI options returned only general Python documentation and container images, no tool. The change edits the project's own Typer command, help text, docs and tests, so no external tool or library covers it.

Lacks:

  • Removal of the dead --published and --python options from init
  • Stop passing python_version in the init render context
  • Regenerated command reference and usage guide without the options
  • Updated tests that pass the removed options

Proposed design

Problem statement

devops devcontainer init offers --published/-p and --python, but neither option changes the output. init sets the published flag from --image alone, and the template does not read python_version after #6412. The change removes both options from init, keeps --python of update, and updates the command reference, the usage guide and the tests.

Acceptance criteria

Requirement: Init help hides removed options

The init command of devops devcontainer SHALL show neither --published nor --python in its help.

Scenario: Help of init

  • WHEN A test runs devops devcontainer init --help in the CLI runner.
  • THEN The output holds no --published, no -p and no --python.

Requirement: Init rejects removed options

The init command of devops devcontainer SHALL exit with a nonzero code when a caller passes --published or --python.

Scenario: Removed option use

  • WHEN A test runs devops devcontainer init --published in the CLI runner.
  • THEN The command exits with a nonzero code and its output names --published.

Requirement: Init render context

The init command SHALL NOT pass python_version to devcontainer.json.j2.

Scenario: Recorded render arguments

  • WHEN A test replaces render_json_template with a recorder and runs init on a temporary directory.
  • THEN The recorded keyword arguments hold image and published, and they hold no python_version.

Requirement: Update keeps the Python option

The update command SHALL keep --python and SHALL set the manifest image from its value.

Scenario: Update writes the image

  • WHEN A test runs devops devcontainer update --python 3.13 on a directory that holds a manifest.
  • THEN The written image starts with CONST_DEVCONTAINER_IMAGE_PREFIX and ends with 3.13.

Requirement: Command reference is current

The generated command reference SHALL show devcontainer init with no --published and no --python.

Scenario: Docs row of static analysis

  • WHEN uv run devops ci --check --only docs runs on the change.
  • THEN The docs row reports a pass and no stale generated document.

Requirement: Usage guide shows no removed option

docs/DEVCONTAINER_USAGE.md SHALL NOT show init --published.

Scenario: Search of the usage guide

  • WHEN rg -n -- '--published' docs/DEVCONTAINER_USAGE.md runs.
  • THEN The command prints no line.

Requirement: Devcontainer tests pass

The devcontainer command and template tests SHALL pass with no use of the removed options.

Scenario: Scoped pytest

  • WHEN uv run pytest tests/commands/test_devcontainer.py tests/core/test_template_rendering.py -q runs.
  • THEN The test run reports a pass.

Existing Tool Considered

The alternatives check in the issue body records verdict none and no tool. No open, maintained tool or library covers the need. The change edits the project's own Typer command, help text, docs and tests, so it writes no new code and has no written build cost.

Key questions

  • Which value does init use for the published flag?: init sets is_published from --image: true when the image starts with ghcr.io/dan-petty/devops-cli/devcontainer, and true for the default published image. init never reads the --published option. [sources: src/devops_cli/commands/devcontainer.py:164, src/devops_cli/commands/devcontainer.py:167]
  • Which render arguments can init drop?: Drop python_version only. Keep published, because init computes it from --image and the template still reads it. (best practice) [sources: src/devops_cli/commands/devcontainer.py, src/devops_cli/templates/devcontainer.json.j2]
  • Does update use --python?: Yes. update writes data['image'] as CONST_DEVCONTAINER_IMAGE_PREFIX plus the value of --python, so the option stays. [sources: src/devops_cli/commands/devcontainer.py]
  • Which documents and tests show the removed options?: docs/DEVCONTAINER_USAGE.md shows init --published. docs/CLI_REFERENCE.md is the generated command reference that the docs row of Static Analysis checks. tests/commands/test_devcontainer.py and tests/core/test_template_rendering.py pass the removed options. [sources: docs/DEVCONTAINER_USAGE.md, docs/CLI_REFERENCE.md, tests/commands/test_devcontainer.py, tests/core/test_template_rendering.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6412

Activity

  1. added
    type/bug
    source/agent
    status/new
    value/medium
    on Nov 20, 2026
  2. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor
  3. added
    effort/low
    scope/devcontainer
    priority/p2-medium
    on Nov 20, 2026
  4. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files in the section Proposed design of the body.

  5. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (2)

    Searches run:

    • library detects unused CLI options in python typer app, results: 5
    • python typer CLI remove dead command option automatically, results: 5

    Sources:

  6. added
    status/ready
    and removed
    status/new
    on Nov 20, 2026
  7. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  8. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 25, 2026
  9. removed
    status/in-review
    on Nov 25, 2026
  10. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-25 17:09 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/devcontainersource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions