Quickstart¶
Install Interfacy:
pip install interfacy
or:
uv add interfacy
Put a typed function in app.py:
from interfacy import Interfacy
def greet(name: str, times: int = 1, excited: bool = False) -> str:
"""
Print a greeting.
Args:
name: Person to greet.
times: Number of greetings.
excited: Use exclamation marks.
"""
mark = "!" if excited else "."
return "\n".join(f"Hello, {name}{mark}" for _ in range(times))
if __name__ == "__main__":
Interfacy(print_result=True).run(greet)
Run it:
$ python app.py Ada --times 2 --excited
Hello, Ada!
Hello, Ada!
Ask for help:
$ python app.py --help
Interfacy uses the function signature as the CLI contract:
nameis required, so it becomes a positional argument.timeshas a default, so it becomes an option.excitedis a boolean, so it becomes a flag.the docstring becomes command and option help.