- Getting Started
- Development Setup
- Code Style
- Making Changes
- Testing
- Documentation
- Submitting Changes
-
Fork the Repository
- Visit LocalLab on GitHub
- Click the "Fork" button
-
Clone Your Fork
git clone https://github.com/your-username/LocalLab.git cd LocalLab
-
Set Up Development Environment
# Create virtual environment python -m venv venv source venv/bin/activate # or `venv\Scripts\activate` on Windows # Install dependencies pip install -e ".[dev]"
pip install -r requirements-dev.txt
pre-commit install
We follow these guidelines:
- PEP 8 for Python code style
- Type hints for function arguments and returns
- Docstrings for all public functions
- Comments for complex logic
- Maximum line length of 100 characters
Example:
from typing import List, Optional
def process_text(
text: str,
max_length: Optional[int] = None,
*,
temperature: float = 0.7
) -> List[str]:
"""Process input text with given parameters.
Args:
text: Input text to process
max_length: Maximum length of output (optional)
temperature: Sampling temperature (default: 0.7)
Returns:
List of processed text segments
"""
# Implementation
-
Create a Branch
git checkout -b feature/your-feature-name
-
Make Your Changes
- Follow code style guidelines
- Add tests for new features
- Update documentation
-
Run Tests
# Run all tests pytest # Run with coverage pytest --cov=locallab
# tests/test_feature.py
import pytest
from locallab import YourFeature
def test_your_feature():
feature = YourFeature()
result = feature.process("test")
assert result == expected_result
@pytest.mark.asyncio
async def test_async_feature():
# Test async functionality
pass
# Run specific test file
pytest tests/test_feature.py
# Run with verbose output
pytest -v
# Run with coverage report
pytest --cov=locallab --cov-report=html
- Use clear, concise language
- Include code examples
- Add type hints and docstrings
- Update relevant documentation files
Example:
class ModelManager:
"""Manages AI model loading and inference.
Attributes:
current_model: Currently loaded model name
model_config: Model configuration dictionary
"""
def __init__(self):
"""Initialize the model manager."""
self.current_model = None
self.model_config = {}
# Install documentation dependencies
pip install -r docs/requirements.txt
# Build documentation
cd docs
make html
-
Commit Your Changes
git add . git commit -m "feat: add new feature"
-
Push to Your Fork
git push origin feature/your-feature-name
-
Create Pull Request
- Go to the LocalLab repository
- Click "New Pull Request"
- Select your branch
- Fill in the PR template
- Check our Troubleshooting Guide
- Join our Discord Community
- Open an Issue