bug: envvar not working for typer.Options with typer==0.26.0
#1786
-
First Check
Example Codefrom typing import Annotated
import typer
app = typer.Typer()
@app.command("arg")
def from_argument(user: Annotated[str, typer.Argument(envvar="ME")]):
print(f"Hello {user}")
@app.command("opt")
def from_option(user: Annotated[str, typer.Option(envvar="ME")]):
print(f"Hello {user}")
if __name__ == "__main__":
app()DescriptionThe ❯ python tmp.py arg foo
Hello foo
❯ ME=bar python tmp.py arg
Hello bar
❯ python tmp.py opt --user foo
Hello foo
❯ ME=bar python tmp.py opt
Usage: tmp.py opt [OPTIONS]
....With Operating SystemmacOS Operating System DetailsNo response Project Version0.26.0 Python Version3.14 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
Thanks for the report, we'll look into this ASAP. |
Beta Was this translation helpful? Give feedback.
-
|
Issue to track this: #1787 |
Beta Was this translation helpful? Give feedback.
-
|
PR to fix this: #1788 |
Beta Was this translation helpful? Give feedback.
-
|
Fixed in 0.26.1. Thanks again! 🙏 |
Beta Was this translation helpful? Give feedback.
Fixed in 0.26.1. Thanks again! 🙏