Thank you for your interest in contributing to LZGraphs! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- Running Tests
- Code Style
- Submitting Changes
- Reporting Issues
Please be respectful and constructive in all interactions. We welcome contributions from everyone regardless of experience level.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/LZGraphs.git cd LZGraphs - Add the upstream repository:
git remote add upstream https://github.com/MuteJester/LZGraphs.git
- Python 3.8 or higher
- pip or conda for package management
-
Create a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install the package in development mode with dev dependencies:
pip install -e ".[dev]" -
Install pre-commit hooks:
pre-commit install
Run the full test suite:
pytest tests/ -vRun tests with coverage:
pytest tests/ --cov=src/LZGraphs --cov-report=term-missingRun a specific test file:
pytest tests/test_aap_lzgraph.py -vRun tests matching a pattern:
pytest tests/ -k "test_walk" -vWe use the following tools to maintain code quality:
- Black - Code formatting (line length: 100)
- isort - Import sorting
- Ruff - Linting
Format all code:
black src/LZGraphs tests
isort src/LZGraphs testsCheck formatting without changes:
black --check src/LZGraphs tests
isort --check-only src/LZGraphs testsRun the linter:
ruff check src/LZGraphs testsFix auto-fixable issues:
ruff check --fix src/LZGraphs testsPre-commit hooks run automatically on each commit. To run manually:
pre-commit run --all-filesUse descriptive branch names:
feature/add-new-metric- New featuresfix/walk-probability-error- Bug fixesdocs/update-api-reference- Documentationrefactor/optimize-graph-creation- Refactoring
We use Conventional Commits for automatic versioning and changelog generation. Your commit messages directly control version bumps:
Format:
<type>(<optional scope>): <description>
[optional body]
[optional footer]
Types and their effects:
| Type | Version Bump | Description |
|---|---|---|
feat |
Minor (1.x.0) | New feature for users |
fix |
Patch (1.1.x) | Bug fix for users |
perf |
Patch (1.1.x) | Performance improvement |
docs |
No bump | Documentation only |
style |
No bump | Formatting, missing semicolons, etc. |
refactor |
No bump | Code change that neither fixes a bug nor adds a feature |
test |
No bump | Adding or correcting tests |
chore |
No bump | Maintenance tasks |
ci |
No bump | CI/CD changes |
build |
No bump | Build system changes |
Breaking Changes (Major version bump):
Add BREAKING CHANGE: in the footer or ! after the type:
feat!: remove deprecated walk_probability parameter
BREAKING CHANGE: The `legacy_mode` parameter has been removed.
Examples:
# Patch release (1.1.1 -> 1.1.2)
git commit -m "fix: correct edge weight calculation for sparse graphs"
# Minor release (1.1.2 -> 1.2.0)
git commit -m "feat: add jensen-shannon divergence metric"
# Major release (1.2.0 -> 2.0.0)
git commit -m "feat!: redesign graph serialization API"
# No release (documentation)
git commit -m "docs: update API reference for random walks"
# With scope
git commit -m "fix(metrics): handle empty repertoire in k1000"
# With issue reference
git commit -m "fix: resolve memory leak in large graphs
Closes #42"Important: Commits that don't follow this format won't trigger releases!
-
Create a new branch from
master:git checkout master git pull upstream master git checkout -b feature/your-feature
-
Make your changes and commit them
-
Push to your fork:
git push origin feature/your-feature
-
Open a Pull Request on GitHub
-
Ensure all checks pass (tests, linting)
-
Request a review from maintainers
- Tests pass locally (
pytest tests/ -v) - Code is formatted (
black,isort) - Linting passes (
ruff check) - New features have tests
- Documentation is updated if needed
- Commit messages follow Conventional Commits format
When reporting bugs, please include:
- Description: Clear description of the bug
- Steps to Reproduce: Minimal code example
- Expected Behavior: What should happen
- Actual Behavior: What actually happens
- Environment:
- Python version
- LZGraphs version
- Operating system
- Relevant package versions
Example:
## Description
`walk_probability` raises KeyError for valid sequences
## Steps to Reproduce
```python
from LZGraphs import AAPLZGraph
import pandas as pd
data = pd.DataFrame({'cdr3_amino_acid': ['CASSLGQAYEQYF']})
graph = AAPLZGraph(data)
prob = graph.walk_probability('CASSLGQAYEQYF') # Raises KeyErrorShould return the probability of the sequence
Raises KeyError: 'node_name'
- Python 3.10.4
- LZGraphs 1.1.1
- Ubuntu 22.04
### Feature Requests
For feature requests, please describe:
1. **Use Case**: Why is this feature needed?
2. **Proposed Solution**: How should it work?
3. **Alternatives**: Other approaches considered
## Questions?
Feel free to open an issue for questions or reach out to the maintainers.
Thank you for contributing!