diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index c6b22d8..19372d2 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -8,7 +8,7 @@ runs: shell: bash run: | apt-get update -qq - apt-get install -y -qq ca-certificates curl git libvips python3 python3-tk python3-venv xvfb unar + apt-get install -y -qq ca-certificates curl git python3 python3-venv libatomic1 gnupg - name: Set up uv uses: astral-sh/setup-uv@v5 @@ -19,4 +19,4 @@ runs: - name: Sync dependencies shell: bash - run: source .venv/bin/activate && uv sync --all-extras + run: source .venv/bin/activate && uv sync --group dev diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4506230..370a6a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,4 @@ +# TODO: After init, update CODECOV_TOKEN in GitHub repository secrets if using Codecov name: CI on: diff --git a/AGENTS.md b/AGENTS.md index 4fb5663..60b6717 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,13 +1,15 @@ # Repository Guidelines +> **⚠️ TEMPLATE FILE - This contains template-specific patterns. After initialization, update for your project's needs.** + ## Project Structure & Module Organization -The main application code lives in the `example_module` directory (which can be renamed via `make init`). The entrypoint is `main.py`. Tooling metadata (`pyproject.toml`, `uv.lock`) defines project dependencies. Expect any future modules (tests, components, helpers) to sit alongside these files unless a new package directory is created. +The main application code lives in the `[[MODULE_NAME]]` directory (which can be renamed via `make init`). The default entrypoint is `main.py` for applications, but `make init` removes this file for library packages. Tooling metadata (`pyproject.toml`, `uv.lock`) defines project dependencies. Expect any future modules (tests, components, helpers) to sit alongside these files unless a new package directory is created. For applications, create an entrypoint file; for libraries, expose the package API through the module's `__init__.py`. ## Build, Test, and Development Commands - `make init NAME=your-project`: initialize the template with your project name (renames module and updates config). - `source .venv/bin/activate`: activate the virtual environment (do this once per session). -- `uv sync --all-extras`: install dependencies via uv. -- `python main.py`: run the main entrypoint. +- `uv sync --group dev`: install dependencies via uv. +- `python main.py`: run the main entrypoint (if present, for applications). - `pytest`: run tests. - `make pytest`: run the test suite. - `make lint`: run ruff. @@ -15,12 +17,12 @@ The main application code lives in the `example_module` directory (which can be ## Getting Started When cloning this template for a new project: 1. Run `make init NAME=your-project` to rename the module and update config -2. Run `uv sync --all-extras` to install all dependencies +2. Run `uv sync --group dev` to install all dependencies 3. Run `source .venv/bin/activate` to activate the virtual environment 4. Start building your project! -## Git Worktrees (Parallel Work) -Use git worktrees to work on multiple cards in parallel without branch conflicts: +## Git Worktrees (Parallel Work - Optional) +Git worktrees allow working on multiple cards in parallel without branch conflicts. This is an optional workflow pattern that many projects don't use. - Create a branch per card: `git switch -c card/short-slug` - Add a worktree: `git worktree add ../project- card/short-slug` - Work only in that worktree for the card; run tests there. @@ -31,7 +33,7 @@ Use git worktrees to work on multiple cards in parallel without branch conflicts ## Test Coverage Requirements - Current target: 96% coverage threshold (configured in `pyproject.toml`) -- Always run `pytest --cov=example_module --cov-report=term-missing` to check missing coverage +- Always run `pytest --cov=[[MODULE_NAME]] --cov-report=term-missing` to check missing coverage - When touching logic or input handling, ensure tests are added to maintain coverage - Strategies for increasing coverage: - Add tests for remaining uncovered edge cases diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ce4e240 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,48 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Added + +- Warning banners to README.md and AGENTS.md to clearly indicate template files +- Post-initialization checklist section to README.md +- Placeholder system using `[[MODULE_NAME]]` for easy replacement +- POST_INIT_CHECKLIST.md with comprehensive post-init guidance +- TEMPLATE_GUIDE.md explaining template purpose and usage +- Improved `make init` output with summary of changes and next steps +- Comment placeholder in CI workflow for Codecov token setup +- Git worktrees section marked as optional in AGENTS.md + +### Changed + +- Replaced hardcoded "example_module" with `[[MODULE_NAME]]` placeholder in README.md +- Updated CI badge URLs to use placeholders (YOUR_USERNAME/YOUR_REPO) +- Enhanced `make init` target to provide detailed summary of automated changes +- Improved documentation clarity with visual indicators (⚠️, ✅, 📋, etc.) + +### Improved + +- Template now provides clearer guidance on what gets automated vs manual +- Better distinction between template-specific patterns and project-specific needs +- More comprehensive documentation for new users +- Enhanced visibility of post-initialization requirements + +## [0.1.0] - 2024-01-15 + +### Added + +- Initial template release +- Python 3.13 support +- uv package manager integration +- pytest with 96% minimum coverage +- ruff for linting and formatting +- pyright for type checking +- Pre-commit hooks for code quality +- GitHub Actions CI workflow +- Make commands for common tasks +- AGENTS.md for AI agent guidelines diff --git a/Makefile b/Makefile index 5828d16..edca7b5 100644 --- a/Makefile +++ b/Makefile @@ -10,17 +10,45 @@ help: ## Show this help message init: ## Initialize project with new name (Usage: make init NAME=your-project) @if [ -z "$(NAME)" ]; then echo "Usage: make init NAME=your-project"; exit 1; fi - @echo "Initializing project as $(NAME)..." - @sed -i.bak "s/python-starter-template/$(NAME)/g" pyproject.toml && rm pyproject.toml.bak - @sed -i.bak "s/example_module/$(NAME)/g" pyproject.toml && rm pyproject.toml.bak + $(eval PKG_DIR := $(subst -,_,$(NAME))) + @echo "Initializing project as $(NAME) (package dir: $(PKG_DIR))..." + @sed -i.bak 's/name = "python-starter-template"/name = "$(NAME)"/' pyproject.toml && rm pyproject.toml.bak + @sed -i.bak 's/example_module/$(PKG_DIR)/g' pyproject.toml && rm pyproject.toml.bak + @sed -i.bak 's/example_module/$(PKG_DIR)/g' .github/workflows/ci.yml && rm .github/workflows/ci.yml.bak @if [ -d "example_module" ]; then \ - echo "Renaming example_module to $(NAME)..."; \ - mv example_module $(NAME); \ - find . -type f -name "*.py" -exec sed -i.bak "s/from example_module/from $(NAME)/g" {} +; \ + echo "Renaming example_module to $(PKG_DIR)..."; \ + mv example_module $(PKG_DIR); \ + find . -type f -name "*.py" -not -path "./.venv/*" -exec sed -i.bak "s/from example_module/from $(PKG_DIR)/g" {} +; \ + find . -type f -name "*.py" -not -path "./.venv/*" -exec sed -i.bak "s/import example_module/import $(PKG_DIR)/g" {} +; \ find . -type f -name "*.py.bak" -delete; \ fi - @echo "Project initialized as $(NAME)" - @echo "Run 'uv sync --all-extras' to install dependencies" + @if [ -f "main.py" ]; then \ + echo "Removing template main.py (library package)..."; \ + rm main.py; \ + fi + @echo "" + @echo "✅ Project initialized successfully!" + @echo "" + @echo "📋 SUMMARY OF CHANGES:" + @echo " • Module renamed to: $(PKG_DIR)" + @echo " • Package name in pyproject.toml: $(NAME)" + @echo " • Python imports updated to use: $(PKG_DIR)" + @echo " • CI workflow updated" + @echo " • Template main.py removed (library package structure)" + @echo "" + @echo "⚠️ MANUAL UPDATES REQUIRED:" + @echo " • Replace [[MODULE_NAME]] with $(PKG_DIR) in README.md and AGENTS.md" + @echo " • Update CI badge URLs in README.md (YOUR_USERNAME/YOUR_REPO)" + @echo " • Update project title, description, and features in README.md" + @echo " • Review and customize AGENTS.md for your project" + @echo " • See POST_INIT_CHECKLIST.md for complete details" + @echo "" + @echo "📦 NEXT STEPS:" + @echo " 1. Run: uv sync --all-extras" + @echo " 2. Run: source .venv/bin/activate" + @echo " 3. Run: make lint && make pytest" + @echo " 4. Follow POST_INIT_CHECKLIST.md for customization" + @echo "" lint: ## Run code linting bash scripts/lint.sh @@ -38,7 +66,7 @@ pytest: ## Run tests pytest sync: ## Install dependencies - uv sync --all-extras + uv sync --group dev venv: ## Create virtual environment uv venv diff --git a/POST_INIT_CHECKLIST.md b/POST_INIT_CHECKLIST.md new file mode 100644 index 0000000..045e858 --- /dev/null +++ b/POST_INIT_CHECKLIST.md @@ -0,0 +1,168 @@ +# Post-Initialization Checklist + +This checklist guides you through the manual steps needed after running `make init NAME=your-project` to customize your new project. + +## 🎯 Overview + +The `make init` command automates the following: +- ✅ Renames the module directory from `example_module` to your project name (hyphenated names are normalized: my-project → my_project) +- ✅ Updates `pyproject.toml` with your project name +- ✅ Updates all Python imports to use the new module name +- ✅ Updates CI workflow to use the new module name +- ✅ Removes `main.py` (template uses a library package structure) + +However, some items require manual attention to ensure your project is properly configured. + +## 📋 Documentation Updates + +### README.md +- [ ] **Update project title and description** + - Change "Python Starter Template" to your project name + - Update the description to reflect what your project does + - Add your project's specific features + +- [ ] **Replace `[[MODULE_NAME]]` references** + - Search for all instances of `[[MODULE_NAME]]` + - Replace with your actual module name (e.g., project name `my-project` becomes module directory `my_project`) + +- [ ] **Update CI badge URLs** + - Replace `YOUR_USERNAME` with your GitHub username + - Replace `YOUR_REPO` with your repository name + - Example: `https://github.com/johndoe/my-awesome-project/workflows/CI/badge.svg` + +- [ ] **Update features list** + - Remove or add features based on your project's capabilities + - Add specific libraries or frameworks your project uses + +- [ ] **Add usage examples** + - Replace template examples with your actual usage + - Add code snippets showing how to use your project + +- [ ] **Remove the warning banner** + - Delete the `⚠️ TEMPLATE FILE` banner at the top + - Remove the "📝 Post-Initialization Checklist" section + +### AGENTS.md +- [ ] **Review and customize patterns** + - Update module organization to match your structure + - Add project-specific commands or workflows + - Remove git worktrees section if not using that workflow + - Update coverage commands to use your module name + +- [ ] **Remove the warning banner** + - Delete the `⚠️ TEMPLATE FILE` banner at the top + +## ⚙️ Configuration Updates + +### pyproject.toml +- [ ] **Update project metadata** + ```toml + name = "your-project-name" + description = "Your project description" + authors = [{ name = "Your Name", email = "your.email@example.com" }] + ``` + +- [ ] **Review dependencies** + - Remove unused template dependencies + - Add your project's specific dependencies + - Update dev dependencies as needed + +- [ ] **Update coverage configuration** + - Ensure `[[MODULE_NAME]]` is replaced with your actual module name + - Adjust coverage threshold if needed (default: 96%) + +### .github/workflows/ci.yml +- [ ] **Review CI workflow** + - The workflow is automatically updated by `make init` + - Verify module name is correct in coverage commands + - Add additional jobs if needed (e.g., deployment, integration tests) + +## 🧹 Code Cleanup + +### Module Structure +- [ ] **Review your module directory** + - Remove or modify `core.py` based on your needs + - Add new modules as needed + - Update `__init__.py` with your public API + +- [ ] **Update test files** + - Rename `test_example.py` to match your modules + - Remove template tests if not applicable + - Add tests for your actual functionality + +### main.py (if needed) +- [ ] **Decide if you need an entrypoint** + - If creating a library: Keep removed (default behavior) + - If creating an application: Create `main.py` with your entry point + - Update `pyproject.toml` to include `[project.scripts]` if needed + +## 🧪 Testing Updates + +- [ ] **Update test configuration** + - Ensure `[[MODULE_NAME]]` is replaced in `pyproject.toml` + - Update coverage source paths if needed + - Add test-specific fixtures in `conftest.py` + +- [ ] **Run tests** + ```bash + pytest + ``` + - Ensure all tests pass + - Check coverage meets the 96% threshold + +## 🚀 CI/CD Updates + +- [ ] **Test CI workflow** + - Push your changes to GitHub + - Verify the CI workflow runs successfully + - Check that coverage reports are generated correctly + +- [ ] **Set up Codecov** (optional) + - If using Codecov, add your repository token to GitHub secrets + - Update `CODECOV_TOKEN` in repository settings + +## 📄 License + +- [ ] **Review license** + - Template uses MIT License + - Update LICENSE file if you need a different license + - Update `license = "MIT"` in `pyproject.toml` if changed + +## 🗑️ Remove Unnecessary Files + +- [ ] **Remove template documentation** + - Delete `POST_INIT_CHECKLIST.md` after completing all steps + - Delete `TEMPLATE_GUIDE.md` (if you no longer need it) + - Consider creating your own contributing guide + +## ✅ Final Verification + +- [ ] **Run all checks** + ```bash + make lint + make pytest + ``` + - Ensure linting passes + - Ensure tests pass with adequate coverage + +- [ ] **Test your project** + - Install your package: `pip install -e .` + - Test your public API + - Verify documentation is clear and accurate + +- [ ] **Commit your changes** + ```bash + git add . + git commit -m "chore: customize project after initialization" + ``` + +## 🎉 You're Done! + +Your project is now fully configured and ready for development. Remember to: + +- Keep documentation updated as you add features +- Maintain test coverage above 96% +- Follow the coding patterns defined in AGENTS.md +- Use conventional commits for your commit messages + +For questions or issues, refer to the project documentation or create an issue in your repository. diff --git a/README.md b/README.md index 5485550..88caa48 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Python Starter Template -[![CI Status](https://github.com/JoshCLWren/python-starter-template/workflows/CI/badge.svg)](https://github.com/JoshCLWren/python-starter-template/actions) +> **⚠️ TEMPLATE FILE - This is a template. After running `make init NAME=your-project`, update this file with your project's specific information.** + +[![CI Status](https://github.com/YOUR_USERNAME/YOUR_REPO/workflows/CI/badge.svg)](https://github.com/YOUR_USERNAME/YOUR_REPO/actions) A modern Python 3.13 project template with best practices, tooling, and CI/CD preconfigured. @@ -26,7 +28,7 @@ cd python-starter-template make init NAME=my-awesome-project # Install dependencies -uv sync --all-extras +uv sync --group dev # Activate the virtual environment (do this once per session) source .venv/bin/activate @@ -34,7 +36,7 @@ source .venv/bin/activate # Run tests pytest -# Run your application +# Run your application (if main.py exists) python main.py --name World --value 42 ``` @@ -48,9 +50,9 @@ python main.py --name World --value 42 ``` 2. **Install dependencies**: - ```bash - uv sync --all-extras - ``` + ```bash + uv sync --group dev + ``` 3. **Activate the virtual environment**: ```bash @@ -62,7 +64,7 @@ python main.py --name World --value 42 Once the virtual environment is activated: ```bash -# Run the application +# Run the application (if main.py exists) python main.py --name World --value 42 # Run tests @@ -90,7 +92,7 @@ ruff format . ``` . -├── example_module/ # Main package (rename via make init) +├── [[MODULE_NAME]]/ # Main package (replace [[MODULE_NAME]] manually as described in the init checklist) │ ├── __init__.py │ └── core.py # Core business logic ├── tests/ # Test suite @@ -101,7 +103,7 @@ ruff format . │ └── workflows/ci.yml # CI pipeline ├── scripts/ │ └── lint.sh # Linting script -├── main.py # Application entrypoint +├── main.py # Application entrypoint (removed for library packages) ├── pyproject.toml # Project configuration ├── uv.lock # Dependency lockfile └── .gitignore # Git ignore rules @@ -122,7 +124,7 @@ pytest -v pytest tests/test_example.py # Run with coverage -pytest --cov=example_module --cov-report=html +pytest --cov=[[MODULE_NAME]] --cov-report=html ``` **Coverage requirement**: Minimum 96% (configured in pyproject.toml) @@ -248,3 +250,16 @@ Template created by Josh Wren - [pytest Documentation](https://docs.pytest.org/) - [ruff Documentation](https://docs.astral.sh/ruff/) - [pyright Documentation](https://microsoft.github.io/pyright/) + +## 📝 Post-Initialization Checklist + +After running `make init NAME=your-project`, complete these steps to customize your project: + +- [ ] Update project title and description in README.md +- [ ] Replace all `[[MODULE_NAME]]` references with your actual module name +- [ ] Update CI badge URLs to point to your repository (replace `YOUR_USERNAME` and `YOUR_REPO`) +- [ ] Update the features list to match your project's specific features +- [ ] Add your actual usage examples and documentation +- [ ] Update LICENSE if needed (currently MIT) +- [ ] Review and update AGENTS.md for your project's specific patterns +- [ ] Remove this checklist section from README.md diff --git a/TEMPLATE_GUIDE.md b/TEMPLATE_GUIDE.md new file mode 100644 index 0000000..2133dbd --- /dev/null +++ b/TEMPLATE_GUIDE.md @@ -0,0 +1,258 @@ +# Python Starter Template Guide + +This guide explains the purpose of this template and how to use it to start a new Python project. + +## 🎯 What This Template Provides + +The Python Starter Template is a **modern, opinionated starting point** for Python 3.13 projects. It includes: + +- **Best Practices**: Preconfigured tooling and code quality standards +- **Fast Development**: uv for lightning-fast dependency management +- **High Quality**: 96% minimum test coverage with automated checks +- **CI/CD Ready**: GitHub Actions workflow for continuous integration +- **Type Safety**: Full type hints with pyright static analysis +- **Clean Code**: Automated linting and formatting with ruff + +### Key Features + +| Feature | Tool | Purpose | +|---------|------|---------| +| Package Manager | **uv** | Fast dependency management and virtual environments | +| Testing | **pytest** | Test runner with coverage reporting | +| Linting | **ruff** | Fast Python linter and formatter | +| Type Checking | **pyright** | Static type analysis | +| CI/CD | **GitHub Actions** | Automated testing on push/PR | +| Pre-commit Hooks | **Custom** | Enforce code quality before commits | + +## 🚀 How to Use This Template + +### Step 1: Create a New Repository + +1. **Clone this template**: + ```bash + git clone https://github.com/JoshCLWren/python-starter-template.git your-project-name + cd your-project-name + ``` + +2. **Initialize your project**: + ```bash + make init NAME=your-project-name + ``` + + This command automates: + - Renaming the module from `example_module` to your package directory/module name (hyphenated project names are normalized: my-project → my_project) + - Updating `pyproject.toml` with your project name + - Updating all Python imports to use the new module name + - Updating CI workflow configuration + - Removing the template's `main.py` (library package structure) + +### Step 2: Install Dependencies + +```bash +uv sync --group dev +``` + +This creates a virtual environment and installs all dependencies. + +### Step 3: Activate Virtual Environment + +```bash +source .venv/bin/activate +``` + +Do this once per terminal session. + +### Step 4: Customize Your Project + +**IMPORTANT**: The template includes placeholder text that needs manual updates. See **POST_INIT_CHECKLIST.md** for a complete guide. + +Key items to update: +- ✏️ README.md - Project title, description, features, usage examples +- ✏️ AGENTS.md - Project-specific patterns and workflows +- ✏️ CI badge URLs - Replace `YOUR_USERNAME` and `YOUR_REPO` +- ✏️ Module name references - Replace `[[MODULE_NAME]]` with your actual module name + +### Step 5: Verify Everything Works + +```bash +# Run tests +pytest + +# Run linting +make lint + +# Run your application (if this is an application with an entrypoint) +# If you initialized a library/package (no main.py), skip this step +python main.py +``` + +## 🤖 What Gets Automated vs Manual + +### ✅ Automated by `make init` + +The `make init` command handles the mechanical renaming: + +| Task | Description | +|------|-------------| +| Module renaming | Renames `example_module/` to your project name | +| Package config | Updates `name` in `pyproject.toml` | +| Import updates | Updates all `from example_module` and `import example_module` statements | +| CI workflow | Updates coverage paths in `.github/workflows/ci.yml` | +| Main cleanup | Removes `main.py` (library package structure) | + +### 📝 Manual Updates Required + +Some items require human judgment and can't be automated: + +| Item | Why Manual? | +|------|-------------| +| Project description | Only you know what your project does | +| Features list | Every project has different features | +| Usage examples | Specific to your project's API | +| CI badge URLs | Requires your GitHub username and repo name | +| License choice | Legal decision varies by project | +| Documentation | Project-specific concepts and patterns | + +## 📚 Template Structure + +```text +python-starter-template/ +├── [[MODULE_NAME]]/ # Your main package (renamed on init) +│ ├── __init__.py +│ └── core.py # Example module (customize or remove) +├── tests/ # Test suite +│ ├── conftest.py # pytest fixtures +│ └── test_example.py # Example tests (customize) +├── .github/ +│ ├── actions/setup/ # CI setup action (installs uv, Python, etc.) +│ └── workflows/ci.yml # CI pipeline (lint + tests) +├── scripts/ +│ └── lint.sh # Linting script (ruff + pyright) +├── .githooks/ +│ └── pre-commit # Pre-commit hook (blocks bad commits) +├── main.py # Application entrypoint (removed on init) +├── pyproject.toml # Project configuration +├── uv.lock # Dependency lockfile +├── Makefile # Convenience commands +├── README.md # Project documentation (UPDATE THIS!) +├── AGENTS.md # AI agent guidelines (UPDATE THIS!) +├── POST_INIT_CHECKLIST.md # Post-init checklist (follow this!) +└── TEMPLATE_GUIDE.md # This file +``` + +## 🔧 Development Workflow + +### Daily Development + +After initialization, your typical workflow is: + +```bash +# Activate venv (once per session) +source .venv/bin/activate + +# Make changes to your code +# ... + +# Run tests +pytest + +# Run linting +make lint + +# Commit (pre-commit hook will run linting) +git add . +git commit -m "feat: add new feature" +``` + +### Key Commands + +| Command | Description | +|---------|-------------| +| `make lint` | Run ruff + pyright checks | +| `make pytest` | Run test suite | +| `make sync` | Install/update dependencies | +| `pytest` | Run tests directly | +| `ruff format .` | Format code | +| `pyright .` | Run type checker | + +## 🎓 Best Practices for Starting a New Project + +### 1. Start Simple + +- Begin with minimal functionality +- Add features incrementally +- Keep test coverage high from the start + +### 2. Follow the Patterns + +- Use type hints everywhere +- Write tests before or with code (TDD) +- Keep functions small and focused +- Use descriptive names (no abbreviations) + +### 3. Leverage the Tooling + +- Let ruff format your code automatically +- Use pyright to catch type errors early +- Run tests frequently while developing +- Trust the pre-commit hook to catch issues + +### 4. Document as You Go + +- Update README.md when adding features +- Add docstrings to public functions +- Keep AGENTS.md current with your project's patterns + +### 5. Commit Often + +- Use conventional commits (`feat:`, `fix:`, `docs:`, etc.) +- Keep commits small and focused +- Let the pre-commit hook enforce quality + +## 🆘 Common Issues + +### Issue: Tests fail after init + +**Solution**: Make sure you've replaced all `[[MODULE_NAME]]` references in `pyproject.toml` with your actual module name. + +### Issue: CI fails on GitHub + +**Solution**: Update the CI badge URL in README.md to use your username and repo. + +### Issue: Can't import my module + +**Solution**: Make sure you've activated the virtual environment: `source .venv/bin/activate` + +### Issue: Pre-commit hook blocking commits + +**Solution**: This is intentional! Fix the linting/type errors before committing. Run `make lint` to see what's wrong. + +## 📖 Additional Resources + +- [uv Documentation](https://docs.astral.sh/uv/) - Fast Python package manager +- [pytest Documentation](https://docs.pytest.org/) - Testing framework +- [ruff Documentation](https://docs.astral.sh/ruff/) - Linter and formatter +- [pyright Documentation](https://microsoft.github.io/pyright/) - Type checker +- [Conventional Commits](https://www.conventionalcommits.org/) - Commit message standard + +## 🤝 Contributing to the Template + +If you find issues with the template or have suggestions for improvements: + +1. Check existing issues at https://github.com/JoshCLWren/python-starter-template/issues +2. Create a new issue with details +3. Consider submitting a pull request with your improvements + +## 📄 License + +This template is released under the MIT License. Feel free to use it for your own projects. + +## 🙏 Acknowledgments + +Created by Josh Wren as a starting point for modern Python projects. + +--- + +**Happy coding! 🎉** + +Remember to follow the **POST_INIT_CHECKLIST.md** after running `make init` to customize your project properly. diff --git a/example_module/__init__.py b/example_module/__init__.py index b9fca95..1a55590 100644 --- a/example_module/__init__.py +++ b/example_module/__init__.py @@ -1 +1,3 @@ """Example module.""" + +__version__ = "0.1.0" diff --git a/pyproject.toml b/pyproject.toml index 71ad987..f7e1266 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,21 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + [project] name = "python-starter-template" version = "0.1.0" description = "Python starter template with best practices" readme = "README.md" requires-python = ">=3.13" +license = "MIT" +authors = [{ name = "Josh Wren" }] dependencies = [] -[project.optional-dependencies] +[tool.hatch.build.targets.wheel] +packages = ["example_module"] + +[dependency-groups] dev = [ "pytest>=8.0.0", "pytest-cov>=4.0.0", diff --git a/uv.lock b/uv.lock index a0d7535..d4b6cee 100644 --- a/uv.lock +++ b/uv.lock @@ -163,9 +163,9 @@ wheels = [ [[package]] name = "python-starter-template" version = "0.1.0" -source = { virtual = "." } +source = { editable = "." } -[package.optional-dependencies] +[package.dev-dependencies] dev = [ { name = "pyright" }, { name = "pytest" }, @@ -174,13 +174,14 @@ dev = [ ] [package.metadata] -requires-dist = [ - { name = "pyright", marker = "extra == 'dev'", specifier = ">=1.1.0" }, - { name = "pytest", marker = "extra == 'dev'", specifier = ">=8.0.0" }, - { name = "pytest-cov", marker = "extra == 'dev'", specifier = ">=4.0.0" }, - { name = "ruff", marker = "extra == 'dev'", specifier = ">=0.1.0" }, + +[package.metadata.requires-dev] +dev = [ + { name = "pyright", specifier = ">=1.1.0" }, + { name = "pytest", specifier = ">=8.0.0" }, + { name = "pytest-cov", specifier = ">=4.0.0" }, + { name = "ruff", specifier = ">=0.1.0" }, ] -provides-extras = ["dev"] [[package]] name = "ruff"