https://github.com/br3ndonland/template-python
Template repository for Python projects
https://github.com/br3ndonland/template-python
boilerplate github pre-commit prettier python template-project template-repository templates
Last synced: 6 months ago
JSON representation
Template repository for Python projects
- Host: GitHub
- URL: https://github.com/br3ndonland/template-python
- Owner: br3ndonland
- License: mit
- Created: 2019-06-15T18:49:29.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-06-20T23:28:41.000Z (7 months ago)
- Last Synced: 2025-06-21T00:26:56.507Z (7 months ago)
- Topics: boilerplate, github, pre-commit, prettier, python, template-project, template-repository, templates
- Language: Python
- Homepage:
- Size: 405 KB
- Stars: 34
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Python template repository
[](https://github.com/br3ndonland/template-python/actions/workflows/ci.yml)
[](https://github.com/astral-sh/ruff)
Brendon Smith ([br3ndonland](https://github.com/br3ndonland))
## Description
**Welcome!** This is a template repository for Python projects, engineered for use as a [GitHub template repository](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template). To use the template, click on "Use this template" or browse to [template-python/generate](https://github.com/br3ndonland/template-python/generate). GitHub will create a new repository without the commit history from this one.
The `template-python` repo name can be replaced with a one-line terminal command: `git grep -l 'template-python' | xargs sed -i '' 's/template-python/repo-name/g'` (replace `repo-name` with the name of the repository you generate). There may also be a few edits to the _pyproject.toml_ needed. See the [quickstart](#quickstart) section for more.
Another common approach, especially for Python, is to use [cookiecutter](https://github.com/cookiecutter/cookiecutter). In a cookiecutter repo, the developer adds template variables throughout, like `{{cookiecutter.repo_name}}`. When a user runs `cookiecutter` using the template repository, the template variables are replaced with the information the user provides. This repo is simple enough that I haven't needed to add cookiecutter yet.
[Copier](https://copier.readthedocs.io/en/stable/) and [PyScaffold](https://pyscaffold.org/en/stable/) are similar to cookiecutter, with some additional benefits. I may consider updating this repo for Copier or PyScaffold.
## Quickstart
[Install Hatch](https://hatch.pypa.io/latest/install/), rename the project, then install the project:
```sh
❯ cd path/to/repo
# Replace instances of template-python with new repo name
# In the command below, use your repo name instead of 'repo-name'
❯ git grep -l 'template-python' | xargs sed -i '' 's|template-python|repo-name|g'
❯ git grep -l 'template_python' | xargs sed -i '' 's|template_python|repo-name|g'
# Try running the tests
❯ hatch run coverage run
```
## Further information
See [CONTRIBUTING.md](.github/CONTRIBUTING.md).