{"id":15710928,"url":"https://github.com/yaythomas/python-cli-pypa-build-example","last_synced_at":"2025-05-12T21:21:04.238Z","repository":{"id":167066612,"uuid":"400218933","full_name":"yaythomas/python-cli-pypa-build-example","owner":"yaythomas","description":"Example of how to create \u0026 package a Python CLI application using the PyPA build tool.","archived":false,"fork":false,"pushed_at":"2021-08-26T16:12:22.000Z","size":8,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T03:41:31.883Z","etag":null,"topics":["build","cli","packaging","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yaythomas.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-08-26T15:32:10.000Z","updated_at":"2024-09-12T12:32:25.000Z","dependencies_parsed_at":"2024-03-08T13:51:02.335Z","dependency_job_id":null,"html_url":"https://github.com/yaythomas/python-cli-pypa-build-example","commit_stats":null,"previous_names":["yaythomas/python-cli-pypa-build-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaythomas%2Fpython-cli-pypa-build-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaythomas%2Fpython-cli-pypa-build-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaythomas%2Fpython-cli-pypa-build-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaythomas%2Fpython-cli-pypa-build-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yaythomas","download_url":"https://codeload.github.com/yaythomas/python-cli-pypa-build-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253823699,"owners_count":21969890,"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":["build","cli","packaging","python"],"created_at":"2024-10-03T21:10:46.850Z","updated_at":"2025-05-12T21:21:04.217Z","avatar_url":"https://github.com/yaythomas.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Use PyPA build to create Python CLI applications\nThis repo is a deliberately simple example of how to create \u0026 package Python CLI\napplications using the [PyPA setuptools build\ntool](https://setuptools.readthedocs.io/).\n\n## how to create a CLI package with Python\nSample code that we're going to deploy is in `mypackage/mymodule.py`.\n\nThe configuration telling the build tool what to package is in `setup.cfg`.\n\nTo create a package, do the following:\n\n```console\n# create a venv for build \u0026 packaging tools\n$ python3 -m venv .env/build\n\n# activate the venv\n$ . .env/build/bin/activate\n\n# install the setuptools build tool to the new environment\n$ pip install build\n\n# run build on the current directory\n$ python -m build\n\n# previous step will create a .tar.gaz \u0026 a .whl in ./dist\n$ ls ./dist\nmypackage-0.0.5-py3-none-any.whl\nmypackage-0.0.5.tar.gz\n```\n\n## How to test deploying your Python package\nTo deploy your packaged CLI application, do the following:\n\n```console\n# create a fresh clean venv to test deployment\n$ python3 -m venv .env/deploy\n\n# activate the venv\n$ . .env/deploy/bin/activate\n\n# install the wheel we built using pip\n$ pip install dist/mypackage-0.0.5-py3-none-any.whl\n\n# the CLI entrypoints listed in setup.cfg are now in .env the /bin dir\n$ ls .env/deploy/bin\nmy-application\nanother-application\n\n# you can run your freshly deployed CLI app\n$ my-application\nhello from my_function\n\n$ another-application\nhello from another_function\n```\n\nYou specify the names your app deploy as - `my-application` and\n`another-application` - in `setup.cfg`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaythomas%2Fpython-cli-pypa-build-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyaythomas%2Fpython-cli-pypa-build-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaythomas%2Fpython-cli-pypa-build-example/lists"}