{"id":15436323,"url":"https://github.com/zigai/interfacy","last_synced_at":"2026-05-08T20:01:31.369Z","repository":{"id":169355027,"uuid":"471082778","full_name":"zigai/interfacy","owner":"zigai","description":"Framework for building command-line interfaces from Python functions, classes, and class instances","archived":false,"fork":false,"pushed_at":"2026-04-16T10:02:42.000Z","size":1185,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-16T12:13:05.503Z","etag":null,"topics":["argparse","argparse-alternative","argument-parser","cli","cli-framework","interfacy","python","python3","type-hints"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zigai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-03-17T17:39:32.000Z","updated_at":"2026-04-16T10:02:45.000Z","dependencies_parsed_at":"2025-01-16T15:49:43.947Z","dependency_job_id":"bb7d8869-473a-4676-a6c5-61d0a8a42abf","html_url":"https://github.com/zigai/interfacy","commit_stats":{"total_commits":153,"total_committers":3,"mean_commits":51.0,"dds":"0.019607843137254943","last_synced_commit":"41e06a6bd1d7de49667824b8c74b0eeb7ada46b7"},"previous_names":["zigai/interfacy-cli","zigai/interfacy"],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/zigai/interfacy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zigai%2Finterfacy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zigai%2Finterfacy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zigai%2Finterfacy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zigai%2Finterfacy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zigai","download_url":"https://codeload.github.com/zigai/interfacy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zigai%2Finterfacy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32795416,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["argparse","argparse-alternative","argument-parser","cli","cli-framework","interfacy","python","python3","type-hints"],"created_at":"2024-10-01T18:49:55.320Z","updated_at":"2026-05-08T20:01:31.363Z","avatar_url":"https://github.com/zigai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Interfacy\n\n[![Tests](https://github.com/zigai/interfacy/actions/workflows/tests.yml/badge.svg)](https://github.com/zigai/interfacy/actions/workflows/tests.yml)\n[![PyPI version](https://badge.fury.io/py/interfacy.svg)](https://badge.fury.io/py/interfacy)\n![Supported versions](https://img.shields.io/badge/python-3.10+-blue.svg)\n[![Downloads](https://static.pepy.tech/badge/interfacy)](https://pepy.tech/project/interfacy)\n[![license](https://img.shields.io/github/license/zigai/interfacy.svg)](https://github.com/zigai/interfacy/blob/main/LICENSE)\n\nInterfacy is a CLI framework that turns Python functions, classes, and class instances into command-line interfaces. It derives the CLI from signatures, type annotations, and docstrings instead of making you define it twice.\n\n## Features\n\n- Generate CLIs from functions, classes, class methods, and class instances.\n- Nested subcommands and manual command groups with aliases.\n- Type-driven parsing from annotations, with support for custom parsers.\n- Model expansion for dataclasses, Pydantic models, and plain classes.\n- `--help` text generated from docstrings.\n- Highly customizable help output with multiple layouts, color themes, and configurable ordering.\n- Stdin piping support with configurable routing to parameters.\n- Optional tab completion via `argcomplete`.\n\n## Installation\n\n### From PyPI\n\n```bash\npip install interfacy\n```\n\n```bash\nuv add interfacy\n```\n\n### From source\n\n```bash\npip install git+https://github.com/zigai/interfacy.git\n```\n\n```bash\nuv add \"git+https://github.com/zigai/interfacy.git\"\n```\n\n## Quick Start\n\n```python\nfrom interfacy import Interfacy\n\ndef greet(name: str, times: int = 1) -\u003e None:\n    \"\"\"Print a greeting.\"\"\"\n    print(\" \".join([f\"Hello, {name}!\" for _ in range(times)]))\n\nif __name__ == \"__main__\":\n    Interfacy().run(greet)\n```\n\n```text\n$ python app.py Ada\nHello, Ada!\n\n$ python app.py Ada --times 2\nHello, Ada! Hello, Ada!\n```\n\nBy default, required non-boolean parameters become positional arguments and optional parameters become flags.\n\n## Class-Based Commands\n\nClasses become command namespaces. `__init__` parameters live at the command level and public methods become subcommands.\n\n```python\nfrom interfacy import Interfacy\n\nclass Calculator:\n    def __init__(self, precision: int = 2) -\u003e None:\n        self.precision = precision\n\n    def add(self, a: float, b: float) -\u003e float:\n        return round(a + b, self.precision)\n\n    def mul(self, a: float, b: float) -\u003e float:\n        return round(a * b, self.precision)\n\nif __name__ == \"__main__\":\n    Interfacy(print_result=True).run(Calculator)\n```\n\n```text\n$ python app.py --precision 3 add 1.2345 2.3445\n3.579\n```\n\n## Structured Parameters\n\nDataclasses, Pydantic models, and plain classes with typed `__init__` parameters can be expanded into nested flags and reconstructed before execution.\n\n```python\nfrom dataclasses import dataclass\nfrom interfacy import Interfacy\n\n@dataclass\nclass Address:\n    city: str\n    postal_code: int\n\n@dataclass\nclass User:\n    name: str\n    age: int\n    address: Address | None = None\n\ndef greet(user: User) -\u003e str:\n    return f\"Hello {user.name}, age {user.age}\"\n\nif __name__ == \"__main__\":\n    Interfacy(print_result=True).run(greet)\n```\n\n```text\n$ python app.py --user.name Ada --user.age 32\nHello Ada, age 32\n```\n\n## Manual Groups\n\nUse `CommandGroup` when your command tree is not naturally rooted in one callable:\n\n```python\nfrom interfacy import CommandGroup, Interfacy\n\ndef clone(url: str) -\u003e str:\n    return f\"clone:{url}\"\n\nclass Releases:\n    def cut(self, version: str) -\u003e str:\n        return f\"cut:{version}\"\n\nops = CommandGroup(\"ops\", description=\"Operational commands\")\nops.add_command(clone)\nops.add_command(Releases)\n\nif __name__ == \"__main__\":\n    Interfacy(print_result=True).run(ops)\n```\n\n## Interfacy CLI Entrypoint\n\nInterfacy also ships a CLI that can run an existing function, class, or class instance directly from a module or Python file:\n\n```text\n$ interfacy app.py:greet Ada\n$ interfacy app.py:greet --help\n$ interfacy package.cli:Calculator add 1 2\n```\n\nThe entrypoint supports configuration via TOML, loaded from `~/.config/interfacy/config.toml` or `INTERFACY_CONFIG`.\n\n```text\nusage: interfacy [--help] [--version] [--config-paths] [TARGET] ...\n\nInterfacy is a framework for building CLIs from Python callables.\n\npositional arguments:\n  TARGET                      Python file or module with a function/class/instance symbol (e.g. main.py:main, pkg.cli:App, pkg.cli:service).\n  ARGS                        Arguments passed through to the target command.\n\noptions:\n  --help                      show this help message and exit\n  --version                   show version and exit.\n  --config-paths              print config file search paths and exit.\n\nUse 'interfacy TARGET --help' to display the help text for the target.\n```\n\n## Backend Selection\n\n`Interfacy` uses the argparse backend by default. To use the Click backend,\ninstall the optional dependency and pass `backend=\"click\"`:\n\n```bash\npip install \"interfacy[click]\"\n```\n\n```python\nfrom interfacy import Interfacy\n\nInterfacy(backend=\"click\", print_result=True).run(greet)\n```\n## License\n\n[MIT License](https://github.com/zigai/interfacy/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzigai%2Finterfacy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzigai%2Finterfacy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzigai%2Finterfacy/lists"}