-
-
Notifications
You must be signed in to change notification settings - Fork 793
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Optional multi-value option returns empty tuple instead of None.
To Reproduce
- Create a file
main.pywith:
from typing import List, Optional
import typer
app = typer.Typer()
@app.command()
def main(jobs: Optional[List[str]] = None): # or `typer.Option(None)`
print(jobs)
if __name__ == "__main__":
app()- Call it with:
python main.py- It outputs:
()
- But I expected it to output:
None
Expected behavior
The expected behavior for an empty parameter annotated with Optional and = None is both documented and commonly known - it should be just None. And that's also how it works in Typer, but for some reason - only for single-value options.
Environment
- OS: macOS
- Typer version: 0.3.2
- Python version: 3.8.5
daniel-wer, abuckenheimer, prem-nuro, JimMadge, juliojesusvizcaino and 2 more
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working