Skip to content

Commit a37a37d

Browse files
committed
v0.1.0
Introduce a complete Python project template (v0.1.0) with source package, tests, docs, and developer tooling. Adds pyproject.toml, package source (src/python_template), example scripts, basic pytest test, and py.typed. Includes editor and CI config: .editorconfig, .vscode settings, pre-commit, GitHub Actions for testing, docs deploy, and PyPI publish. Adds Makefile with common tasks, scripts/rename_workspace.py for renaming the project, CONTRIBUTING/SECURITY/CODE_OF_CONDUCT/README docs, and various repository templates (ISSUE/PR). Minor LICENSE change and other housekeeping files (.gitignore, VERSION, mkdocs.yml, docs). This sets up formatting (ruff), type checking (basedpyright/ty), uv-based env management, and CI workflows for a ready-to-use starter repository.
1 parent 8368c19 commit a37a37d

38 files changed

+984
-2
lines changed

.cursorrules

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# AI Assistant Rules for Python Template
2+
3+
You are an expert Python developer assisting with this modern repository.
4+
5+
## Core Directives
6+
1. **Toolchain:**
7+
- This project strictly uses `uv` for package management. Do NOT suggest `pip`, `poetry`, or `pipenv`.
8+
- Use `uv run <command>` or ensure the `.venv` is activated.
9+
- For formatting/linting, this project relies exclusively on `ruff`. Do NOT suggest `black`, `flake8`, or `isort`.
10+
- For type checking, use `basedpyright`.
11+
12+
2. **Code Style & Typing:**
13+
- Write modern Python 3.11+ code.
14+
- Use built-in types for type hinting (`list[str]`, `dict[str, int]`, `str | None`). Avoid importing from `typing` unless necessary (e.g., `Callable`, `Any`).
15+
- Follow strict type hinting. `basedpyright` will reject untyped definitions.
16+
17+
3. **Testing:**
18+
- Write test cases using `pytest`.
19+
- Utilize `pytest.mark.asyncio` for async tests if needed (installed via `pytest-asyncio`).
20+
21+
4. **Formatting:**
22+
- Max line length is 100 characters (configured in `pyproject.toml`).
23+
- Do not manually format code in your head; assume `make format` (`ruff format`) will be run. Match standard indentation.

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.{yml,yaml,json}]
12+
indent_size = 2
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[Makefile]
18+
indent_style = tab
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Bug Report
2+
description: Create a report to help us improve
3+
title: "[BUG]: "
4+
labels: ["bug"]
5+
body:
6+
- type: textarea
7+
id: description
8+
attributes:
9+
label: Description
10+
description: A clear and concise description of what the bug is.
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: reproduction
15+
attributes:
16+
label: Steps to reproduce
17+
description: How can we reproduce this bug?
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: expected
22+
attributes:
23+
label: Expected behavior
24+
description: What did you expect to happen?
25+
validations:
26+
required: true
27+
- type: input
28+
id: version
29+
attributes:
30+
label: Environment Version
31+
description: Python version, OS, etc.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Feature Request
2+
description: Suggest an idea for this project
3+
title: "[FEATURE]: "
4+
labels: ["enhancement"]
5+
body:
6+
- type: textarea
7+
id: description
8+
attributes:
9+
label: Is your feature request related to a problem? Please describe.
10+
description: A clear and concise description of what the problem is.
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: solution
15+
attributes:
16+
label: Describe the solution you'd like
17+
description: A clear and concise description of what you want to happen.
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: alternatives
22+
attributes:
23+
label: Describe alternatives you've considered
24+
description: A clear and concise description of any alternative solutions or features you've considered.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Description
2+
<!-- Please include a summary of the change and which issue is fixed. -->
3+
<!-- Please also include relevant motivation and context. -->
4+
5+
Fixes # (issue)
6+
7+
## Type of change
8+
9+
- [ ] Bug fix (non-breaking change which fixes an issue)
10+
- [ ] New feature (non-breaking change which adds functionality)
11+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
12+
- [ ] This change requires a documentation update
13+
14+
## Checklist:
15+
16+
- [ ] My code follows the style guidelines of this project (ruff format & check)
17+
- [ ] I have performed a self-review of my own code
18+
- [ ] I have made corresponding changes to the documentation
19+
- [ ] My changes generate no new warnings (basedpyright & ty)
20+
- [ ] I have added tests that prove my fix is effective or that my feature works
21+
- [ ] New and existing unit tests pass locally with my changes (pytest)

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "weekly"

.github/workflows/docs.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v5
19+
with:
20+
enable-cache: true
21+
22+
- name: Set up Python
23+
run: uv python install 3.11
24+
25+
- name: Install dependencies
26+
run: |
27+
uv venv
28+
uv pip install -e ".[dev]"
29+
30+
- name: Deploy MkDocs
31+
run: |
32+
source .venv/bin/activate
33+
mkdocs gh-deploy --force

.github/workflows/publish.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v5
19+
20+
- name: Set up Python
21+
run: uv python install 3.11
22+
23+
- name: Build and Publish
24+
env:
25+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
26+
run: |
27+
uv build
28+
uv publish

.github/workflows/test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.11", "3.12", "3.13"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
21+
with:
22+
enable-cache: true
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
run: uv python install ${{ matrix.python-version }}
26+
27+
- name: Install dependencies
28+
run: |
29+
uv venv
30+
uv pip install -e ".[dev]"
31+
32+
- name: Format Code (make format)
33+
run: |
34+
source .venv/bin/activate
35+
make format
36+
37+
- name: Check Code (make check)
38+
run: |
39+
source .venv/bin/activate
40+
make check
41+
42+
- name: Run Tests (make tests)
43+
run: |
44+
source .venv/bin/activate
45+
make tests

0 commit comments

Comments
 (0)