$ show Bouni/kicad-jlcpcb-tools
This is a KiCad plugin that integrates with JLCPCB assembly services. It provides a wxPython GUI within KiCad (pcbnew) for assigning LCSC part numbers to footprints, managing rotation/offset corrections, and generating fabrication files (Gerber, Excellon, BOM, CPL) ready for JLCPCB ordering. It also includes a parts database builder that fetches component data from LCSC APIs, a searchable parts catalog with FTS5, and an assembly cost estimator. The architecture is monolithic as a KiCad ActionPlugin, with a separate standalone mode for testing. Key external dependencies are KiCad, wxPython, and SQLite, with the `packaging` library vendored. The codebase demonstrates strong engineering practices: extensive unit tests (many mocking KiCad/wx), transactional correction storage with validation, event-driven UI separation, and reusable utility components. However, it has some coupling to KiCad API version specifics and hardcoded pricing data that may drift over time.
The LLM identified 4 files worth highlighting for reuse:
Provides functions to escape user input for SQL LIKE clauses and FTS5 queries. Implements proper escaping of wildcards (% and _) and special characters to prevent SQL injection in search queries. Self-contained and can be reused in any Python project needing safe SQL search string construction.
Defines the `Correction` dataclass for footprint rotation/offset corrections, with immutable fields and methods for parsing from CSV rows, converting to database rows, and generating editor values. Includes `parse_corrections_csv` function that validates header mappings and aggregates errors. Demonstrates a clean, testable value-object pattern for importing and validating structured data from CSV.
Provides abstract `NestedProgressBar` class and concrete implementations `TqdmNestedProgressBar` (using tqdm), `PrintNestedProgressBar` (print-based), and `NoOpProgressBar` (no-op). Supports nested progress reporting with optional sub-tasks. Easily extractable for any Python application needing consistent progress reporting across different environments (CLI, GUI, headless).
Implements a pipeline for cleaning and normalizing LCSC price data: reduces decimal precision, filters entries below a cutoff price, and removes duplicate consecutive price tiers. Also includes `ComponentTranslator` that maps component database fields to JLCPCB part row fields. The price-cleaning chain is a reusable data transformation pattern applicable to any tiered pricing dataset.