Skip to content

Commit 5e35130

Browse files
committed
feat(project): create an ai-native paved road for python projects
0 parents  commit 5e35130

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+7134
-0
lines changed

.cursor/rules/python-template.mdc

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
type: always
2+
3+
---
4+
5+
# AI-Native Python Paved Road Template Rules
6+
7+
You are working on a cookiecutter template for generating modern Python projects.
8+
9+
## Critical Context
10+
This is a TEMPLATE GENERATOR. Files in `{{cookiecutter.project_name}}/` contain Jinja2 variables that must be preserved exactly as written.
11+
12+
## Tech Stack
13+
- Python 3.13+ with uv package manager (NOT pip/poetry)
14+
- pytest with >80% coverage requirement
15+
- Pre-commit: ruff, pyright, refurb
16+
- Security: grype, syft
17+
- CI/CD: GitHub Actions
18+
- Versioning: CalVer or SemVer-ish
19+
20+
## Code Standards
21+
- Max line length: 120
22+
- Type hints required
23+
- Google-style docstrings
24+
- Use pathlib (no os.path)
25+
- Use logging (no print)
26+
- Specific exception handling
27+
28+
## Key Commands
29+
```bash
30+
task init # Setup environment
31+
task build # Build project
32+
task test # Run tests
33+
task lint # Check code quality
34+
```
35+
36+
## Template Testing
37+
```bash
38+
uvx cookiecutter . # Generate project
39+
pytest tests/ # Test template
40+
```

