Skip to content

Development Setup

This guide covers setting up a professional development environment for KiLM with type safety, code quality tools, and testing infrastructure.

  • Python 3.9+: Required for KiLM development
  • Git: For version control and contribution workflow
  • KiCad 6.x+: For testing KiLM integration (run at least once)
  1. Clone the Repository

    Terminal window
    git clone https://github.com/barisgit/kilm.git
    cd kilm
  2. Create Virtual Environment

    Terminal window
    # Using Python's built-in venv
    python -m venv .venv
    source .venv/bin/activate # On Windows: .venv\Scripts\activate
  3. Install Development Dependencies

    Terminal window
    # Install KiLM in editable mode with dev dependencies
    pip install -e ".[dev]"

    This installs:

    • KiLM in editable mode (changes reflect immediately)
    • Development tools: pytest, black, ruff, pyrefly
    • Pre-commit hooks and coverage tools

Verify your development setup:

Terminal window
# Check KiLM installation
kilm --version
kilm --help
# Verify KiCad detection
kilm status

KiLM follows strict code quality standards:

Terminal window
# Type checking with pyrefly (zero "Any" types allowed)
pyrefly
# Check for type issues
pyrefly --check kicad_lib_manager/
Terminal window
# Format code with Black
black .
# Check formatting without applying changes
black --check .
Terminal window
# Run Ruff linting and analysis
ruff check .
# Fix auto-fixable issues
ruff check --fix .
# Format imports and code
ruff format .
Terminal window
# Run all tests
pytest
# Run with coverage reporting
pytest --cov=kicad_lib_manager --cov-report=html
# Run specific test file
pytest tests/test_config_commands.py
# Run tests with verbose output
pytest -v
Terminal window
# Install pre-commit hooks
pre-commit install
# Run all hooks on all files
pre-commit run --all-files
# Update hook repositories
pre-commit autoupdate
Terminal window
# Run complete quality check (to be implemented)
# This should include: pyrefly, black, ruff, pytest
make quality # or equivalent script
  • cli.py: Typer-based command interface (modern CLI with better help/UX)
  • commands/: Individual command implementations
  • library_manager.py: Core library management logic
  • config.py: KiCad configuration handling
  • utils/: File operations, backups, metadata, templates
  • Professional code standards: No emojis, no hardcoded values
  • Cross-platform compatibility: Support Windows, macOS, Linux
  • SOLID principles: Clean, maintainable architecture
  • CLI-focused: Simple, reliable command-line interface

Ready to contribute? See the Contributing Guide for submission guidelines and coding standards.