formachines / errata

Errata / PyPI / typer

click removed in typer 0.27.3

In our sandbox runs up to 2026-10-27, gpt-6.1-sol wrote from typer.main import click for typer. It fails on 0.27.3 with ImportError (changed between 0.24.1 and 0.27.3). Use from typer.main import TyperChoice instead.

What to do
replace the line
Output
same on one example
Patch
incomplete: old names remain
Auto-apply
not allowed
Seen in
1 model
Worked / failed
3 / 0
Last verified
2026-10-27

What to do

Not for automatic application — after the patch the example still uses click, which the verified example does not: the patch covers part of the change. Show this correction to the user as a lead. Replace the old line with the new one; the rest of the code can stay.

Automatic application: not allowed — the patch gives incomplete when applied word for word. Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own. The change itself is described by kind (removed); the checks are in proof; neither follows from the other.

How to tell this applies to your code

Old and new code

from typer.main import click
from typer.main import TyperChoice

Error on 0.27.3:

ImportError: cannot import name 'click' from 'typer.main' (/usr/local/lib/python3.11/site-packages/typer/main.py)

Other verified fixes

The fix above passed 2 times. These also passed in the sandbox for the same error; pick the one that matches what your code needs.

No direct replacement · passed 1 time · gpt-6.1-sol · patch: nothing to apply word for word

from typer.core import click

No direct replacement: drop this use.

Not for automatic application — format removed: there is no replacement to apply. Show this correction to the user as a lead. click is not available in typer 0.27.3; remove or replace this use. The same code works on typer 0.24.1: pin a version before 0.27.3 if you cannot change the code.

Alternatives are leads for the user, not for automatic application: Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own.

Sandbox proof
Scripttyper versionResult
Code the models wrote0.24.1works
Code the models wrote0.27.3fails: ImportError
Verified example below0.27.3works
Output of the verified example0.27.3same as the original's on 0.24.1 (observed stdout of one example; not a proof of equivalent behaviour)
Patch applied word for word to the example0.27.3applied word for word, the patch leaves old names in use: it covers part of the change — after the patch the example still uses click, which the verified example does not: the patch covers part of the change

Verified example for typer 0.27.3

import typer
from typer.main import TyperChoice
from typer.testing import CliRunner

app = typer.Typer()


@app.command()
def main(
    output_format: str = typer.Option(
        "table",
        "--format",
        click_type=TyperChoice(["json", "csv", "table"], case_sensitive=False),
        help="Output format.",
    ),
) -> None:
    typer.echo(output_format)


if __name__ == "__main__":
    result = CliRunner().invoke(app, ["--format", "CSV"])
    print(result.output, end="")
    print(f"Exit code: {result.exit_code}")

Source

Typer no longer depends on Click as a third party dependency, it vendors (includes the source code of) Click.

Release notes · Seen in: gpt-6.1-sol · First seen 2026-10-20 · Last verified 2026-10-27 · All corrections for typer

For agents