Thank you for your interest in contributing to Stream! This guide will help you get started with development, testing, and submitting changes.
- Python 3.11+
- Poetry (recommended) or pip
- Git
# Install Poetry (if not already installed)
curl -sSL https://install.python-poetry.org | python3 -
# Clone the repository
git clone https://github.com/CHU-Brest/Stream.git
cd Stream
# Install dependencies
poetry install
# Activate the virtual environment
poetry shell# Clone the repository
git clone https://github.com/CHU-Brest/Stream.git
cd Stream
# Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt# Generate synthetic medical reports using the Brest pipeline
python cli.py brest --n-sejours 100
# Generate using the AP-HP pipeline
python cli.py aphp --n-sejours 100- Follow PEP 8 for Python code style.
- Use Google-style docstrings for all public functions and classes.
- Use type hints for all function signatures and variables where applicable.
We use the following tools to enforce code quality:
black: Code formatterflake8: Lintermypy: Static type checker
To run these tools:
# Format code with black
black .
# Lint code with flake8
flake8 .
# Check types with mypy
mypy .- Use Conventional Commits for commit messages.
- Examples:
feat: add new pipeline for XYZ data sourcefix: handle empty data in get_fictivedocs: update README with installation instructionsrefactor: decompose pipeline into smaller modules
# Run all tests
pytest tests/ -v
# Run a specific test file
pytest tests/test_pipelines.py -v
# Run tests with coverage
pytest --cov=pipelines tests/ -v- Follow the pytest framework conventions.
- Test both happy paths and edge cases.
- Use mocks for external dependencies (e.g., LLM APIs, file I/O).
Aim for >= 80% test coverage for all new code. Use pytest-cov to measure coverage:
pytest --cov=pipelines --cov-report=html tests/-
Fork the repository and create a feature branch:
git checkout -b feat/my-feature
-
Ensure your code passes all checks:
black . flake8 . mypy . pytest tests/ -v
-
Update documentation if your changes affect the API or usage.
-
Rebase your branch onto the latest
mainbranch:git fetch origin git rebase origin/main
-
Push your branch to your fork:
git push origin feat/my-feature
-
Open a Pull Request against the
mainbranch of the upstream repository. -
Fill in the PR template with:
- A clear description of the changes
- Related issues (if any)
- Screenshots (if UI changes)
-
Wait for review and address any feedback.
- All PRs require at least one approval from a maintainer.
- PRs will be merged using squash merge to keep history clean.
- Once approved, a maintainer will merge your PR.
- Update
README.mdfor user-facing changes. - Update
TODOS.mdfor planned features/improvements. - Update
CONTRIBUTING.mdif contribution guidelines change.
We use Sphinx to generate API documentation:
# Install Sphinx
pip install sphinx sphinx-rtd-theme
# Generate docs
cd docs
make htmlBy participating in this project, you agree to abide by the Contributor Covenant Code of Conduct.
For questions or discussions, please open an issue or join our Discussions.
Last updated: 2024-04-06