Thanks for your interest in contributing to Weft.
This document covers the basics for contributing code and documentation.
For deeper system details, see the Development Guide.
- Python 3.11 or higher
- Git
- Clone repository:
git clone https://github.com/weftlabs/weft-cli.git
cd weft-cli- Create virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install in development mode:
pip install -e ".[dev]"- Run tests:
pytest- Follow PEP 8
- Use Black for formatting
- Use Ruff for linting
- Use type hints for all functions (optional to check with mypy)
- Write docstrings for all public APIs
- Module-level: 1 sentence describing purpose
- Public functions: 1-2 lines max, only if intent not obvious
- NO Args/Returns/Raises sections
- NO examples in docstrings (use tests instead)
- Prefer clear naming over verbose documentation
- Unit tests: Test individual functions/classes
- Integration tests: Test full workflows
- No network calls: Mock external APIs
# Run all tests
pytest
# Run specific test
pytest tests/unit/test_config.py -v
# Run integration tests only
pytest tests/integration/ -v- Create feature or fix branch:
git checkout -b feat/your-feature-name
# or
git checkout -b fix/your-bugfix-name- Make changes:
- Write code
- Add tests
- Update documentation
- Run checks:
# Format code
black src/ tests/
# Lint code
ruff check src/ tests/
# Run tests
pytest
# (Optional) Check types
mypy src/- Commit:
git add .
git commit -m "feat: Add feature description"Follow Conventional Commits:
<type>: <description>
[optional body]
[optional footer]
Types:
feat:New featurefix:Bug fixdocs:Documentation onlytest:Adding testsrefactor:Code refactoringstyle:Code style changeschore:Maintenance tasks
- Push branch:
git push origin feat/your-feature-name
# or
git push origin fix/your-bugfix-name-
Open PR on GitHub
-
PR Checklist:
- Tests pass
- Documentation updated
- Type hints added
- Docstrings written
- Wait for review
Pull requests are automatically checked by CI.
Fix reported issues and push updates to your branch.
- Address review comments
- Push changes
- Request re-review
If you are adding new functionality, follow existing patterns and update tests and documentation accordingly.
- Open a GitHub issue for bugs or questions
- Check the documentation before opening a PR