Comprehensive guide for contributing to Chisel CLI development, from setup to submitting contributions.

Quick Start for Contributors

1

Fork and Clone

Fork the repository and clone it locally:
git clone https://github.com/YOUR_USERNAME/chisel.git
cd chisel
2

Setup Environment

Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate  # Linux/Mac
# OR .venv\Scripts\activate  # Windows
3

Install in Development Mode

Install Chisel CLI in development mode with all dependencies:
pip install -e .[dev]
4

Verify Setup

Run tests to ensure everything works:
ruff check src/ examples/
pytest tests/

Development Setup

Prerequisites

Project Structure

Understanding the codebase organization:
chisel/
├── src/chisel/               # Main package
│   ├── __init__.py          # CLI entry point and exports
│   ├── core.py              # ChiselApp functionality
│   ├── auth.py              # Authentication system
│   ├── spinner.py           # UI utilities and progress
│   └── constants.py         # GPU types and configuration
├── examples/                # Usage examples
├── tests/                   # Test suite
├── docs/                    # Documentation
├── pyproject.toml          # Package configuration
└── README.md               # Main project README

Code Standards

Linting and Formatting

We use Ruff for both linting and formatting to ensure consistent code quality:
# Check for style and quality issues
ruff check src/ examples/ tests/

# Auto-fix issues where possible
ruff check src/ examples/ tests/ --fix

# Format code
ruff format src/ examples/ tests/

# Check if formatting is needed
ruff format src/ examples/ tests/ --check

Code Style Guidelines

Pre-commit Hooks

Set up automated quality checks before each commit:
1

Install pre-commit

pip install pre-commit
2

Create configuration

Create .pre-commit-config.yaml:
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
  rev: v0.1.9
  hooks:
    - id: ruff
      args: [--fix]
    - id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
  rev: v4.4.0
  hooks:
    - id: trailing-whitespace
    - id: end-of-file-fixer
    - id: check-yaml
    - id: check-toml
3

Install hooks

pre-commit install
Now quality checks run automatically before each commit!

Testing

Running Tests

# Run all tests
pytest

# Run with verbose output
pytest -v

# Run specific test file
pytest tests/test_core.py

# Run specific test
pytest tests/test_core.py::test_app_creation

Writing Tests

Architecture

Core Components

Purpose: Main application class for GPU accelerationKey Responsibilities:
  • GPU configuration and validation
  • Code packaging and upload management
  • Job submission and tracking
  • Function decoration and tracing
Key Methods:
class ChiselApp:
    def __init__(self, name: str, upload_dir: str = ".", gpu: Optional[GPUType] = None)
    def capture_trace(self, trace_name: str = None, **kwargs) -> Callable
    def _submit_job(self, script_path: str, args: List[str]) -> str
    def _package_code(self) -> bytes

Execution Modes

Contributing Workflow

Making Changes

1

Create Feature Branch

Create a new branch for your changes:
git checkout -b feature/add-new-gpu-type
# OR
git checkout -b fix/authentication-bug
# OR  
git checkout -b docs/improve-examples
2

Make Your Changes

Implement your feature or fix:
  • Write code following the style guidelines
  • Add or update tests for your changes
  • Update documentation if needed
  • Ensure all quality checks pass
# Run quality checks frequently
ruff check src/ --fix
pytest tests/
3

Test Changes

Run comprehensive tests:
# All quality checks
ruff check src/ examples/ tests/
ruff format src/ examples/ tests/ --check

# All tests
pytest tests/ -v

# Test examples still work
python examples/basic_usage.py
4

Commit Changes

Write clear, descriptive commit messages:
git add .
git commit -m "Add support for H100 GPU type

- Add H100_80GB variants to GPUType enum
- Update GPU selection logic in core.py  
- Add tests for new GPU types
- Update configuration documentation"

Commit Message Guidelines

Pull Request Process

1

Push Your Branch

Push your feature branch to your fork:
git push origin feature/your-feature-name
2

Create Pull Request

Create a PR with a clear description:Title: Brief, descriptive summary Description: Include:
  • What the PR does
  • Why it’s needed
  • How to test it
  • Any breaking changes
  • Related issues
## Description
Add support for H100 GPU types to expand hardware options.

## Changes
- Added H100_80GB_1, H100_80GB_2, H100_80GB_4, H100_80GB_8 to GPUType enum
- Updated GPU memory calculations for H100 architecture
- Added validation tests for new GPU types
- Updated configuration documentation

## Testing
- [ ] All existing tests pass
- [ ] New tests added for H100 GPU types
- [ ] Manual testing with example scripts
- [ ] Documentation updated

## Breaking Changes
None - this is a backwards-compatible addition.

Fixes #142
3

Address Review Feedback

Respond to code review comments:
  • Make requested changes
  • Add clarifying comments
  • Update tests if needed
  • Push updates to the same branch
# Address feedback
git add .
git commit -m "Address review feedback

- Add input validation as requested
- Clarify error message wording
- Add edge case test for empty input"

git push origin feature/your-feature-name

Release Process

Version Management

IDE Setup

VS Code Configuration

Create .vscode/settings.json:
{
    "python.defaultInterpreterPath": "./.venv/bin/python",
    "python.linting.enabled": false,
    "python.formatting.provider": "none",
    "ruff.enable": true,
    "ruff.organizeImports": true,
    "[python]": {
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.fixAll.ruff": true,
            "source.organizeImports.ruff": true
        }
    },
    "python.testing.pytestEnabled": true,
    "python.testing.pytestPath": "./.venv/bin/pytest"
}

PyCharm Configuration

Community and Support

Getting Help

Community Guidelines

Be respectful, collaborative, and helpful when contributing to Chisel CLI.
Best Practices:
  1. Start Small: Begin with documentation improvements or small bug fixes
  2. Ask Questions: Use GitHub Discussions for questions before starting work
  3. Follow Standards: Adhere to code style and testing requirements
  4. Test Thoroughly: Ensure your changes work correctly and don’t break existing functionality
  5. Document Changes: Update relevant documentation and examples
Contributing Areas:
  • 🐛 Bug Fixes: Fix issues reported by users
  • Features: Add new GPU types, authentication methods, or CLI improvements
  • 📚 Documentation: Improve guides, examples, and API documentation
  • 🧪 Testing: Add test coverage and improve test reliability
  • 🎨 UI/UX: Improve CLI output, error messages, and user experience
Thank you for contributing to Chisel CLI! 🚀