Skip to content

opentemplate

Features

opentemplate is a Python template with the following features:

Quick start

Installation

Note

Install pdm ⧉ (if you don't have it already), for Linux/MacOS:

curl -sSL https://pdm-project.org/install-pdm.py | python3 -
  1. Create a new GitHub repository using this template (green Use this template button)
  2. Name your repo (use underscore _, not hyphens -)
  3. Add project description (necessary!)
  4. Wait until the setup commit appears (performed by github-actions[bot], it may take a few minutes)
  5. Clone the repository
  6. Run pdm setup command locally to setup development environment

Important

For more details read the documentation ⧉

Usage

  1. Create a new branch
  2. Optionally add dependencies to pyproject.toml
  3. Write code in /src/<project_name> and tests in /tests
  4. Use git add, git commit and git push your changes
  5. pre-commit will guide you through the process

Important

For more details read the documentation ⧉

Examples

Run checkers or fixers manually (click me)  
> pdm check-<group> # pdm fix-<group>
Note that all `check` and `fix` commands are grouped for your convenience:
> pdm check-all # pdm fix-all
Adjust template (click me)   > Most of the adjustments can be done by __only__ editing `pyproject.toml` Common changes to `pyproject.toml`: - Add dev dependencies under `[dependency-groups]` (everything is named `dev-`) - Modify `[tool.pdm.scripts]` for custom command (`check-` or `fix-`, the latter modifies files) - Use `[tool.]` to adjust specific tool configuration > __Adjusting these sections will affect `pre-commit` and `GitHub Actions`__
Disable some pre-commit check (click me)   > Disabling checks should be done cautiously! `pre-commit` checks are defined in `.pre-commit-config.yaml`. Disable a check using `SKIP` environment variable:
SKIP='<group1>,<group2>` git commit -m <message>
For details, refer to the `id` fields in `.pre-commit-config.yaml`. > Some commands have both `-fix` and `-check` > for different actions!