{"id":13394781,"url":"https://github.com/google/python-fire","last_synced_at":"2025-05-12T17:48:54.405Z","repository":{"id":37242665,"uuid":"82729529","full_name":"google/python-fire","owner":"google","description":"Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.","archived":false,"fork":false,"pushed_at":"2025-05-01T08:56:46.000Z","size":6223,"stargazers_count":27614,"open_issues_count":159,"forks_count":1450,"subscribers_count":368,"default_branch":"master","last_synced_at":"2025-05-05T15:14:19.873Z","etag":null,"topics":["cli","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google.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}},"created_at":"2017-02-21T21:35:07.000Z","updated_at":"2025-05-05T05:54:47.000Z","dependencies_parsed_at":"2023-11-13T19:54:21.065Z","dependency_job_id":"1a657b8b-a4a0-4bda-a108-6c3c59942ef8","html_url":"https://github.com/google/python-fire","commit_stats":{"total_commits":336,"total_committers":68,"mean_commits":"4.9411764705882355","dds":"0.42261904761904767","last_synced_commit":"6cf45c663075c96b20dd0dfa733c2374545a4ad6"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fpython-fire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fpython-fire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fpython-fire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fpython-fire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google","download_url":"https://codeload.github.com/google/python-fire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252522172,"owners_count":21761685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cli","python"],"created_at":"2024-07-30T17:01:31.353Z","updated_at":"2025-05-12T17:48:54.336Z","avatar_url":"https://github.com/google.png","language":"Python","readme":"# Python Fire [![PyPI](https://img.shields.io/pypi/pyversions/fire.svg?style=plastic)](https://github.com/google/python-fire)\n\n_Python Fire is a library for automatically generating command line interfaces\n(CLIs) from absolutely any Python object._\n\n-   Python Fire is a simple way to create a CLI in Python.\n    [[1]](docs/benefits.md#simple-cli)\n-   Python Fire is a helpful tool for developing and debugging Python code.\n    [[2]](docs/benefits.md#debugging)\n-   Python Fire helps with exploring existing code or turning other people's\n    code into a CLI. [[3]](docs/benefits.md#exploring)\n-   Python Fire makes transitioning between Bash and Python easier.\n    [[4]](docs/benefits.md#bash)\n-   Python Fire makes using a Python REPL easier by setting up the REPL with the\n    modules and variables you'll need already imported and created.\n    [[5]](docs/benefits.md#repl)\n\n## Installation\n\nTo install Python Fire with pip, run: `pip install fire`\n\nTo install Python Fire with conda, run: `conda install fire -c conda-forge`\n\nTo install Python Fire from source, first clone the repository and then run:\n`python setup.py install`\n\n## Basic Usage\n\nYou can call `Fire` on any Python object:\u003cbr\u003e\nfunctions, classes, modules, objects, dictionaries, lists, tuples, etc.\nThey all work!\n\nHere's an example of calling Fire on a function.\n\n```python\nimport fire\n\ndef hello(name=\"World\"):\n  return \"Hello %s!\" % name\n\nif __name__ == '__main__':\n  fire.Fire(hello)\n```\n\nThen, from the command line, you can run:\n\n```bash\npython hello.py  # Hello World!\npython hello.py --name=David  # Hello David!\npython hello.py --help  # Shows usage information.\n```\n\nHere's an example of calling Fire on a class.\n\n```python\nimport fire\n\nclass Calculator(object):\n  \"\"\"A simple calculator class.\"\"\"\n\n  def double(self, number):\n    return 2 * number\n\nif __name__ == '__main__':\n  fire.Fire(Calculator)\n```\n\nThen, from the command line, you can run:\n\n```bash\npython calculator.py double 10  # 20\npython calculator.py double --number=15  # 30\n```\n\nTo learn how Fire behaves on functions, objects, dicts, lists, etc, and to learn\nabout Fire's other features, see the [Using a Fire CLI page](docs/using-cli.md).\n\nFor additional examples, see [The Python Fire Guide](docs/guide.md).\n\n## Why is it called Fire?\n\nWhen you call `Fire`, it fires off (executes) your command.\n\n## Where can I learn more?\n\nPlease see [The Python Fire Guide](docs/guide.md).\n\n## Reference\n\n| Setup   | Command             | Notes\n| :------ | :------------------ | :---------\n| install | `pip install fire`  |\n\n| Creating a CLI | Command                | Notes\n| :--------------| :--------------------- | :---------\n| import         | `import fire`          |\n| Call           | `fire.Fire()`          | Turns the current module into a Fire CLI.\n| Call           | `fire.Fire(component)` | Turns `component` into a Fire CLI.\n\n| Using a CLI                                     | Command                                 | Notes\n| :---------------------------------------------- | :-------------------------------------- | :----\n| [Help](docs/using-cli.md#help-flag)             | `command --help` or `command -- --help` |\n| [REPL](docs/using-cli.md#interactive-flag)      | `command -- --interactive`              | Enters interactive mode.\n| [Separator](docs/using-cli.md#separator-flag)   | `command -- --separator=X`              | Sets the separator to `X`. The default separator is `-`.\n| [Completion](docs/using-cli.md#completion-flag) | `command -- --completion [shell]`       | Generates a completion script for the CLI.\n| [Trace](docs/using-cli.md#trace-flag)           | `command -- --trace`                    | Gets a Fire trace for the command.\n| [Verbose](docs/using-cli.md#verbose-flag)       | `command -- --verbose`                  |\n\n_Note that these flags are separated from the Fire command by an isolated `--`._\n\n## License\n\nLicensed under the\n[Apache 2.0](https://github.com/google/python-fire/blob/master/LICENSE) License.\n\n## Disclaimer\n\nThis is not an official Google product.\n","funding_links":[],"categories":["Python","Command-line Tools","Python Frameworks and Tools","资源列表","Command-line Interface Development","cli","CLI Development","Desktop App Development","命令行界面开发","Python Frameworks, Libraries, and Tools","CLI Tools","Resources","Uncategorized","语言资源库","Python 程序","Misc","命令行工具","Software","Tools","Python Learning Resources","Command-line Interface Development [🔝](#readme)","Awesome Python","[Python](https://www.python.org/)","开发工具\u0026框架","Python Hacks","Python 🐍"],"sub_categories":["命令行工具","Development","In-memory data grids","Python Toolkit","Uncategorized","Interfaces","python","网络服务_其他","Command Line Tools","E-Books","VS Code Extensions for Developer Productivity","Objective-C Tools, Libraries, and Frameworks","viii. Linear Regression","Mesh networks","JavaScript Libraries for Machine Learning","包","Command-line Tools","Useful awesome list for Go cli"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fpython-fire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle%2Fpython-fire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fpython-fire/lists"}