Skip to content

Usage

Prerequisites

Warning

Follow the installation instructions before proceeding.

Overview

  1. Create an issue for the task.
  2. Create a new branch (<issue-number> or similar).
  3. (Optional) Add dependencies to pyproject.toml.
  4. Write code in /src/<project_name> and tests in /tests.
  5. Use git add, git commit (following semver ⧉), and git push.
  6. pre-commit will guide you through the process.
  7. Create a pull request (following semver ⧉).
  8. Wait for CI checks and code review approval.

Tip

See CONTRIBUTING.md for details.

Git workflow

opentemplate follows an extended GitHub Flow ⧉:

  1. Create or pick up an issue (task tracker).
  2. Create a branch (<issue-number> or similar) to track changes.
  3. Push your changes to the remote repository.
  4. Open a pull request (PR title should follow semver ⧉, e.g., feat: add feature, fix: bugfix).

The main branch is protected and should always be in a releasable state.

Note

If a PR has a few commits, its type should match the most significant one (feat! > fix! > feat > fix).

Tip

The GitHub CLI ⧉ simplifies this process. A future extension will streamline it further.

Programming

Source code

Place project source code in src/<project_name> or at least src (e.g., src/infrastructure). Some exceptions apply (e.g., Dockerfile, Makefile).

Note

Before every commit and push pre-commit will run checks ensuring code quality and style.

Tests

Tests should be in /tests. The default framework is pytest, but you can change it in dev-test section inside pyproject.toml.

Key considerations:

Note

opentemplate does not enforce a specific testing methodology (e.g., TDD, BDD).

Commits

opentemplate follows simplified semver ⧉:

  • Allowed types: fix, feat, BREAKING CHANGE.
  • No scopes (e.g., feat(actions): ... is incorrect).

Commits should be:

Pull requests

Pull request type is determined by the most significant type of commit:

  • BREAKING CHANGE > feat > fix.
  • Pull requests will be labeled automatically with scopes (additional labels may be added manually).

Warning

Predefined labels exist; avoid creating new ones unless necessary.

Each pull request undergoes CI testing (similar to local tests). Depending on repository type and security settings, up to two reviewers may be required (as defined during installation).

Code sources

  • pyproject.toml
  • .pre-commit-config.yaml
  • .github/pr-labeler.yml
  • /.github/workflows/template_setup.yml
  • .github/workflows/python-tests.yml