Contributing
Thank you for your interest in contributing to FastAPI Environment Banner! This document provides guidelines and instructions for contributing.
Getting Started
Prerequisites
- Python 3.12 or higher
- pip or uv for package management
- Git
Development Setup
- Fork and clone the repository
- Install development dependencies
Or with uv:
- Verify installation
Running Tests
Run all tests
Run with coverage
Run specific test file
Run specific test
Code Style
- Follow PEP 8 guidelines
- Use type hints for all function parameters and return values
- Write docstrings for all public functions and classes
- Keep functions focused and single-purpose
- Maximum line length: 100 characters
Example
def get_banner_color(self) -> str:
"""Get the banner background color based on environment.
Returns:
str: Hexadecimal color code
"""
if self.custom_color:
return self.custom_color
return self.color_map.get(self.environment, "#4CAF50")
Testing Guidelines
- Write tests for all new features
- Ensure tests cover both happy path and edge cases
- Aim for >90% code coverage
- Use descriptive test names
- Group related tests in classes
Test Structure
class TestFeatureName:
"""Tests for feature description."""
def test_happy_path(self):
"""Test the expected behavior."""
# Arrange
config = EnvBannerConfig()
# Act
result = config.get_banner_color()
# Assert
assert result == "#4CAF50"
def test_edge_case(self):
"""Test edge case behavior."""
# Test implementation
Pull Request Process
- Create a feature branch
- Make your changes
- Write code
- Add tests
-
Update documentation
-
Run tests and ensure they pass
- Commit your changes
- Push to your fork
- Open a Pull Request
- Go to the original repository
- Click "New Pull Request"
- Select your branch
- Fill in the PR template
- Submit the PR
Pull Request Checklist
- [ ] Tests pass locally
- [ ] Code follows project style guidelines
- [ ] Documentation is updated
- [ ] Commit messages are clear and descriptive
- [ ] No unnecessary files are included
- [ ] Branch is up to date with main
Bug Reports
When reporting bugs, please include:
- Description: Clear description of the bug
- Steps to Reproduce: Minimal steps to reproduce the issue
- Expected Behavior: What you expected to happen
- Actual Behavior: What actually happened
- Environment: Python version, OS, library version
- Code Sample: Minimal code that reproduces the issue
Feature Requests
When requesting features, please include:
- Use Case: Why is this feature needed?
- Proposed Solution: How should it work?
- Alternatives: Other solutions you've considered
- Additional Context: Any other relevant information
Documentation
- Update README.md for user-facing changes
- Add docstrings to all new functions and classes
- Update examples if behavior changes
- Keep documentation clear and concise
Release Process
Releases are managed by maintainers. The process includes:
- Update version in
pyproject.toml - Update CHANGELOG.md
- Create a git tag
- Build and publish to PyPI
Questions?
If you have questions, feel free to:
- Open an issue for discussion
- Check existing issues and PRs
- Review the documentation
Code of Conduct
- Be respectful and inclusive
- Provide constructive feedback
- Focus on what is best for the community
- Show empathy towards others
Thank you for contributing! 🎉