Contributing to AI-Graphο
We welcome contributions to AI-Graph! This guide will help you get started with contributing to the project.
π― Ways to Contributeο
Bug Reports: Report issues you encounter
Feature Requests: Suggest new features or improvements
Code Contributions: Submit bug fixes or new features
Documentation: Improve or add documentation
Testing: Add tests or improve test coverage
Examples: Create examples showing how to use AI-Graph
π Getting Startedο
1. Fork the Repositoryο
Fork the AI-Graph repository on GitHub.
2. Clone Your Forkο
git clone https://github.com/your-username/ai-graph.git cd ai-graph
3. Set Up Development Environmentο
Prerequisites
To generate docs and serve it locally, you need to have pandoc installed.
sudo apt update sudo apt install -y pandocImportant
We highly recommend using uv for managing dependencies and virtual environments. uv is a fast Python package manager and virtual environment tool. For more information, see the uv documentation.
Quick Installation
pipx install uvCheck Installation:
uv --versionSetup development environment with `uv`:
uv venv .venv source .venv/bin/activate uv sync --dev
4. Create a Branchο
git checkout -b feature/your-feature-name
π Development Guidelinesο
Code Styleο
We use several tools to maintain code quality:
Black: Code formatting
isort: Import sorting
flake8: Linting
mypy: Type checking
Run all checks:
# Format code
black ai_graph tests
isort ai_graph tests
# Check for issues
flake8 ai_graph tests
mypy ai_graph
We additinally prepared a pre-commit that help you to do this checks automatically when you commite the codes.
Pre-commit Setupο
pre-commit install
Testingο
We maintain 100% test coverage. All contributions must include tests.
# Run tests
pytest
# Run with coverage
pytest --cov=ai_graph --cov-report=term-missing
# Run specific test
pytest tests/test_pipeline.py::test_specific_function
Writing Testsο
Test Structure: Use the AAA pattern (Arrange, Act, Assert)
Test Names: Use descriptive names that explain what is being tested
Edge Cases: Test both happy path and edge cases
Fixtures: Use pytest fixtures for common setup
Example test:
import pytest
class TestClassName:
class TestMethod1:
def test_case1(self):
assert True
def test_case2(self):
assert True
class TestMethod2:
def test_case1(self):
assert True
def test_case2(self):
assert True
class TestFunctionName:
def test_case1(self):
assert True
def test_case2(self):
assert True
Documentationο
Docstrings: All public methods must have docstrings
Type Hints: Use type hints for all function parameters and return values
Examples: Include usage examples in docstrings
RST Format: Use reStructuredText format for documentation
Example docstring:
def process(self, data: Any) -> Any:
"""
Process the input data.
Args:
data: The input data to process
Returns:
The processed data
Raises:
ValueError: If the input data is invalid
Example:
>>> step = MyStep()
>>> result = step.process("input")
>>> print(result)
"processed input"
"""
π§ Development Workflowο
Create an Issue Before starting work, create an issue describing the bug or feature.
Write Tests First For new features, write tests that fail initially.
Implement the Feature Write the minimal code to make tests pass.
Run All Checks
# Run all checks black ai_graph tests isort ai_graph tests flake8 ai_graph tests mypy ai_graph pytest --cov=ai_graph --cov-report=term-missing
Update Documentation Update relevant documentation and examples.
Commit Your Changes
git add . git commit -m "feat: add new feature description"
Push and Create PR
git push origin feature/your-feature-name
π Commit Message Guidelinesο
We use conventional commits for clear commit messages:
feat: A new feature
fix: A bug fix
docs: Documentation changes
test: Adding or updating tests
refactor: Code changes that neither fix a bug nor add a feature
style: Code style changes (formatting, etc.)
chore: Maintenance tasks
Examples:
feat: add progress tracking to ForEach step
fix: handle None values in pipeline execution
docs: update API documentation for BaseStep
test: add tests for error handling in pipelines
π Bug Reportsο
When reporting bugs, please include:
Clear Title: Describe the issue briefly
Steps to Reproduce: Exact steps to reproduce the issue
Expected Behavior: What should happen
Actual Behavior: What actually happens
Environment: Python version, OS, AI-Graph version
Code Sample: Minimal code that reproduces the issue
Bug Report Template:
**Bug Description**
A clear description of the bug.
**Steps to Reproduce**
1. Create a pipeline with...
2. Add a step that...
3. Run the pipeline...
4. See error
**Expected Behavior**
The pipeline should...
**Actual Behavior**
The pipeline throws...
**Environment**
- Python version: 3.12
- AI-Graph version: 0.1.0
- OS: Ubuntu 22.04
**Code Sample**
```python
# Minimal code that reproduces the issue
```
π‘ Feature Requestsο
When requesting features:
Use Case: Explain the problem youβre trying to solve
Proposed Solution: Describe your proposed solution
Alternatives: Consider alternative approaches
Impact: Explain how this would benefit users
Feature Request Template:
**Feature Description**
A clear description of the feature.
**Use Case**
Explain the problem this feature would solve.
**Proposed Solution**
Describe your proposed implementation.
**Alternatives**
List alternative solutions you've considered.
**Additional Context**
Any other context or examples.
π Code Review Processο
Automated Checks: All PRs run automated checks (tests, linting, etc.)
Manual Review: Maintainers review code for correctness and style
Feedback: Address any feedback from reviewers
Approval: PRs need approval from at least one maintainer
Merge: Once approved, PRs are merged into main
π Documentation Contributionsο
Documentation contributions are highly valued:
API Documentation: Auto-generated from docstrings
User Guide: Step-by-step tutorials and explanations
Examples: Real-world usage examples
README: Project overview and quick start
First ensure the pandoc is installed on you local machine:
sudo apt update
sudo apt install -y pandoc
To build documentation locally:
cd docs
python generate_docs.py
make html
# Open _build/html/index.html in your browser
# or serve it locally
sphinx-autobuild . _build/html
π Recognitionο
Contributors are recognized in:
CHANGELOG: All contributions are listed in release notes
Contributors Section: Listed in the README
Git History: Your commits become part of the project history
π Getting Helpο
If you need help:
Documentation: Check the documentation first
Issues: Search existing issues
Discussions: Use GitHub Discussions for questions
Email: Contact maintainers directly
Thank you for contributing to AI-Graph! π