From 26d076679058d44cde0fd9eda8fadb629c05a349 Mon Sep 17 00:00:00 2001 From: curt-park Date: Sat, 8 Nov 2025 14:55:50 +0900 Subject: [PATCH 1/4] Fix: simplify the test structure --- tests/{utest => }/test_dummy.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/{utest => }/test_dummy.py (100%) diff --git a/tests/utest/test_dummy.py b/tests/test_dummy.py similarity index 100% rename from tests/utest/test_dummy.py rename to tests/test_dummy.py From 8022f31715ed5d4424359a8fdeb2c9a13fdc2e48 Mon Sep 17 00:00:00 2001 From: curt-park Date: Sat, 8 Nov 2025 15:00:23 +0900 Subject: [PATCH 2/4] Add more description in README --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 64be519..77443bd 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ A template project for quickly starting Python projects with modern development ## Overview This template provides a modern Python development environment with the following features: -- **Python 3.12+** support - **Ruff** for code formatting and linting (replaces Black, isort, flake8) - **pytest** for unit testing and coverage reporting - **uv** for fast dependency management @@ -18,6 +17,8 @@ python-project-template/ ├── src/ # Source code ├── tests/ # Test code ├── .github/ # GitHub Actions workflows +├── .cursorrules # Cursor IDE AI assistant rules and guidelines +├── .mise.toml # mise tool version manager configuration (Python and tool versions) ├── pyproject.toml # Project configuration and dependencies ├── Makefile # Development commands └── logging.conf # Logging configuration @@ -47,4 +48,7 @@ $ make test # run unit tests - Branch name pattern: `main` - Require a pull request before merging & Require approvals - Require status checks to pass before merging & Require branches to be up to date before merging -- Include administrators \ No newline at end of file +- Include administrators + +## NOTE +- The python version should be aligned in `pyproject.toml` and `.mise.toml`. \ No newline at end of file From bfc4075164986955754c8577b420e3af42f39300 Mon Sep 17 00:00:00 2001 From: curt-park Date: Sat, 8 Nov 2025 15:14:33 +0900 Subject: [PATCH 3/4] Add release-please --- .github/workflows/check-pr-title.yml | 13 ++++++++++--- .github/workflows/release-please.yml | 23 +++++++++++++++++++++++ README.md | 1 + release-please-config.json | 11 +++++++++++ 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release-please.yml create mode 100644 release-please-config.json diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index d5efb0b..479fa1a 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -11,6 +11,13 @@ jobs: steps: - uses: deepakputhraya/action-pr-title@master with: - min_length: 6 # Min length of the title - max_length: 72 # Max length of the title - github_token: ${{ github.token }} # Default: ${{ github.token }} + # Only allow Conventional Commits prefixes recognized by release-please + # feat: minor version bump, fix: patch version bump, others: no version bump + regex: '^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?: (.+)' + allowed_prefixes: 'feat,fix,docs,style,refactor,perf,test,build,ci,chore,revert' + disallowed_prefixes: '' + prefix_case_sensitive: false + min_length: 10 + max_length: 72 + verbal_description: 'Conventional Commit message compatible with release-please (e.g., "feat: Add new feature", "fix: Fix bug")' + github_token: ${{ github.token }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..5597f9f --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,23 @@ +name: release-please + +on: + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@v4 + id: release + with: + token: ${{ secrets.GITHUB_TOKEN }} + config-file: release-please-config.json + diff --git a/README.md b/README.md index 77443bd..9d2d6d0 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ This template provides a modern Python development environment with the followin - **uv** for fast dependency management - **Type hints** and **PEP 257** compliant docstring enforcement - **GitHub Actions** for CI/CD pipeline +- **Release Please** for automated version management based on Conventional Commits - Modular project structure (src layout) - Logging configuration included diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..8ae84dd --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,11 @@ +{ + "packages": { + ".": { + "release-type": "python", + "package-name": "python-project-template", + "version-file": "pyproject.toml" + } + }, + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +} + From 08adcf9273884c7bdba967ffded0bebc3ebb7b6c Mon Sep 17 00:00:00 2001 From: curt-park Date: Sat, 8 Nov 2025 15:16:06 +0900 Subject: [PATCH 4/4] Update comments --- README.md | 1 + src/dummy.py | 12 +++++++++++- tests/test_dummy.py | 7 ++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9d2d6d0..ad72143 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ python-project-template/ ├── .cursorrules # Cursor IDE AI assistant rules and guidelines ├── .mise.toml # mise tool version manager configuration (Python and tool versions) ├── pyproject.toml # Project configuration and dependencies +├── release-please-config.json # Release Please configuration for automated version management ├── Makefile # Development commands └── logging.conf # Logging configuration ``` diff --git a/src/dummy.py b/src/dummy.py index ce6a7fd..5ecc81a 100644 --- a/src/dummy.py +++ b/src/dummy.py @@ -8,7 +8,17 @@ def fibonacci(num: int) -> int: - """Return fibonacci number.""" + """Calculate the nth Fibonacci number. + + Args: + num: The position in the Fibonacci sequence (must be non-negative). + + Returns: + The nth Fibonacci number. + + Raises: + AssertionError: If num is negative. + """ assert num >= 0 prev, curr = 0, 1 for _ in range(num): diff --git a/tests/test_dummy.py b/tests/test_dummy.py index ef12c1f..b38da52 100644 --- a/tests/test_dummy.py +++ b/tests/test_dummy.py @@ -6,7 +6,12 @@ def test_fibonacci() -> None: - """Test fibonacci numbers.""" + """Test fibonacci function with various inputs. + + Tests include: + - Negative input validation (should raise AssertionError) + - Fibonacci sequence values from 0 to 9 + """ with pytest.raises(AssertionError): fibonacci(-1) assert fibonacci(0) == 0