A2A Net's template for Python projects that use Cursor/VSCode and Claude Code. Uses uv, ruff, and mypy.
- uv installed
- Cursor
- Prettier
- Ruff
- Mypy (by matangover NOT ms-python)
- Initialise uv
uv init- Add development packages
uv add --dev ruff mypy- Add the below sections to your
pyproject.toml:
[tool.ruff]
target-version = "py313"
line-length = 100
[tool.mypy]
python_version = "3.13"
strict = true
- Add
.vscode/settings.jsonto your folder
-
Copy (not clone) this template to your new project
-
Rename the package directory:
mv src/your_package_name src/new_your_package_name-
Update the following files with your package name:
pyproject.toml: Updatename,authors,project.urls, andtool.hatch.version.pathrelease-please-config.json: Updatepackage-nameandextra-filespathsrc/new_your_package_name/__init__.py: Update importtests/test_version.py: Update import
-
Initialise the project:
uv sync- Run the checks:
uv run ruff check .
uv run ruff format --check .
uv run mypy .
uv run pytestThis template includes GitHub Actions workflows for continuous integration and release automation.
| Workflow | Trigger | Description |
|---|---|---|
| CI | Push/PR to main | Runs ruff, mypy, and pytest with coverage |
| Release Please | Push to main | Creates releases with changelogs and publishes to PyPI (optional) |
This template uses release-please for automated releases. Use conventional commits to trigger version bumps.
| Commit prefix | Version bump | Description |
|---|---|---|
feat!: |
Major (x.0.0) | Breaking changes that require major version bump |
feat: |
Minor (0.x.0) | New features that add functionality |
fix: |
Patch (0.0.x) | Bug fixes |
perf: |
Patch (0.0.x) | Performance improvements |
build: |
None | Build system or dependency changes |
chore: |
None | Maintenance tasks that don't affect production code |
ci: |
None | CI/CD configuration changes |
docs: |
None | Documentation updates |
refactor: |
None | Code restructuring without behavior changes |
revert: |
None | Reverting previous commits |
style: |
None | Code formatting changes |
test: |
None | Adding or updating tests |
- Make commits using conventional commit format
- Push to
mainbranch - Release Please automatically creates/updates a Release PR
- When ready, merge the Release PR
- A GitHub Release is created and (if configured) the package is published to PyPI automatically
The release-please.yml workflow includes PyPI publishing but requires setup.
To enable PyPI publishing:
-
Create a PyPI account at https://pypi.org
-
Add Trusted Publisher on PyPI:
- Go to https://pypi.org/manage/account/publishing/
- Add a new Pending Trusted Publisher:
- PyPI project name: your-package-name
- Owner: A2ANet
- Repository: your-repo-name
- Workflow name:
release-please.yml - Environment name:
pypi
-
Create GitHub Environment:
- Go to your repo Settings → Environments
- Create a new environment named
pypi
The first release will register your package on PyPI using the pending publisher you created.
If you don't want to publish to PyPI, remove the build and publish jobs from .github/workflows/release-please.yml. The release workflow will still create GitHub releases with changelogs.
Protect your main branch to prevent accidental pushes and ensure code quality:
- Go to Settings → Branches → Add classic branch protection rule
- Branch name pattern:
main - Enable the following:
- Require a pull request before merging
- Require approvals: 1
- Dismiss stale pull request approvals when new commits are pushed
- Require status checks to pass before merging
- Require branches to be up to date before merging
- Add status checks (after your first CI run):
Lint & FormatType CheckTest
- Require linear history
- Require a pull request before merging
These rules ensure all code goes through PR review and passes CI checks before merging to main.
Enforce linear history and clean commits:
- Go to Settings → General → Pull Requests
- Check the following:
- Allow squash merging
- Automatically delete head branches
- Uncheck the following:
- Allow merge commits
- Allow rebase merging
This ensures every PR becomes a single, clean commit on main with a proper conventional commit message.
Configure GitHub Actions permissions to allow Release Please to create pull requests:
For personal repositories:
- Go to repository Settings → Actions → General
- Scroll down to Workflow permissions
- Select "Read and write permissions"
- Check "Allow GitHub Actions to create and approve pull requests"
- Click Save
For organization repositories:
If the workflow permissions option is greyed out in your repository settings, you need to configure this at the organization level:
- Go to your organization Settings → Actions → General (requires organization owner permissions)
- Scroll down to Workflow permissions
- Select "Read and write permissions"
- Check "Allow GitHub Actions to create and approve pull requests"
- Click Save
Without these settings, the Release Please workflow will fail with: GitHub Actions is not permitted to create or approve pull requests
Enable Claude to respond to @claude mentions in PRs and issues:
claude
/install-github-appThis installs the Claude GitHub App and configures the workflow. Once set up, mention @claude in any PR or issue comment to get AI assistance with code reviews, bug fixes, and feature implementation.
your-project/
├── .github/
│ └── workflows/
│ ├── ci.yml # Lint, typecheck, test
│ └── release-please.yml # Automated releases + PyPI publishing
├── src/
│ └── your_package_name/
│ ├── __init__.py
│ └── __about__.py # Version (updated by release-please)
├── tests/
│ ├── __init__.py
│ └── test_version.py
├── .vscode/
│ └── settings.json
├── pyproject.toml
├── release-please-config.json
├── .release-please-manifest.json
└── README.md