Development Guide
This guide covers the development workflow, release process, and PyPI publishing for PyEPISuite.
๐ ๏ธ Development Setup
1. Clone and Install for Development
# Clone the repository
git clone https://github.com/USEtox/PyEPISuite.git
cd PyEPISuite
# Install in development mode with all dependencies
pip install -e ".[dev,docs]"
2. Development Dependencies
The development environment includes: - Testing: pytest, pytest-cov - Code Quality: black, isort, mypy, flake8 - Documentation: mkdocs, mkdocs-material, mkdocstrings
๐งช Testing and Quality Assurance
Run Tests
# Run all tests
pytest
# Run tests with coverage
pytest --cov=src/pyepisuite --cov-report=html
# Run specific test file
pytest tests/test_api_client.py
Code Formatting and Linting
# Format code with black
black src tests
# Sort imports with isort
isort src tests
# Lint with flake8
flake8 src tests
# Type checking with mypy
mypy src
Pre-commit Checks
Run all quality checks before committing:
# Format and lint
black src tests
isort src tests
flake8 src tests
mypy src
# Run tests
pytest --cov=src/pyepisuite
๐ Documentation
Local Development
Documentation Structure
docs/
- Main documentation sourcemkdocs.yml
- Documentation configuration- Auto-generated API docs from docstrings
๐ Release Process
1. Prepare for Release
-
Update Version Number
-
Update Changelog
-
Run Full Test Suite
-
Test Installation
2. Create Release on GitHub
-
Commit and Push Changes
-
Create GitHub Release
- Go to https://github.com/USEtox/PyEPISuite/releases
- Click "Create a new release"
- Tag version:
v0.1.0
(matching pyproject.toml version) - Release title:
PyEPISuite v0.1.0
- Add release notes from CHANGELOG.md
-
Click "Publish release"
-
Automated Publishing
- GitHub Actions will automatically trigger
- Package will be built and published to PyPI
- Monitor the workflow at: https://github.com/USEtox/PyEPISuite/actions
๐ฆ PyPI Publishing Setup
1. PyPI Account Setup
- Create PyPI Account
- Register at https://pypi.org/account/register/
-
Verify email address
-
Create TestPyPI Account
- Register at https://test.pypi.org/account/register/
- This is for testing releases
2. GitHub Repository Configuration
- Set up Trusted Publishing
- Go to PyPI โ Account Settings โ API tokens
-
Create a new "Pending publisher" for your repository:
- PyPI Project Name:
pyepisuite
- Owner:
USEtox
- Repository:
PyEPISuite
- Workflow:
publish.yml
- Environment:
pypi
- PyPI Project Name:
-
GitHub Environments
- Go to repository Settings โ Environments
- Create environments:
pypi
(for production releases)testpypi
(for testing)
- Add protection rules if desired
3. Manual Publishing (Alternative)
If you need to publish manually:
# Install build tools
pip install build twine
# Build the package
python -m build
# Upload to TestPyPI (for testing)
twine upload --repository testpypi dist/*
# Upload to PyPI (production)
twine upload dist/*
๐ Workflow Options
Automatic Release (Recommended)
- Update version in
pyproject.toml
- Create GitHub release
- Publishing happens automatically
Manual Testing
- Use workflow_dispatch to publish to TestPyPI
- Test installation:
pip install -i https://test.pypi.org/simple/ pyepisuite
- Create release for PyPI publishing
Emergency Hotfix
- Create hotfix branch
- Make necessary changes
- Update version (patch increment)
- Create release directly from hotfix branch
๐ Release Checklist
Pre-Release
- [ ] All tests pass locally
- [ ] Code formatted and linted
- [ ] Version updated in
pyproject.toml
- [ ] Changelog updated
- [ ] Documentation builds successfully
- [ ] Breaking changes documented
Release
- [ ] GitHub release created with proper tag
- [ ] Release notes include all changes
- [ ] Automated workflow completed successfully
- [ ] Package available on PyPI
- [ ] Installation tested:
pip install pyepisuite
Post-Release
- [ ] Announcement on relevant channels
- [ ] Documentation deployed
- [ ] Version bump for next development cycle
- [ ] Known issues documented
๐ Troubleshooting
Common Issues
-
Build Fails
-
Tests Fail in CI
-
PyPI Upload Fails
- Check version number isn't already used
- Verify trusted publishing is configured
-
Check GitHub environment settings
-
Import Errors After Installation
Getting Help
- Check GitHub Actions logs for detailed error messages
- Review PyPI upload logs
- Open an issue on GitHub for persistent problems
๐ง Advanced Configuration
Custom Build Configuration
Edit pyproject.toml
for custom build settings:
[tool.setuptools.package-data]
pyepisuite = ["data/**/*"]
[tool.setuptools.exclude-package-data]
pyepisuite = ["*.pyc", "__pycache__"]
Development Scripts
Add to pyproject.toml
:
Environment Variables
For local development:
# Set environment variables
export PYEPISUITE_DEBUG=1
export PYEPISUITE_API_URL=https://episuite.dev/api
๐ Support
For development questions: - Open an issue on GitHub - Check existing documentation - Review similar projects for patterns