Skip to content

Latest commit

 

History

History
179 lines (127 loc) · 3.22 KB

File metadata and controls

179 lines (127 loc) · 3.22 KB

Contributing

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.

Development Setup

Prerequisites

  • Python 3.11 or higher
  • Git

Setup Steps

  1. Clone repository:
git clone https://github.com/weftlabs/weft-cli.git
cd weft-cli
  1. Create virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install in development mode:
pip install -e ".[dev]"
  1. Run tests:
pytest

Code Style

Python Style Guide

  • 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

Docstring Format

  • 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

Testing Requirements

Writing Tests

  • Unit tests: Test individual functions/classes
  • Integration tests: Test full workflows
  • No network calls: Mock external APIs

Running Tests

# Run all tests
pytest

# Run specific test
pytest tests/unit/test_config.py -v

# Run integration tests only
pytest tests/integration/ -v

Pull Request Process

Before Submitting

  1. Create feature or fix branch:
git checkout -b feat/your-feature-name
# or
git checkout -b fix/your-bugfix-name
  1. Make changes:
  • Write code
  • Add tests
  • Update documentation
  1. Run checks:
# Format code
black src/ tests/

# Lint code
ruff check src/ tests/

# Run tests
pytest

# (Optional) Check types
mypy src/
  1. Commit:
git add .
git commit -m "feat: Add feature description"

Commit Message Format

Follow Conventional Commits:

<type>: <description>

[optional body]

[optional footer]

Types:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation only
  • test: Adding tests
  • refactor: Code refactoring
  • style: Code style changes
  • chore: Maintenance tasks

Creating Pull Request

  1. Push branch:
git push origin feat/your-feature-name
# or
git push origin fix/your-bugfix-name
  1. Open PR on GitHub

  2. PR Checklist:

  • Tests pass
  • Documentation updated
  • Type hints added
  • Docstrings written
  1. Wait for review

CI/CD Checks

Pull requests are automatically checked by CI.
Fix reported issues and push updates to your branch.

After Review

  • Address review comments
  • Push changes
  • Request re-review

Development Workflow

If you are adding new functionality, follow existing patterns and update tests and documentation accordingly.

Resources

Getting help

  • Open a GitHub issue for bugs or questions
  • Check the documentation before opening a PR