Repository navigation
Replies: 3 comments
|
Thanks for the report! I'll look into this. |
|
I reproduced this with Typer 0.29.2 on Python 3.14 too. There is a type mismatch in the current path coercion code: for a For the example here, a temporary workaround is to leave from pathlib import Path
from typing import Annotated
import typer
app = typer.Typer()
def path_or_stdin(value: Path) -> Path:
if value != Path("-") and not value.exists():
raise typer.BadParameter(f"path {str(value)!r} does not exist")
return value
@app.command()
def foobar(filename: Annotated[
Path,
typer.Argument(allow_dash=True, callback=path_or_stdin),
]):
print(filename)
if __name__ == "__main__":
app()I checked the three cases with Disclosure: this analysis and example were developed with Codex, then reproduced against the installed Typer version. |
|
@rijenkii : thanks again for the report, and thanks to @Aneesh495 for the analysis! I submitted a PR to fix this bug here: #2029. I'll run it by Tiangolo, but in the meantime please feel free to leave a review on the PR noting whether or not this fixes your issue 🙏 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
First Check
Example Code
Description
Running application with
-as the sole argument results inApplication from the example runs perfectly well if you switch typer version to 0.28.
Operating System
Linux
Operating System Details
No response
Project Version
0.29.1
Python Version
3.14.8
Additional Context
No response
All reactions