Thank you for your interest in contributing to QuantPits! Whether it's a bug fix, a new feature, or documentation improvement, we appreciate your effort to make this project better.
- Code of Conduct
- How Can I Contribute?
- Getting Started
- Development Workflow
- Coding Standards
- Commit Messages
- Pull Request Process
- Reporting Bugs
- Suggesting Features
By participating in this project, you agree to maintain a respectful and inclusive environment. Please be considerate and constructive in all interactions.
| Contribution Type | Description |
|---|---|
| 🐛 Bug Fixes | Fix issues reported in GitHub Issues |
| ✨ New Features | Add new models, scripts, or analytics capabilities |
| 📝 Documentation | Improve guides in docs/, README, or inline comments |
| 🧪 Testing | Add or improve tests for existing functionality |
| 🔧 Refactoring | Improve code quality without changing behavior |
| 🌐 Translation | Improve the Chinese (README_zh.md) or other translations |
- Python 3.8 – 3.12
- A working Microsoft Qlib installation
- (Optional) CUDA-compatible GPU + CuPy for brute force acceleration
-
Fork the repository and clone your fork:
git clone https://github.com/<your-username>/QuantPits.git cd QuantPits
-
Create a virtual environment (recommended):
conda create -n quantpits python=3.10 conda activate quantpits
-
Install dependencies:
pip install -r requirements.txt pip install -e . # Install in editable mode
-
Activate a workspace to test your changes:
source workspaces/Demo_Workspace/run_env.sh
-
Create a feature branch from
main:git checkout -b feature/your-feature-name # or git checkout -b fix/your-bug-description -
Make your changes in small, focused commits.
-
Test your changes manually by running the relevant pipeline step in
Demo_Workspace:# Example: test prediction pipeline python -m quantpits.scripts.prod_predict_only --all-enabled -
Push to your fork and open a Pull Request.
- Follow PEP 8 conventions.
- Use 4 spaces for indentation (no tabs).
- Maximum line length: 120 characters.
- Use meaningful, descriptive variable and function names.
- Engine / Workspace separation: All reusable logic belongs in
quantpits/. Workspace-specific files (configs, data, outputs) must never be hardcoded — always resolve paths relative to the active workspace viaenv.py. - Configuration: Use YAML files for workflow parameters. Avoid hardcoding magic numbers in scripts.
- Logging: Use Python's
loggingmodule; avoid bareprint()statements in library code. - Imports: Group imports in the standard order — stdlib, third-party, local — separated by blank lines.
- Update the relevant
docs/*.mdfile if your change modifies user-facing behavior. - All new scripts or significant functions should include docstrings.
Follow the Conventional Commits format:
<type>(<scope>): <short description>
[optional body]
Types: feat, fix, docs, refactor, test, chore, perf
Examples:
feat(ensemble): add correlation-weighted fusion strategy
fix(order_gen): correct TopK selection when holdings are empty
docs(training): update incremental training guide with GPU notes
refactor(scripts): extract common arg parsing into shared module
-
Ensure your branch is up to date with
main:git fetch upstream git rebase upstream/main
-
Fill out the Pull Request template completely, including:
- A clear description of what and why.
- The type of change (bug fix / feature / docs / breaking change).
- How you tested your changes.
-
Review checklist (from the PR template):
- Code follows project style guidelines
- Self-reviewed
- Comments added where necessary
- Documentation updated if applicable
- No new warnings generated
-
A maintainer will review your PR. Please be responsive to feedback — we aim to review PRs within one week.
-
Once approved, a maintainer will squash-merge your PR into
main.
Use the Bug Report template to file a bug. Please include:
- Your Python version and OS
- Qlib version
- Steps to reproduce
- Expected vs. actual behavior
- Relevant logs or error messages
Open a GitHub Issue with the title prefixed by [Feature Request] and describe:
- The problem you're trying to solve.
- Your proposed solution and any alternatives you've considered.
- Context — which workspace setup or pipeline step is involved.
Thank you for contributing to QuantPits! 🎉
This project uses pytest for unit testing. We encourage writing tests for all new features and bug fixes.
- Framework:
pytestis the primary test runner. We also usepytest-covfor coverage reporting andunittest.mockfor mocking dependencies. - Directory Structure: Tests are located in the
tests/directory, which mirrors the structure of thequantpits/package. - Running Tests: Use the following command to run the test suite and generate a coverage report:
pytest tests/ -v --cov=quantpits
- Mocking: When writing tests for modules that interact with the file system (
env.py,train_utils.py) or external libraries like Qlib, useunittest.mock.patchor thepytest-mockplugin to isolate the unit under test. Global fixtures are defined intests/conftest.py.