Repository template to bootstrap a Python project.
- Installs the expected Python version under
.venv/. - Installs Python dependencies also under
.venv/. - Pins dependency versions in
poetry.lock. - Provides default template for pull requests.
- Checks for syntax and format on pull requests.
- Runs tests on pull requests.
- Pushes documentation to GitHub pages also when creating tags.
- Includes settings for editors and some specifically for VSCode.
To create the repository for a new project:
- On GitHub, navigate to the main page of this repository.
- Above the file list, click Use this template.
- Select Create a new repository.
- Follow the usual steps.
In GitHub -> Settings:
- General:
- Uncheck
Wikis - Uncheck
Projects - Check
Automatically delete head branches
- Uncheck
- Branch protection rules:
- Branch name pattern:
main - Check
Require a pull request before merging - Check
Require review from Code Owners - Check
Require status checks to pass before merging - Click on
Create
- Branch name pattern:
- Another branch protection rules:
- Branch name pattern:
gh-pages - Check
Allow force pushes - Click on
Create
- Branch name pattern:
- Create branch named
gh-pages.
In the source:
- Rewrite this
README.rst. - Update the
LICENSE.rst. - Replace "changeme" with your project details in:
docs/api.rstdocs/conf.pydocs/modules.rstpyproject.tomlCONTRIBUTING.rst
- Rename the directory "changeme" with your project name.
make setupto setup the Python environment withcondaand install the poetry environment.make checkto check syntax and formatting.make testto run tests.make docsto build documentation - requires first runningpoetry install --with docs.poetry add [package]to install[package]in.venv/, add it inpyproject.tomland pin its version inpoetry.lock.
In the new repository, add the remote template repository - only needs to be done once:
> git remote add template https://github.com/cr3/python-template.git
Fetch the latest changes and review the log:
> git fetch template > git log template/main ...
Cherry pick each revision from the above log command:
> git cherry-pick [revno]