Development Workflow¶
This document outlines the recommended development workflow for the ezpz project.
Overview¶
The ezpz project uses a modern Python development workflow with automated testing, linting, formatting, and continuous integration.
Development Environment Setup¶
Prerequisites¶
- Python 3.8 or higher
- Git
- Virtual environment tool (venv, conda, or hatch)
Quick Setup¶
-
Clone the repository:
-
Create and activate virtual environment:
-
Install development dependencies:
Using Hatch (Recommended)¶
The project is configured to use Hatch for environment management:
-
Install Hatch:
-
Enter development environment:
-
Run tests:
Code Quality Tools¶
Formatting and Linting¶
The project uses several tools to maintain code quality:
- Ruff: Fast Python linter and formatter
- Black: Code formatter
- isort: Import sorter
- mypy: Static type checker
Running Code Quality Tools¶
Pre-commit Hooks¶
Pre-commit hooks automatically run code quality tools before each commit:
-
Install pre-commit:
-
Install git hooks:
The hooks will automatically check and format your code on each commit.
Testing¶
Running Tests¶
Test Structure¶
Tests are organized in the tests/
directory with the following structure:
test_basic.py
- Smoke tests to verify the test framework workstest_unit_isolated.py
- Isolated unit tests that don't require full importstest_*_improved.py
- Improved tests with proper mockingtest_integration.py
- Integration tests for core functionality
Writing Tests¶
Follow these guidelines when writing new tests:
- Use descriptive test names that clearly describe what is being tested
- Test one thing per test - Each test should focus on a single behavior
- Use fixtures for setup/teardown - Avoid code duplication in test setup
- Mock external dependencies - Isolate the code under test
- Test edge cases - Include tests for boundary conditions and error cases
Test Categories¶
- Unit Tests: Focused tests for individual functions and classes
- Integration Tests: Tests that verify interaction between components
- Property-Based Tests: Tests that use hypothesis to verify properties with random inputs
- Mock-Based Tests: Tests that use mocking to avoid external dependencies
Continuous Integration¶
GitHub Actions Workflow¶
The project uses GitHub Actions for continuous integration with the following jobs:
- Test: Runs tests on multiple Python versions
- Lint: Runs code quality checks (ruff, black, isort)
- Security: Runs security scanning with bandit
- Docs: Builds documentation
- Deploy: Deploys documentation to GitHub Pages
Pull Request Process¶
-
Create a feature branch:
-
Make your changes and add tests
-
Run tests locally:
-
Format your code:
-
Commit your changes:
-
Push to GitHub:
-
Create a pull request
Code Review Process¶
All pull requests must be reviewed before merging:
- At least one approval from a maintainer
- All CI checks must pass
- Code quality standards must be met
- Tests must pass and provide adequate coverage
Release Process¶
Versioning¶
The project follows Semantic Versioning (SemVer):
- MAJOR version for incompatible API changes
- MINOR version for backward-compatible functionality additions
- PATCH version for backward-compatible bug fixes
Creating a Release¶
-
Update version in
src/ezpz/__about__.py
-
Update CHANGELOG.md with release notes
-
Create and push tag:
-
Create GitHub release with release notes
Best Practices¶
Code Organization¶
- Follow PEP 8 for code style
- Use type hints for all function signatures
- Write docstrings for all public functions and classes
- Keep functions small and focused on a single responsibility
- Use meaningful variable names
Testing Best Practices¶
- Write tests first when possible (TDD)
- Test both positive and negative cases
- Use appropriate assertions for the job
- Keep tests fast - avoid slow operations in unit tests
- Mock external dependencies to isolate units under test
Documentation Best Practices¶
- Keep README.md updated with current usage examples
- Document all public APIs with docstrings
- Include examples in docstrings when helpful
- Update CHANGELOG.md with all notable changes
- Write clear commit messages that explain the "why"
Git Best Practices¶
- Make small, focused commits that address a single issue
- Write clear commit messages following conventional commits
- Rebase feature branches to keep history clean
- Use meaningful branch names like
feature/add-new-functionality
- Delete merged branches to keep the repository clean