.github/.grant.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
rules:
2+
- pattern: "*"
3+
name: "Block AGPL licenses"
4+
mode: "block"
5+
reason: "AGPL licenses are not allowed in this project"
6+
licenses:
7+
- "agpl"
8+
- "agpl-1.0"
9+
- "agpl-1.0-only"
10+
- "agpl-1.0-or-later"
11+
- "agpl-3.0"
12+
- "agpl-3.0-only"
13+
- "agpl-3.0-or-later"

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Repository owner
2+
* @jonzeolla
3+
4+
# Sensitive files (covers both the cookiecutter and generated files in the repo)
5+
.github/** @jonzeolla
6+
LICENSE @jonzeolla
7+
SECURITY.md @jonzeolla

.github/CONTRIBUTING.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size,
6+
visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status,
7+
nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
8+
9+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
10+
11+
## Our Standards
12+
13+
Examples of behavior that contributes to a positive environment for our community include:
14+
15+
* Demonstrating empathy and kindness toward other people
16+
* Being respectful of differing opinions, viewpoints, and experiences
17+
* Giving and gracefully accepting constructive feedback
18+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
19+
* Focusing on what is best not just for us as individuals, but for the overall community
20+
21+
Examples of unacceptable behavior include:
22+
23+
* The use of sexualized language or imagery, and sexual attention or advances of any kind
24+
* Trolling, insulting or derogatory comments, and personal or political attacks
25+
* Public or private harassment
26+
* Publishing others' private information, such as a physical or email address, without their explicit permission
27+
* Other conduct which could reasonably be considered inappropriate in a professional setting
28+
29+
## Enforcement Responsibilities
30+
31+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in
32+
response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33+
34+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not
35+
aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
36+
37+
## Scope
38+
39+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces.
40+
Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed
41+
representative at an online or offline event.
42+
43+
## Enforcement
44+
45+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at
46+
<security@zenable.io>. All complaints will be reviewed and investigated promptly and fairly.
47+
48+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
49+
50+
## Enforcement Guidelines
51+
52+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
53+
54+
### 1. Correction
55+
56+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
57+
58+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior
59+
was inappropriate. A public apology may be requested.
60+
61+
### 2. Warning
62+
63+
**Community Impact**: A violation through a single incident or series of actions.
64+
65+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those
66+
enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social
67+
media. Violating these terms may lead to a temporary or permanent ban.
68+
69+
### 3. Temporary Ban
70+
71+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
72+
73+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private
74+
interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these
75+
terms may lead to a permanent ban.
76+
77+
### 4. Permanent Ban
78+
79+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or
80+
aggression toward or disparagement of classes of individuals.
81+
82+
**Consequence**: A permanent ban from any sort of public interaction within the community.
83+
84+
## Attribution
85+
86+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at
87+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct][v2.1].
88+
89+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
90+
91+
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
92+
[https://www.contributor-covenant.org/translations][translations].
93+
94+
[homepage]: https://www.contributor-covenant.org [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct [Mozilla CoC]:
95+
https://github.com/mozilla/diversity [FAQ]: https://www.contributor-covenant.org/faq [translations]: https://www.contributor-covenant.org/translations

.github/ISSUE_TEMPLATE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Summary of the issue
2+
3+
## Expected behavior
4+
5+
## Steps to reproduce
6+
7+
## Your environment
8+
9+
## Logs and error messages

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Contributor Comments
2+
3+
## Pull Request Checklist
4+
5+
Thank you for submitting a contribution!
6+
7+
Please address the following items:
8+
9+
- [ ] If you are adding a dependency, please explain how it was chosen.
10+
- [ ] If manual testing is needed in order to validate the changes, provide a testing plan and the expected results.
11+
- [ ] Validate that documentation is accurate and aligned to any project updates or additions.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
name: 'Bootstrap the repository'
3+
description: 'Sets up uv, adds Homebrew to PATH, installs Task, and initializes the repository'
4+
inputs:
5+
token:
6+
description: 'A Github token'
7+
required: true
8+
python-version:
9+
description: 'Python version to use'
10+
required: false
11+
default: '3.13'
12+
working-directory:
13+
description: 'The working directory'
14+
required: false
15+
default: '.'
16+
runs:
17+
using: 'composite'
18+
steps:
19+
- name: Create run_script for running scripts downstream
20+
shell: 'bash --noprofile --norc -Eeuo pipefail {0}'
21+
working-directory: ${{ inputs.working-directory }}
22+
run: |
23+
run_script="uv run --frozen"
24+
echo "run_script=${run_script}" | tee -a "${GITHUB_ENV}"
25+
26+
- name: Setup uv
27+
uses: astral-sh/setup-uv@v4
28+
with:
29+
enable-cache: true
30+
cache-dependency-glob: "**/uv.lock"
31+
python-version: ${{ inputs.python-version }}
32+
33+
- name: Install Task
34+
uses: arduino/setup-task@v2
35+
with:
36+
# Passing a repo token reduces the likelihood of API rate limit exceeded
37+
repo-token: ${{ inputs.token }}
38+
39+
- name: Add Homebrew to the path
40+
shell: 'bash --noprofile --norc -Eeuo pipefail {0}'
41+
# This ensures compatibility with macOS runners and Linux runners with Homebrew
42+
run: |
43+
# Check if we're on macOS
44+
if [[ "$RUNNER_OS" == "macOS" ]]; then
45+
# macOS homebrew locations
46+
if [[ -d "/opt/homebrew/bin" ]]; then
47+
PATH="${PATH}:/opt/homebrew/bin"
48+
elif [[ -d "/usr/local/bin" ]]; then
49+
PATH="${PATH}:/usr/local/bin"
50+
fi
51+
else
52+
# Linux homebrew location
53+
if [[ -d "/home/linuxbrew/.linuxbrew/bin" ]]; then
54+
PATH="${PATH}:/home/linuxbrew/.linuxbrew/bin"
55+
fi
56+
fi
57+
58+
export PATH
59+
echo "PATH=${PATH}" | tee -a "${GITHUB_ENV}"
60+
61+
# Smoke test - don't fail if brew isn't available
62+
if command -v brew &> /dev/null; then
63+
echo "Homebrew found at: $(which brew)"
64+
brew --version
65+
else
66+
echo "Homebrew not found, continuing without it"
67+
fi
68+
working-directory: ${{ inputs.working-directory }}
69+
70+
- name: Set Python hash for caching
71+
shell: 'bash --noprofile --norc -Eeuo pipefail {0}'
72+
run: |
73+
# Create a hash of the Python version for better cache keys
74+
echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" | tee -a "${GITHUB_ENV}"
75+
76+
- name: Cache pre-commit environments
77+
uses: actions/cache@v4
78+
with:
79+
path: ~/.cache/pre-commit
80+
key: pre-commit|${{ env.PY }}|${{ hashFiles(format('{0}/.pre-commit-config.yaml', inputs.working-directory)) }}
81+
82+
- name: Initialize the repository
83+
working-directory: ${{ inputs.working-directory }}
84+
shell: 'bash --noprofile --norc -Eeuo pipefail {0}'
85+
run: task -v init

