Thank you for your interest in contributing to Lotus! This document provides guidelines and information for contributors.
- Getting Started
- Development Setup
- Contribution Workflow
- Issue Templates
- Pull Request Guidelines
- Code Style and Standards
- Testing Guidelines
- Documentation
- Getting Help
Before contributing, please:
- Read this contributing guide
- Check existing issues and pull requests to avoid duplicates
- Join our community discussions
- Familiarize yourself with the codebase
- Python 3.10
- Git
- Conda (recommended) or virtual environment
- uv (for dependency management)
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone the repository
git clone git@github.com:lotus-data/lotus.git
cd lotus
# Install lotus and all dependencies (including dev dependencies)
uv sync --dev
# Install pre-commit hooks
uv run pre-commit install- Fork the repository on GitHub
- Clone your fork locally
- Add the upstream repository as a remote
git remote add upstream git@github.com:lotus-data/lotus.gitgit checkout -b feature/your-feature-name- Follow the code style guidelines
- Write tests for new functionality
- Update documentation as needed
# Run the test suite
uv run pytest
# Run linting
uv run pre-commit run --all-files
# Run type checking
uv run mypy lotus/Use conventional commit messages:
type(scope): description
Examples:
feat(models): add support for new model provider
fix(api): resolve authentication issue
docs(readme): update installation instructions
git push origin feature/your-feature-nameThen create a pull request using our template.
- Code follows the project's style guidelines
- Tests pass locally
- Documentation is updated
- No new warnings are generated
- Self-review of your code
Please include the following in your PR:
- Purpose: Clear description of what the PR accomplishes
- Test Plan: How you tested your changes
- Test Results: Results of your testing
- Documentation Updates: Any documentation changes needed
- Type of Change: Bug fix, feature, breaking change, etc.
- Checklist: Quality assurance items
- Automated checks must pass (CI/CD)
- At least one maintainer must approve
- All conversations must be resolved
- Documentation updates may be required
- Follow PEP 8 guidelines
- Use type hints where appropriate
- Keep functions and classes focused and well-documented
- Use meaningful variable and function names
We use pre-commit hooks to maintain code quality:
- ruff: Linting and code formatting
- mypy: Type checking
# Install pre-commit hooks (uv handles the installation)
uv run pre-commit install
# Run all pre-commit hooks on all files
uv run pre-commit run --all-files
# To run a specific hook (e.g., ruff)
uv run pre-commit run ruff --all-files
# To run pre-commit checks before every commit (recommended), just commit as usual:
git commit -m "Your commit message"
# The hooks will run automaticallyWe maintain two test suites:
- lotus/.github/tests: essential tests for CI/CD to ensure core functionality
- lotus/tests: additional tests for comprehensive testing of non-core functionality and integrations
If you are unsure where to add your new tests, we recommend starting them within lotus/tests and highlighting your question in your PR, so that the maintainers can respond with their suggestions.
You can find useful documentation, conceptual explanations, and best practices for writing pytests here.
Our general guidelines for testing include the following:
- Write tests for new functionality, ensuring full coverage of possible code paths and edge cases
- Avoid writing tests that depend on specific model behaviors. For example, when writing a
sem_maptest, we would avoid assertions on the exact projection output, and instead write assertions that the expected column exists in the resulting dataframe with non-empty string attributes. - Use descriptive test names
- Mock external dependencies
- first export the following enviorment variables:
export ENABLE_OPENAI_TESTS="true"
export ENABLE_LOCAL_TESTS="true"
export OPENAI_API_KEY="<your key>"
- then run your pytest
# Run all tests
uv run pytest
# Run specific test file
uv run pytest tests/test_models.py
# Run tests in parallel
uv run pytest -n auto- Keep documentation up to date
- Use clear, concise language
- Include code examples
- Update README.md for significant changes
README.md: Project overview and quick startdocs/: Detailed documentationexamples/: Code examples- Inline code comments for complex logic
Lotus uses the litellm library to interface with various model providers. Here are some examples:
from lotus.models import LM
lm = LM(model="gpt-4o")from lotus.models import LM
lm = LM(model="ollama/llama3.2")from lotus.models import LM
lm = LM(
model='hosted_vllm/meta-llama/Meta-Llama-3-8B-Instruct',
api_base='http://localhost:8000/v1',
max_ctx_len=8000,
max_tokens=1000
)- GitHub Discussions: For questions and general discussion
- GitHub Issues: For bug reports and feature requests
- Documentation: Check the README and examples folder
- Check existing issues and discussions
- Read the documentation
- Try to reproduce the issue in a minimal environment
- Provide clear, detailed information about your problem
- Repository: https://github.com/lotus-data/lotus
- Discussions: https://github.com/lotus-data/lotus/discussions
- Issues: https://github.com/lotus-data/lotus/issues
Thank you for contributing to Lotus! 🚀