{{PROJECT_NAME}}
{{PROJECT_DESCRIPTION}}
Features
- Modern Python project structure with uv and nox
- Comprehensive code quality tools (Ruff, Black, isort, Pyright)
- Security scanning (Bandit, pip-audit, Safety)
- Automated testing with pytest and coverage
- Documentation with MkDocs Material
- Pre-commit hooks for code quality
- Conventional commits with Commitizen
- GitHub Actions CI/CD pipeline
- Docker support
Quick Start
Prerequisites
- Python 3.12+
- uv (Python package manager)
Installation
# Clone the repository
git clone
cd {{PROJECT_NAME_SLUG}}
# Install dependencies
uv pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit installDevelopment Commands
| Command | Description |
|---|---|
nox -s lint | Run linting with Ruff |
nox -s format_code | Format code with Ruff |
nox -s typing | Run type checking with Pyright |
nox -s test | Run tests with coverage |
nox -s security | Run security checks |
nox -s docs | Build documentation |
nox -s ci | Run all CI checks |
nox -s all_checks | Run all quality checks |
Testing
# Run tests with coverage
nox -s test
# Run tests in parallel
pytest -n auto
# Run specific test markers
pytest -m "not slow"Documentation
# Build documentation
nox -s docs
# Serve documentation locally
mkdocs serveDocker
# Build Docker image
docker build -t {{PROJECT_NAME_SLUG}} .
# Run Docker container
docker run {{PROJECT_NAME_SLUG}}Project Structure
{{PROJECT_NAME_SLUG}}/
├── src/ # Source code
├── tests/ # Test files
├── docs/ # Documentation
├── .github/ # GitHub configuration
├── .vscode/ # VS Code settings
├── constraints/ # Dependency constraints
├── pyproject.toml # Project configuration
├── noxfile.py # Nox tasks
├── mkdocs.yml # Documentation configuration
├── Dockerfile # Docker configuration
└── README.md # This fileContributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run quality checks:
nox -s all_checks - Commit using conventional commits:
cz commit - Create a pull request
Development Workflow
Code Quality
The project uses several tools to maintain code quality:
- Ruff: Fast Python linter and formatter
- Black: Uncompromising code formatter
- isort: Import sorting
- Pyright: Type checking
- Bandit: Security linting
- pip-audit: Dependency vulnerability scanning
- Safety: Commercial-grade security scanning
Pre-commit Hooks
Pre-commit hooks automatically run quality checks before each commit:
# Install pre-commit hooks
pre-commit install
# Run all hooks manually
pre-commit run --all-filesConventional Commits
The project uses conventional commits for versioning:
# Use Commitizen for commits
cz commit
# Bump version
cz bumpLicense
This project is licensed under the {{LICENSE_TYPE}} License - see the LICENSE file for details.
開発環境セットアップ手順
手動セットアップ
pipx のインストール(入っていない場合)
sudo apt update
sudo apt install pipx
pipx ensurepath詳細はpipx の公式ドキュメントを参照してください。
uv のインストール
pipx install uv詳細はuv の公式ドキュメントを参照してください。
対象の Python バージョンのインストール
uv python install [TARGET_PYTHON_VERSION]仮想環境の作成
uv venvライブラリのインストール
uv syncpre-commit の設定
uv run pre-commit installここまではsetup.shで実行できます
nox の実行
uv run nox仮想環境の有効化
source .venv/bin/activate仮想環境の終了
deactivate自動セットアップスクリプト
環境のセットアップを自動化するために、setup.shスクリプトを用意しています。
setup.sh の使用方法
このスクリプトを使用することで、開発環境のセットアップを簡単に行うことができます。
setup.shファイルをプロジェクトのルートディレクトリに配置します。
- スクリプトに実行権限を付与します:
chmod +x setup.sh- スクリプトを実行します:
./setup.sh注意事項:
- スクリプトは sudo コマンドを使用するため、実行時にパスワードの入力を求められる場合があります。
- Python のバージョンインストール行はデフォルトでコメントアウトされています。使用する場合は、スクリプトを編集し、適切なバージョン番号を指定してください。
- 仮想環境の有効化と終了は、スクリプト実行後に手動で行う必要があります。
