Contributing¶
Thank you for your interest in contributing to Portfolio Analysis!
Ways to Contribute¶
- Report bugs: Open an issue with a minimal reproducible example
- Suggest features: Open an issue describing your use case
- Submit PRs: Fix bugs or implement new features
- Improve docs: Fix typos, add examples, clarify explanations
- Share: Star the repo, tweet about it, write a blog post
Development Setup¶
# Clone the repo
git clone https://github.com/engineerinvestor/Portfolio-Analysis.git
cd Portfolio-Analysis
# Create virtual environment
python -m venv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows
# Install with dev dependencies
pip install -e ".[all]"
# Install pre-commit hooks
pip install pre-commit
pre-commit install
Running Tests¶
# Run all tests
pytest tests/ -v
# Run with coverage
pytest tests/ -v --cov=portfolio_analysis --cov-report=html
# Run specific test file
pytest tests/test_factors.py -v
Code Style¶
We use:
- Black for code formatting
- Ruff for linting
- NumPy-style docstrings
Pull Request Process¶
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes
- Add tests for new functionality
- Run tests and linting
- Commit with a clear message
- Push and open a PR
Commit Messages¶
Use clear, descriptive commit messages:
Add rolling factor regression support
- Implement run_rolling_regression() method
- Add window parameter for configurable lookback
- Include tests for edge cases
Adding New Features¶
When adding new features:
- Discuss first: Open an issue to discuss the design
- Write tests: Aim for >80% coverage of new code
- Add docstrings: NumPy-style with Parameters/Returns sections
- Update docs: Add to user guide and API reference
- Add example: Show how to use the feature
Questions?¶
- Open a GitHub Discussion
- Tweet @egr_investor