Development Setup
This guide covers setting up a professional development environment for KiLM with type safety, code quality tools, and testing infrastructure.
Prerequisites
Section titled “Prerequisites”- 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)
Development Workflow
Section titled “Development Workflow”-
Clone the Repository
Terminal window git clone https://github.com/barisgit/kilm.gitcd kilm -
Create Virtual Environment
Terminal window # Using Python's built-in venvpython -m venv .venvsource .venv/bin/activate # On Windows: .venv\Scripts\activate -
Install Development Dependencies
Terminal window # Install KiLM in editable mode with dev dependenciespip install -e ".[dev]"This installs:
- KiLM in editable mode (changes reflect immediately)
- Development tools: pytest, black, ruff, pyrefly
- Pre-commit hooks and coverage tools
Verification
Section titled “Verification”Verify your development setup:
# Check KiLM installationkilm --versionkilm --help
# Verify KiCad detectionkilm status
Code Quality Standards
Section titled “Code Quality Standards”KiLM follows strict code quality standards:
Type Safety (Required)
Section titled “Type Safety (Required)”# Type checking with pyrefly (zero "Any" types allowed)pyrefly
# Check for type issuespyrefly --check kicad_lib_manager/
Code Formatting
Section titled “Code Formatting”# Format code with Blackblack .
# Check formatting without applying changesblack --check .
Linting and Analysis
Section titled “Linting and Analysis”# Run Ruff linting and analysisruff check .
# Fix auto-fixable issuesruff check --fix .
# Format imports and coderuff format .
Testing
Section titled “Testing”# Run all testspytest
# Run with coverage reportingpytest --cov=kicad_lib_manager --cov-report=html
# Run specific test filepytest tests/test_config_commands.py
# Run tests with verbose outputpytest -v
Development Tools
Section titled “Development Tools”Pre-commit Hooks (Recommended)
Section titled “Pre-commit Hooks (Recommended)”# Install pre-commit hookspre-commit install
# Run all hooks on all filespre-commit run --all-files
# Update hook repositoriespre-commit autoupdate
Quality Pipeline
Section titled “Quality Pipeline”# Run complete quality check (to be implemented)# This should include: pyrefly, black, ruff, pytestmake quality # or equivalent script
Project Architecture
Section titled “Project Architecture”Core Modules
Section titled “Core Modules”cli.py
: Typer-based command interface (modern CLI with better help/UX)commands/
: Individual command implementationslibrary_manager.py
: Core library management logicconfig.py
: KiCad configuration handlingutils/
: File operations, backups, metadata, templates
Development Principles
Section titled “Development Principles”- 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
Next Steps
Section titled “Next Steps”Ready to contribute? See the Contributing Guide for submission guidelines and coding standards.