{"id":16222677,"url":"https://github.com/claymcleod/psme","last_synced_at":"2025-04-08T01:40:47.469Z","repository":{"id":149183114,"uuid":"433240036","full_name":"claymcleod/psme","owner":"claymcleod","description":"Python subcommands made easy.","archived":false,"fork":false,"pushed_at":"2021-11-30T00:45:24.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T01:45:14.801Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/claymcleod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2021-11-30T00:26:10.000Z","updated_at":"2021-11-30T00:45:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"0d6807e4-4b6d-4649-a0d4-19fda93f655b","html_url":"https://github.com/claymcleod/psme","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claymcleod%2Fpsme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claymcleod%2Fpsme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claymcleod%2Fpsme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claymcleod%2Fpsme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/claymcleod","download_url":"https://codeload.github.com/claymcleod/psme/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247761051,"owners_count":20991533,"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":[],"created_at":"2024-10-10T12:14:54.647Z","updated_at":"2025-04-08T01:40:47.441Z","avatar_url":"https://github.com/claymcleod.png","language":"Python","readme":"\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003e\n    psme\n  \u003c/h1\u003e\n\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/claymcleod/psme/actions/workflows/CI.yml\" target=\"_blank\"\u003e\n      \u003cimg alt=\"Actions: CI Status\"\n          src=\"https://github.com/claymcleod/psme/actions/workflows/CI.yml/badge.svg\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/psme/\" target=\"_blank\"\u003e\n      \u003cimg alt=\"PyPI\"\n          src=\"https://img.shields.io/pypi/v/psme?color=orange\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/psme/\" target=\"_blank\"\u003e\n      \u003cimg alt=\"PyPI: Downloads\"\n          src=\"https://img.shields.io/pypi/dm/psme?color=orange\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/claymcleod/psme\" target=\"_blank\"\u003e\n      \u003cimg alt=\"Code Coverage\"\n          src=\"https://codecov.io/gh/claymcleod/psme/branch/main/graph/badge.svg\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/claymcleod/psme/blob/main/LICENSE.md\" target=\"_blank\"\u003e\n    \u003cimg alt=\"License: MIT\"\n          src=\"https://img.shields.io/badge/License-MIT-blue.svg\" /\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\n\n  \u003cp align=\"center\"\u003e\n    Python subcommands made easy.\n    \u003cbr /\u003e\n    \u003c!-- \u003ca href=\"https://claymcleod.github.io/psme/\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e --\u003e\n    \u003ca href=\"https://github.com/claymcleod/psme-example\"\u003e\u003cstrong\u003eSee the example »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/claymcleod/psme/issues/new?assignees=\u0026labels=\u0026template=feature_request.md\u0026title=Descriptive%20Title\u0026labels=enhancement\"\u003eRequest Feature\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/claymcleod/psme/issues/new?assignees=\u0026labels=\u0026template=bug_report.md\u0026title=Descriptive%20Title\u0026labels=bug\"\u003eReport Bug\u003c/a\u003e\n    ·\n    ⭐ Consider starring the repo! ⭐\n    \u003cbr /\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n## 🎨 Features\n\n\n* \u003cb\u003eProject Structure.\u003c/b\u003e Salient project structure to build small to large command line applications with many subcommands.\n* \u003cb\u003eEasy to understand and implement.\u003c/b\u003e Best practices for implementing subcommands for free (almost!). \n\n## 📚 Getting Started\n\n### Installation\n\n#### Python Package Index\n\nIf you're using [poetry] (recommended), you can easily add `psme` as a dependency to your command line application.\n\n```bash\npoetry add psme\n```\n\nYou can also install `psme` using the Python Package Index ([PyPI](https://pypi.org/)).\n\n```bash\npip install psme\n```\n\n## 🚌 A Quick Tour\n\nAt its foundation, `psme` is meant to make it easy to design and implement command line tools with multiple subcommands. Commonly, you will want to use it to create multiple subcommands and run the command line engine to distinguish between them and run the correct one.\n\n\u003c!-- If you're interested in a complete overview of psme's capabilities, please see [**the documentation pages**](https://claymcleod.github.io/psme/)\u003c/a\u003e. --\u003e\n\nIn your main package, you can do something like the following:\n\n```python\nfrom psme.engine import Engine\nfrom .subcommands.add import Add\n\ne = Engine('psme-example', [Add()],\n\t\tdescription=\"Python subcommands made easy tutorial.\")\ne.run()\n```\n\nAssuming you have a directory in your Python package for subcommands, and `Add` subcommand may look like this:\n\n```python\nfrom psme.subcommand import BaseSubcommand\n\nclass Add(BaseSubcommand):\n\tdef name(self):\n\t\treturn \"add\"\n\n\tdef register_args(self, subparser):\n\t\tsubparser.add_argument(\"operand_one\", type=int, help=\"First operand to add together.\")\n\t\tsubparser.add_argument(\"operand_two\", type=int, help=\"Second operand to add together.\")\n\n\tdef run(self, args):\n\t\tprint(f\"{args.get('operand_one')} + {args.get('operand_two')} = {args.get('operand_one') + args.get('operand_two')}\")\n```\n\nFor more information, please see [the example application](https://github.com/claymcleod/psme-example).\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome!\u003cbr /\u003eFeel free to check [issues page](https://github.com/claymcleod/psme/issues). Please ensure you fill out the entire template for each of these. You can also take a look at the [contributing guide][contributing-md].\n\n## 📝 License\n\nCopyright © 2021 Clay McLeod. This project is [MIT][license-md] licensed.\n\n[poetry]: https://python-poetry.org/\n[contributing-md]: https://github.com/claymcleod/psme/blob/main/CONTRIBUTING.md\n[license-md]: https://github.com/claymcleod/psme/blob/main/LICENSE.md","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclaymcleod%2Fpsme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclaymcleod%2Fpsme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclaymcleod%2Fpsme/lists"}