.github/copilot-instructions.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# GitHub Copilot Instructions for AI-Native Python Paved Road
2+
3+
You are working on a cookiecutter template for creating AI-native Python projects. This template provides a modern Python development setup with best practices
4+
built-in.
5+
6+
## Context
7+
8+
- This is a **template generator**, not a regular Python project
9+
- Files in `{{cookiecutter.project_name}}` directory contain Jinja2 template variables
10+
- The project uses `uv` as the package manager (not pip or poetry)
11+
- Python 3.13+ is the minimum requirement
12+
- The template uses python-semantic-release for automated versioning
13+
14+
## Code Conventions
15+
16+
1. **Imports**: Use absolute imports only
17+
2. **Type Hints**: Always include type hints for function parameters and return values
18+
3. **Docstrings**: Use Google-style docstrings for all public functions and classes
19+
4. **Error Handling**: Raise specific exceptions with descriptive messages
20+
5. **Path Handling**: Use pathlib.Path instead of os.path
21+
6. **Logging**: Use the logging module, never print()
22+
23+
## File Patterns
24+
25+
- `*.py`: Python source files
26+
- `*.toml`: Configuration files (pyproject.toml, etc.)
27+
- `*.yml`: GitHub Actions workflows
28+
- `*.md`: Documentation files
29+
- `*.j2`: Jinja2 templates (if any)
30+
31+
## Testing Requirements
32+
33+
- Write pytest tests for all new functionality, but run all tests with: `task test`
34+
- You can also run just unit tests with `task unit-test` and just integration tests with `task integration-test`
35+
- Use fixtures for test data setup and place it in `tests/conftest.py`
36+
- Maintain >80% code coverage
37+
- Mark tests appropriately: @pytest.mark.unit or @pytest.mark.integration
38+
39+
## Task Automation
40+
41+
Common tasks are automated via Taskfile:
42+
43+
- `task init`: Initialize development environment
44+
- `task build`: Build the project
45+
- `task test`: Run all tests
46+
- `task lint`: Run code quality checks
47+
- `task clean`: Remove any build artifacts or temporary files
48+
49+
## Security Considerations
50+
51+
- Never hardcode secrets or credentials
52+
- Use environment variables for sensitive data
53+
- Follow OWASP secure coding practices
54+
- Run security scans with grype before releases
55+
56+
## When Suggesting Code
57+
58+
1. Check existing patterns in the codebase first
59+
2. Ensure compatibility with uv package manager
60+
3. Follow the established project structure
61+
4. Include appropriate error handling
62+
5. Add tests for new functionality
63+
6. Update documentation as needed
64+
65+
## Template-Specific Guidelines
66+
67+
When working with cookiecutter templates:
68+
69+
- Preserve Jinja2 syntax in template files
70+
- Use proper escaping for template variables
71+
- Test template generation with various inputs
72+
- Ensure generated projects are functional
73+
74+
## Common Patterns
75+
76+
```python
77+
# Path handling
78+
from pathlib import Path
79+
project_root = Path(__file__).parent.parent
80+
81+
# Logging setup
82+
import logging
83+
logger = logging.getLogger(__name__)
84+
85+
# Type hints
86+
from typing import Optional, List, Dict
87+
def process_data(items: List[Dict[str, Any]]) -> Optional[str]:
88+
...
89+
```

0 commit comments

Comments
 (0)