Skip to content

Commit 1b83887

Browse files
Complete template enhancement: add docs pages, release drafter, and update README with new features
Co-authored-by: retr0crypticghost <139195952+retr0crypticghost@users.noreply.github.com>
1 parent 1e64bbc commit 1b83887

6 files changed

Lines changed: 795 additions & 32 deletions

File tree

README.md

Lines changed: 155 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,55 @@ A [Cookiecutter](https://github.com/cookiecutter/cookiecutter) template for Pyth
1818
1919
## What This Template Provides
2020

21-
This template generates projects with professional patterns and good security practices:
21+
This template generates projects with professional patterns, modern tooling, and comprehensive security practices:
2222

23-
### 🔒 Security-Conscious Logging
23+
### 🔒 Security-First Design
2424

2525
- **Sensitive data filtering**: Automatically masks passwords, tokens, and secrets in logs
26-
- **Thread-safe logging**: Safe for concurrent operations
27-
- **Structured output**: Consistent formatting for both development and production
28-
- **Audit capabilities**: Security event tracking when needed
26+
- **Supply chain security**: SBOM generation, dependency scanning, and vulnerability auditing
27+
- **Security workflows**: CodeQL analysis, OpenSSF Scorecard, and automated security updates
28+
- **Audit capabilities**: Security event tracking and compliance logging
2929

30-
### ⚙️ Hierarchical Configuration
30+
### ⚙️ Advanced Configuration Management
3131

32-
- **Precedence system**: Environment variables → Config file → Defaults
33-
- **Type safety**: Automatic conversion and validation of configuration values
34-
- **Multiple formats**: YAML and JSON support with auto-detection
32+
- **Multiple package managers**: pip, uv, or Hatch support with optimized configurations
33+
- **Typed configuration**: Optional Pydantic-based settings with validation and IDE support
34+
- **Hierarchical loading**: Environment variables → Config file → Defaults
3535
- **Environment validation**: Startup checks for required configuration
3636

37-
### 🧪 Comprehensive Testing
37+
### 📊 Enhanced Logging & Observability
3838

39-
- **pytest foundation**: Ready-to-use testing setup with helpful fixtures
40-
- **Coverage requirements**: 90%+ coverage enforcement to maintain quality
41-
- **Security testing**: Patterns for testing sensitive data handling
42-
- **CI/CD integration**: GitHub Actions with multi-Python version testing
39+
- **JSON-first logging**: Structured logging with request/operation ID tracking
40+
- **Context management**: Automatic correlation IDs for distributed tracing
41+
- **Thread-safe logging**: Safe for concurrent operations with performance optimizations
42+
- **Flexible formats**: Switch between JSON and plain text as needed
43+
44+
### 🧪 Comprehensive Testing & Quality
45+
46+
- **Multi-environment CI**: Tests on Ubuntu and Windows with multiple Python versions
47+
- **Security testing**: Patterns for testing sensitive data handling and configuration
48+
- **Coverage enforcement**: 90%+ coverage requirements with quality gates
49+
- **Type safety**: mypy integration with graduated strictness levels
4350

4451
### 🚀 Professional Project Types
4552

46-
**📚 Library Projects**: Clean package structure with modern packaging standards
47-
**⚡ CLI Applications**: Rich command-line interface with shell completion and documentation
53+
**📚 Library Projects**: Clean package structure with modern packaging standards and comprehensive documentation
54+
55+
**⚡ CLI Applications**: Rich command-line interface with shell completion, man page generation, and professional help systems
56+
57+
### 🛡️ Supply Chain Security
58+
59+
- **SBOM generation**: Automatic Software Bill of Materials in CycloneDX and SPDX formats
60+
- **Dependency auditing**: Integrated pip-audit scanning in CI workflows
61+
- **Vulnerability monitoring**: Automated dependency updates and security advisories
62+
- **Attestation support**: Cryptographic verification of build artifacts
63+
64+
### 📖 Documentation & Developer Experience
65+
66+
- **Optional MkDocs**: Material theme with automatic GitHub Pages deployment
67+
- **API documentation**: Auto-generated from docstrings with mkdocstrings
68+
- **Configuration docs**: Auto-generated documentation for typed config schemas
69+
- **CLI documentation**: Comprehensive usage guides and examples
4870

4971
> **Why these features?** These are patterns I've developed through building Python projects for business use. They solve real problems around configuration management, security compliance, and professional tooling expectations.
5072
@@ -75,6 +97,11 @@ package_name [data_analysis_tool]:
7597
project_description [A brief description of your project]: Tool for analyzing research data
7698
python_version [3.11]:
7799
project_type [library]: cli-application
100+
package_manager [pip]: uv
101+
docs [y]: y
102+
typed_config [n]: y
103+
sbom [n]: y
104+
versioning [setuptools-scm]: setuptools-scm
78105
author_name [Your Name]: retr0crypticghost
79106
author_email [your.email@example.com]: retr0@example.com
80107
github_username [your-username]: retr0crypticghost
@@ -84,7 +111,95 @@ include_pre_commit [y]: y
84111
license [MIT]:
85112
```
86113

87-
**Result**: A fully-configured Python project with security practices, testing setup, and professional tooling ready for development.
114+
**Result**: A fully-configured Python project with your chosen features, security practices, testing setup, and professional tooling ready for development.
115+
116+
## Configuration Options
117+
118+
The template now supports comprehensive customization:
119+
120+
### Project Types
121+
- **`library`** - Python package for reusable components
122+
- **`cli-application`** - Command-line tool with Rich interface
123+
124+
### Package Managers
125+
- **`pip`** - Traditional pip-based dependency management
126+
- **`uv`** - Ultra-fast Python package installer (recommended for speed)
127+
- **`hatch`** - Modern Python project manager with advanced features
128+
129+
### Documentation
130+
- **`docs=y`** - Scaffolds MkDocs with Material theme and GitHub Pages deployment
131+
- **`docs=n`** - Minimal documentation setup
132+
133+
### Typed Configuration
134+
- **`typed_config=y`** - Pydantic-based settings with validation and type safety
135+
- **`typed_config=n`** - Traditional configuration system
136+
137+
### Security & Compliance
138+
- **`sbom=y`** - Software Bill of Materials generation with CycloneDX/SPDX
139+
- **`sbom=n`** - Standard security workflows only
140+
141+
### Versioning Strategy
142+
- **`setuptools-scm`** - Automatic versioning from Git tags
143+
- **`hatch`** - Hatch-based versioning (when using Hatch package manager)
144+
- **`manual`** - Manual version management
145+
146+
## Common Usage Examples
147+
148+
### Minimal Library Project
149+
150+
For a simple Python library with basic features:
151+
```bash
152+
cookiecutter https://github.com/retr0crypticghost/python-template.git --no-input \
153+
project_name="My Library" \
154+
project_type="library" \
155+
package_manager="pip" \
156+
docs="n" \
157+
typed_config="n" \
158+
sbom="n" \
159+
versioning="manual"
160+
```
161+
162+
### Full-Featured CLI Application
163+
164+
For a professional command-line tool with all features:
165+
```bash
166+
cookiecutter https://github.com/retr0crypticghost/python-template.git --no-input \
167+
project_name="My CLI Tool" \
168+
project_type="cli-application" \
169+
package_manager="uv" \
170+
docs="y" \
171+
typed_config="y" \
172+
sbom="y" \
173+
versioning="setuptools-scm"
174+
```
175+
176+
### Enterprise Library
177+
178+
For a library with enterprise-grade features:
179+
```bash
180+
cookiecutter https://github.com/retr0crypticghost/python-template.git --no-input \
181+
project_name="Enterprise Library" \
182+
project_type="library" \
183+
package_manager="hatch" \
184+
docs="y" \
185+
typed_config="y" \
186+
sbom="y" \
187+
versioning="hatch"
188+
```
189+
190+
### Quick Development Project
191+
192+
For rapid prototyping with modern tooling:
193+
```bash
194+
cookiecutter https://github.com/retr0crypticghost/python-template.git --no-input \
195+
project_name="Quick Project" \
196+
project_type="library" \
197+
package_manager="uv" \
198+
docs="n" \
199+
typed_config="y" \
200+
sbom="n" \
201+
versioning="manual"
202+
```
88203

89204
## Generated Project Structure
90205

@@ -278,25 +393,35 @@ Additional templates planned based on actual project needs.
278393
### **vs. Basic Templates**
279394

280395
**Most templates give you**: Basic project structure, minimal configuration, simple testing setup
281-
**This template provides**: Security practices, professional tooling, comprehensive testing
396+
**This template provides**: Enterprise-grade security, flexible tooling, comprehensive automation
282397

283398
| Feature | Basic Templates | Python Professional Template |
284-
|---------|----------------|----------------------------|
285-
| **Logging** | `logging.getLogger()` | Security filtering, thread safety, structured output |
286-
| **Configuration** | Basic config.py | Hierarchical system with validation |
287-
| **CLI Tools** | argparse basics | Rich interface with completion and man pages |
288-
| **Testing** | pytest setup | 90%+ coverage requirement with security testing |
289-
| **Security** | None | Sensitive data protection and audit capabilities |
290-
| **CI/CD** | Basic workflows | Multi-Python testing with quality gates |
399+
|---------|----------------|------------------------------|
400+
| **Logging** | `logging.getLogger()` | JSON logging with request IDs, security filtering, context management |
401+
| **Configuration** | Basic config.py | Typed Pydantic settings OR traditional hierarchical system |
402+
| **Package Management** | pip only | pip, uv, or Hatch with optimized configurations |
403+
| **CLI Tools** | argparse basics | Rich interface with completion, man pages, and context help |
404+
| **Testing** | pytest setup | Multi-OS, multi-Python with 90%+ coverage and security testing |
405+
| **Security** | None | SBOM generation, dependency auditing, sensitive data protection |
406+
| **CI/CD** | Basic workflows | Multi-environment with quality gates, security scanning, SBOM |
407+
| **Documentation** | README only | Optional MkDocs with auto-deployment and API docs |
408+
409+
### **Enterprise Features**
410+
411+
- **Supply Chain Security**: SBOM generation, dependency auditing, vulnerability scanning
412+
- **Observability**: Request/operation ID tracking, structured JSON logging, context propagation
413+
- **Flexibility**: Choose your package manager (pip/uv/hatch), configuration style (typed/traditional)
414+
- **Compliance Ready**: Security workflows, audit logging, dependency management
415+
- **Developer Experience**: Type hints, IDE support, comprehensive documentation
291416

292417
### **Time Savings**
293418

294-
- **Skip repetitive setup**: No more copying logging/config code between projects
295-
- **Avoid security mistakes**: Built-in patterns for handling sensitive data
296-
- **Professional polish**: CLI tools that work like system utilities
297-
- **Quality foundations**: Testing and CI/CD setup that actually enforces standards
419+
- **Zero configuration**: Everything works out of the box with sensible defaults
420+
- **No vendor lock-in**: Choose your tools (package manager, versioning, documentation)
421+
- **Production ready**: Security patterns, logging, and monitoring built-in
422+
- **Maintenance free**: Automated dependency updates, security scanning, and quality checks
298423

299-
> **Bottom Line**: Get projects that look and work professionally without the manual setup time.
424+
> **Bottom Line**: Get enterprise-grade Python projects without the complexity—choose only the features you need.
300425
301426
## Project Types
302427

test_template.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ echo "🔍 Validating Generated Projects..."
5454
for combo in "${test_combinations[@]}"; do
5555
IFS=':' read -r name project_type package_manager docs typed_config sbom versioning <<< "$combo"
5656
project_dir="test-$name"
57-
package_name=$(echo "$name" | tr '-' '_')
57+
# The package name is derived from the full project slug (test-$name)
58+
full_project_slug="test-$name"
59+
package_name=$(echo "$full_project_slug" | tr '-' '_')
5860

59-
echo " 🔍 Validating: $project_dir"
61+
echo " 🔍 Validating: $project_dir (package: $package_name)"
6062

6163
# Check basic structure
6264
test -f "$project_dir/pyproject.toml" || (echo "❌ Missing pyproject.toml in $project_dir" && exit 1)
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name-template: 'v$RESOLVED_VERSION'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
4+
categories:
5+
- title: '🚀 Features'
6+
labels:
7+
- 'feature'
8+
- 'enhancement'
9+
- title: '🐛 Bug Fixes'
10+
labels:
11+
- 'fix'
12+
- 'bugfix'
13+
- 'bug'
14+
- title: '🧰 Maintenance'
15+
labels:
16+
- 'chore'
17+
- 'maintenance'
18+
- title: '📚 Documentation'
19+
labels:
20+
- 'documentation'
21+
- 'docs'
22+
- title: '🔒 Security'
23+
labels:
24+
- 'security'
25+
- title: '⚡ Performance'
26+
labels:
27+
- 'performance'
28+
- 'perf'
29+
30+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
31+
32+
change-title-escapes: '\<*_&'
33+
34+
version-resolver:
35+
major:
36+
labels:
37+
- 'major'
38+
- 'breaking'
39+
minor:
40+
labels:
41+
- 'minor'
42+
- 'feature'
43+
- 'enhancement'
44+
patch:
45+
labels:
46+
- 'patch'
47+
- 'fix'
48+
- 'bugfix'
49+
- 'bug'
50+
- 'chore'
51+
- 'maintenance'
52+
- 'security'
53+
default: patch
54+
55+
template: |
56+
## Changes
57+
58+
$CHANGES
59+
60+
## Contributors
61+
62+
Thanks to all contributors who made this release possible! 🎉
63+
64+
$CONTRIBUTORS
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
types: [opened, reopened, synchronize]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
update_release_draft:
14+
name: Update Release Draft
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
pull-requests: read
19+
20+
steps:
21+
- name: Update release draft
22+
uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0
23+
env:
24+
GITHUB_TOKEN: ${% raw %}{{ secrets.GITHUB_TOKEN }}{% endraw %}

0 commit comments

Comments
 (0)