{"id":13468833,"url":"https://github.com/simonw/click-app","last_synced_at":"2025-05-16T10:08:17.775Z","repository":{"id":36954901,"uuid":"274259829","full_name":"simonw/click-app","owner":"simonw","description":"Cookiecutter template for creating new Click command-line tools","archived":false,"fork":false,"pushed_at":"2025-04-10T22:47:47.000Z","size":49,"stargazers_count":325,"open_issues_count":1,"forks_count":34,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-12T15:57:20.726Z","etag":null,"topics":["click","cookiecutter-template"],"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/simonw.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,"zenodo":null},"funding":{"github":"simonw"}},"created_at":"2020-06-22T23:01:33.000Z","updated_at":"2025-04-10T22:47:50.000Z","dependencies_parsed_at":"2024-11-12T18:02:40.574Z","dependency_job_id":"a259bb0d-3d98-4d55-9404-af49a8b817ce","html_url":"https://github.com/simonw/click-app","commit_stats":{"total_commits":44,"total_committers":4,"mean_commits":11.0,"dds":0.06818181818181823,"last_synced_commit":"2ed1748ce8b7bc50bce88d3ce779d995e4113328"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fclick-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fclick-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fclick-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fclick-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonw","download_url":"https://codeload.github.com/simonw/click-app/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509477,"owners_count":22082892,"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":["click","cookiecutter-template"],"created_at":"2024-07-31T15:01:19.989Z","updated_at":"2025-05-16T10:08:12.751Z","avatar_url":"https://github.com/simonw.png","language":"Python","funding_links":["https://github.com/sponsors/simonw"],"categories":["Python","CLI","Python Packages and CLI"],"sub_categories":["Table of Content","Cookiecutter Templates"],"readme":"# click-app cookiecutter template\n\nCookiecutter template for creating new [Click](https://click.palletsprojects.com/) command-line tools.\n\nUse this template on your own machine with cookiecutter, or create a brand new repository based on this template entirely through the GitHub web interface using [click-app-template-repository](https://github.com/simonw/click-app-template-repository).\n\n## Installation\n\nYou'll need to have [cookiecutter](https://cookiecutter.readthedocs.io/) installed. I recommend pipx for this:\n```bash\npipx install cookiecutter\n```\nRegular `pip` will work OK too.\n\n## Examples\n\nThree examples of tools that were initially created using this template:\n\n- [shot-scraper](https://github.com/simonw/shot-scraper): A comand-line utility for taking automated screenshots of websites\n- [s3-credentials](https://github.com/simonw/s3-credentials): A tool for creating credentials for accessing S3 buckets\n- [git-history](https://github.com/simonw/git-history):  Tools for analyzing Git history using SQLite\n\n## Usage\n\nRun `cookiecutter gh:simonw/click-app` and then answer the prompts. Here's an example run:\n```\n$ cookiecutter gh:simonw/click-app\napp_name []: click app template demo\ndescription []: Demonstrating https://github.com/simonw/click-app\nhyphenated [click-app-template-demo]:\nunderscored [click_app_template_demo]:\ngithub_username []: simonw\nauthor_name []: Simon Willison\n```\nI strongly recommend accepting the suggested value for \"hyphenated\" and \"underscored\" by hitting enter on those prompts.\n\nThis will create a directory called `click-app-template-demo` - the tool name you enter is converted to lowercase and uses hyphens instead of spaces.\n\nSee https://github.com/simonw/click-app-template-demo for the output of this example.\n\n## Developing your command-line tool\n\nHaving created the new structure from the template, here's how to start working on the tool.\n\nIf your tool is called `my-new-tool`, you can start working on it like so:\n```bash\ncd my-new-tool\n# Create and activate a virtual environment:\npython -m venv venv\nsource venv/bin/activate\n# Install dependencies so you can edit the project:\npip install -e '.[test]'\n# With zsh you have to run this again for some reason:\nsource venv/bin/activate\n# Confirm your tool can be run from the command-line\nmy-new-tool --version\n```\nYou should see the following:\n```bash\nmy-new-tool, version 0.1\n```\nYou can run the default test for your tool like so:\n```bash\npython -m pytest\n```\nThis will execute the test in `tests/test_my_new_tool.py`.\n\nNow you can open the `my_new_tool/cli.py` file and start adding Click [commands and groups](https://click.palletsprojects.com/en/7.x/commands/).\n\n## Creating a Git repository for your tool\n\nYou can initialize a Git repository for your tool like this:\n```bash\ncd my-new-tool\ngit init\ngit add .\ngit commit -m \"Initial structure from template\"\n# Rename the 'master' branch to 'main':\ngit branch -m master main\n```\n## Publishing your tool to GitHub\n\nUse https://github.com/new to create a new GitHub repository sharing the same name as your tool, which should be something like `my-new-tool`.\n\nPush your `main` branch to GitHub like this:\n```bash\ngit remote add origin git@github.com:YOURNAME/my-new-tool.git\ngit push -u origin main\n```\nThe template will have created a GitHub Action which runs your tool's test suite against every commit.\n\n## Publishing your tool as a package to PyPI\n\nThe template also includes a `publish.yml` GitHub Actions workflow for publishing packages to [PyPI](https://pypi.org/), using [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish).\n\nTo use this action, you need to create a PyPI account and [configure a Trusted Publisher](https://til.simonwillison.net/pypi/pypi-releases-from-github) for this package.\n\nOnce you have created your account, navigate to https://pypi.org/manage/account/publishing/ and create a \"pending publisher\" for the package. Use the following values:\n\n- **PyPI Project Name:** The name of your package\n- **Owner:** Your GitHub username or organization - the \"foo\" in `github.com/foo/bar`\n- **Repsitory name:** The name of your repository - the \"bar\" in `github.com/foo/bar`\n- **Workflow name:** `publish.yml`\n- **Environment name:** `release`\n\nNow, any time you create a new \"Release\" on GitHub the Action will build your package and push it to PyPI.\n\nThe tag for your release needs to match the `VERSION` string at the top of your `pyproject.toml` file. You should bump this version any time you release a new version of your package.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fclick-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonw%2Fclick-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fclick-app/lists"}