Skip to content

Interfacy is a library for automatically generating CLI applications from Python functions, methods, classes, or instances

License

Notifications You must be signed in to change notification settings

zigai/interfacy

Repository files navigation

Interfacy

PyPI version Supported versions Downloads license

Interfacy is a library for automatically generating CLI applications from Python functions, methods, classes, or instances using their type annotations and docstrings.

Features

  • CLI generation from functions, methods, classes, or instances.
  • Argument type inference from annotations.
  • Required parameters as positionals or flags.
  • Subcommands with optional aliases.
  • Multiple help text themes.
  • Stdin piping support.
  • Optional tab completion via argcomplete.
  • Support for user-defined type parsers.

Installation

From PyPI

pip install interfacy
uv add interfacy

From Source

pip install git+https://github.com/zigai/interfacy.git
uv add "git+https://github.com/zigai/interfacy.git"

Example

def greet(name: str, times: int = 1) -> None:
    for _ in range(times):
        print(f"Hello, {name}!")

if __name__ == "__main__":
    from interfacy import Argparser
    Argparser(print_result=True).run(greet)

License

MIT License

About

Interfacy is a library for automatically generating CLI applications from Python functions, methods, classes, or instances

Topics

Resources

License

Contributing

Stars

Watchers

Forks