The same way as with typer.Argument(), the old style of using the function parameter default value is also supported, in that case you would just not pass anything to the default parameter.
That will tell Typer that it's still a CLI option, but it doesn't have a default value, and it's required.
Tip
Again, prefer to use the Annotated version if possible. That way your code will mean the same in standard Python and in Typer.
And test it:
fast →💬 Pass the NAME CLI argumentpython main.py Camila 💬 We didn't pass the now required --lastname CLI optionUsage: main.py [OPTIONS] NAME Try "main.py --help" for help.
Error: Missing option '--lastname'.
💬 Now update it to pass the required --lastname CLI optionpython main.py Camila --lastname Gutiérrez Hello Camila Gutiérrez
💬 And if you check the helppython main.py --help Usage: main.py [OPTIONS] NAME
Options: --lastname TEXT [required] --help Show this message and exit.
💬 It now tells you that --lastname is required 🎉 restart ↻