Contributing to FatPy¶
Thank you for considering contributing to FatPy, a Python package for fatigue life evaluation of materials, part of the FABER project! Your contributions help improve open source tools for fatigue analysis. Start with these steps to make an impact.
Quick Start¶
Get started contributing to FatPy in a few simple steps:
- Fork the Repository
Create a personal copy on GitHub. - Clone Your Fork
- Create a Branch
- Write Tests for Your Feature
Define expected behavior first. - Implement the Feature
Write code to pass your tests. - Submit a Pull Request
Share your changes for review.
Development Setup¶
Setting Up Your Environment¶
# Clone the repository
git clone https://github.com/your-username/FatPy.git
cd FatPy
# Using uv (recommended)
uv venv
.venv\Scripts\activate # On Unix: source .venv/bin/activate
uv sync
uv pip install -e .
pre-commit install
# Using pip
python -m venv venv
venv\Scripts\activate # On Unix: source venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -e .
pre-commit install
For detailed configuration of your development environment, see the Installation Guide
Test-Driven Development¶
FatPy follows Test-Driven Development (TDD) principles¶
- Write the test first
Define what the code should do before implementing it - See the test fail
Run the test to confirm it fails without the implementation - Write the minimal code
Implement just enough code to make the test pass - Run the test
Verify the implementation meets the requirements - Refactor
Clean up the code while ensuring tests still pass - Repeat
Use the same principles for next feature
For more details, see the Testing Guide
Run tests regularly¶
# Run all tests
pytest
# Run specific test file
pytest tests/core/test_specific_module.py
# Test with coverage
pytest --cov=src/fatpy --cov-report=html
Coding Standards¶
FatPy aims for high code quality utilizing these tools:
- Ruff - Linting and formatting for consistent code style.
- MyPy - Static type checking for reliability.
- Pre-commit - Automated checks before commits.
Follow our coding standards for contributions, see Code Style Guide
Running Code Quality Checks¶
# Run linting
ruff check .
# Apply fixes automatically
ruff check --fix .
# Format code
ruff format .
# Run type checking
mypy .
# Run pre-commit on all files
pre-commit run --all-files
Documentation¶
Keep FatPyβs documentation clear and up-to-date with these guidelines:
- API Changes
Update documentation for any API modifications. - Docstrings
Add docstrings following Google style to all new code. - Examples
Include examples and mathematical formulas where helpful to aid users.
Learn best practices and guidelines for documentation, see Documentation Guide
Building Documentation¶
# Activate project environment
.\{environment_name}\Scripts\activate
# Build and serve documentation locally
mkdocs serve
Pull Request Process¶
Submit a high-quality pull request with these steps:
- Run Tests and Checks
Ensure tests pass and code quality checks succeed. - Update Documentation
Reflect changes in relevant docs. - Link Issues
Reference related GitHub issues. - Follow guidelines
Make sure your code follows the project's style guidelines. - Await Review
Respond to feedback from maintainers.
Code of Conduct¶
All contributors must follow our standards.
Understand our expectations for collaboration, see Code of Conduct
Ideas and Questions¶
Join discussion, create an issue or reach out to maintainers:
GitHub Discussions
Join for community support.Report an Issue
Create an issue on our GitHub repository for bugs or questions.Contact our Team
Visit our contact page.
Thank you for contributing to FatPy!