kicad-sch-api 0.1.7__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of kicad-sch-api might be problematic. Click here for more details.
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/.claude/commands/dev/update-and-commit.md +21 -9
- kicad_sch_api-0.2.1/CHANGELOG.md +112 -0
- kicad_sch_api-0.2.1/PKG-INFO +483 -0
- kicad_sch_api-0.2.1/README.md +439 -0
- kicad_sch_api-0.2.1/examples/pin_to_pin_wiring_demo.py +98 -0
- kicad_sch_api-0.2.1/examples/simple_circuit_with_pin_wiring.py +64 -0
- kicad_sch_api-0.2.1/examples/simple_two_resistor_routing.py +123 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/__init__.py +6 -2
- kicad_sch_api-0.2.1/kicad_sch_api/cli.py +247 -0
- kicad_sch_api-0.2.1/kicad_sch_api/core/component_bounds.py +477 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/core/components.py +22 -10
- kicad_sch_api-0.2.1/kicad_sch_api/core/config.py +127 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/core/formatter.py +183 -23
- kicad_sch_api-0.2.1/kicad_sch_api/core/geometry.py +111 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/core/ic_manager.py +43 -37
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/core/junctions.py +17 -22
- kicad_sch_api-0.2.1/kicad_sch_api/core/manhattan_routing.py +430 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/core/parser.py +495 -196
- kicad_sch_api-0.2.1/kicad_sch_api/core/pin_utils.py +149 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/core/schematic.py +630 -207
- kicad_sch_api-0.2.1/kicad_sch_api/core/simple_manhattan.py +228 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/core/types.py +9 -4
- kicad_sch_api-0.2.1/kicad_sch_api/core/wire_routing.py +380 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/core/wires.py +29 -25
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/discovery/__init__.py +1 -1
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/discovery/search_index.py +142 -107
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/library/cache.py +70 -62
- kicad_sch_api-0.2.1/kicad_sch_api.egg-info/PKG-INFO +483 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api.egg-info/SOURCES.txt +19 -2
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api.egg-info/entry_points.txt +0 -1
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api.egg-info/requires.txt +0 -6
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/pyproject.toml +3 -12
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/two_resistors/two_resistors.kicad_sch +10 -10
- kicad_sch_api-0.2.1/tests/test_bounding_box_rectangles.py +251 -0
- kicad_sch_api-0.2.1/tests/test_component_removal.py +166 -0
- kicad_sch_api-0.2.1/tests/test_element_removal.py +111 -0
- kicad_sch_api-0.2.1/tests/test_grid_snapping.py +236 -0
- kicad_sch_api-0.2.1/tests/test_manhattan_routing.py +255 -0
- kicad_sch_api-0.2.1/tests/test_pin_positioning.py +462 -0
- kicad_sch_api-0.2.1/tests/test_pin_to_pin_wiring.py +179 -0
- kicad_sch_api-0.2.1/tests/test_removal_against_references.py +185 -0
- kicad_sch_api-0.1.7/PKG-INFO +0 -322
- kicad_sch_api-0.1.7/README.md +0 -273
- kicad_sch_api-0.1.7/kicad_sch_api/cli.py +0 -400
- kicad_sch_api-0.1.7/kicad_sch_api/mcp/__init__.py +0 -7
- kicad_sch_api-0.1.7/kicad_sch_api/mcp/server.py +0 -1511
- kicad_sch_api-0.1.7/kicad_sch_api.egg-info/PKG-INFO +0 -322
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/.claude/commands/dev/dead-code-analysis.md +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/.claude/commands/dev/publish-pypi.md +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/.claude/commands/dev/review-implementation.md +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/.claude/commands/dev/run-tests.md +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/.claude/commands/dev/update-memory-bank.md +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/.claude/commands/test/run-reference-tests.md +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/LICENSE +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/MANIFEST.in +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/examples/advanced_usage.py +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/examples/basic_usage.py +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/examples/mcp_basic_example.py +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/examples/mcp_integration.py +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/core/__init__.py +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/library/__init__.py +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/py.typed +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/utils/__init__.py +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api/utils/validation.py +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api.egg-info/dependency_links.txt +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/kicad_sch_api.egg-info/top_level.txt +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/setup.cfg +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/README.md +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/blank_schematic/blank_schematic.kicad_pro +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/blank_schematic/blank_schematic.kicad_sch +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/multi_unit_7400/multi_unit_7400.kicad_pro +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/multi_unit_7400/multi_unit_7400.kicad_sch +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/power_symbols/power_symbols.kicad_pro +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/power_symbols/power_symbols.kicad_sch +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/resistor_divider/resistor_divider.kicad_pro +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/resistor_divider/resistor_divider.kicad_sch +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/sch_title/sch_title.kicad_pro +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/sch_title/sch_title.kicad_sch +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_extended_component/single_extended_component.kicad_pro +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_extended_component/single_extended_component.kicad_sch +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_hierarchical_sheet/single_hierarchical_sheet.kicad_pro +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_hierarchical_sheet/single_hierarchical_sheet.kicad_sch +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_hierarchical_sheet/subcircuit1.kicad_sch +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_label/single_label.kicad_pro +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_label/single_label.kicad_sch +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_label_hierarchical/single_label_hierarchical.kicad_pro +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_label_hierarchical/single_label_hierarchical.kicad_sch +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_resistor/single_resistor.kicad_pro +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_resistor/single_resistor.kicad_sch +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_text/single_text.kicad_pro +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_text/single_text.kicad_sch +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_text_box/single_text_box.kicad_pro +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_text_box/single_text_box.kicad_sch +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_wire/single_wire.kicad_pro +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/single_wire/single_wire.kicad_sch +0 -0
- {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.1}/tests/reference_tests/reference_kicad_projects/two_resistors/two_resistors.kicad_pro +0 -0
|
@@ -10,11 +10,22 @@ Comprehensive workflow for documenting progress, updating documentation, and com
|
|
|
10
10
|
|
|
11
11
|
## Process
|
|
12
12
|
|
|
13
|
-
### 1. Update Documentation (
|
|
14
|
-
|
|
13
|
+
### 1. Update Documentation (REQUIRED for Features)
|
|
14
|
+
**IMPORTANT: Always update documentation BEFORE committing new features**
|
|
15
|
+
- IF new user-facing features: Update README.md with examples
|
|
16
|
+
- IF new API methods: Add to Advanced Features section in README.md
|
|
17
|
+
- IF version increment needed: Update CHANGELOG.md with new version entry
|
|
15
18
|
- IF new MCP tools: Update tool documentation
|
|
16
|
-
-
|
|
17
|
-
- NO documentation changes for internal fixes or refactoring
|
|
19
|
+
- ALWAYS document new public methods with code examples
|
|
20
|
+
- NO documentation changes needed for internal fixes or refactoring
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Documentation update checklist for new features:
|
|
24
|
+
# 1. Add examples to README.md "Basic Usage" or "Advanced Features" sections
|
|
25
|
+
# 2. Create CHANGELOG.md entry with version bump (patch/minor/major)
|
|
26
|
+
# 3. Update any relevant example files in examples/
|
|
27
|
+
# 4. Ensure CLAUDE.md reflects new functionality if developer-relevant
|
|
28
|
+
```
|
|
18
29
|
|
|
19
30
|
### 2. Format Code Before Committing
|
|
20
31
|
**IMPORTANT: Always format code before committing**
|
|
@@ -50,8 +61,8 @@ uv run python -c "import kicad_sch_api; print('✅ Import successful')" || echo
|
|
|
50
61
|
# Check status and review changes
|
|
51
62
|
git status
|
|
52
63
|
|
|
53
|
-
# Add specific files (be selective)
|
|
54
|
-
git add kicad_sch_api/ tests/ README.md pyproject.toml
|
|
64
|
+
# Add specific files (be selective) - ALWAYS include documentation if updated
|
|
65
|
+
git add kicad_sch_api/ tests/ README.md CHANGELOG.md pyproject.toml
|
|
55
66
|
|
|
56
67
|
# Remove unwanted files if any
|
|
57
68
|
git rm unwanted-file.py 2>/dev/null || true
|
|
@@ -79,8 +90,8 @@ git add kicad_sch_api/
|
|
|
79
90
|
# Tests - include if relevant
|
|
80
91
|
git add tests/
|
|
81
92
|
|
|
82
|
-
# Documentation - include if updated
|
|
83
|
-
git add README.md CLAUDE.md
|
|
93
|
+
# Documentation - ALWAYS include if updated (REQUIRED for features)
|
|
94
|
+
git add README.md CHANGELOG.md CLAUDE.md
|
|
84
95
|
|
|
85
96
|
# Configuration - include if changed
|
|
86
97
|
git add pyproject.toml pytest.ini
|
|
@@ -150,7 +161,8 @@ uv run python setup.py check --strict --metadata || echo "⚠️ Package metadat
|
|
|
150
161
|
- `kicad_sch_api/` - Core library code
|
|
151
162
|
- `tests/` - Test files (when relevant)
|
|
152
163
|
- `pyproject.toml` - Package configuration
|
|
153
|
-
- `README.md` - User documentation
|
|
164
|
+
- `README.md` - User documentation (REQUIRED for new features)
|
|
165
|
+
- `CHANGELOG.md` - Version history (REQUIRED for new features)
|
|
154
166
|
|
|
155
167
|
### Include When Relevant
|
|
156
168
|
- `mcp-server/` - MCP server changes
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.3.1] - 2025-01-20
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Pin-to-Pin Wire Drawing**: Intelligent wire routing between component pins
|
|
12
|
+
- `add_wire_between_pins()` method for direct pin-to-pin connections
|
|
13
|
+
- `add_wire_to_pin()` method for connecting arbitrary points to component pins
|
|
14
|
+
- `get_component_pin_position()` method for pin position queries
|
|
15
|
+
- Automatic pin position calculation using existing pin positioning functionality
|
|
16
|
+
- Support for both Point objects and tuple coordinates
|
|
17
|
+
- Comprehensive error handling for invalid components and pins
|
|
18
|
+
- 11 dedicated test cases covering all functionality and edge cases
|
|
19
|
+
|
|
20
|
+
### Enhanced
|
|
21
|
+
- **Wire Management**: Improved wire creation with pin-aware routing
|
|
22
|
+
- Seamless integration with existing WireCollection
|
|
23
|
+
- UUID-based wire tracking for all pin-to-pin connections
|
|
24
|
+
- Maintains exact format preservation for all wire types
|
|
25
|
+
|
|
26
|
+
### Technical Notes
|
|
27
|
+
- Built on existing pin positioning functionality from recent commits
|
|
28
|
+
- All wire drawing maintains KiCAD's coordinate system (inverted Y-axis)
|
|
29
|
+
- Zero test failures achieved - comprehensive validation of all functionality
|
|
30
|
+
- Example files included demonstrating voltage divider and complex circuit creation
|
|
31
|
+
|
|
32
|
+
## [0.3.0] - 2025-01-20
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
- **Comprehensive Component Removal**: Full component removal functionality with lib_symbols cleanup
|
|
36
|
+
- `ComponentCollection.remove()` method for removing components by reference
|
|
37
|
+
- Automatic lib_symbols synchronization to remove unused symbol definitions
|
|
38
|
+
- Complete test suite with 4 dedicated removal tests
|
|
39
|
+
|
|
40
|
+
- **Element Removal Operations**: Removal support for all schematic elements
|
|
41
|
+
- Wire removal via `Schematic.remove_wire()` and `WireCollection.remove()`
|
|
42
|
+
- Label removal via `Schematic.remove_label()`
|
|
43
|
+
- Hierarchical label removal via `Schematic.remove_hierarchical_label()`
|
|
44
|
+
- Junction removal via `JunctionCollection.remove()`
|
|
45
|
+
- 5 comprehensive element removal tests
|
|
46
|
+
|
|
47
|
+
- **Reference-Based Validation**: Advanced removal testing against KiCAD reference files
|
|
48
|
+
- `test_single_resistor_to_blank()` - validates resistor removal matches blank schematic exactly
|
|
49
|
+
- `test_two_resistors_remove_one_matches_single()` - validates selective removal preserves remaining components
|
|
50
|
+
- Byte-for-byte format preservation during removal operations
|
|
51
|
+
|
|
52
|
+
- **Professional Configuration System**: Centralized configuration management eliminating anti-patterns
|
|
53
|
+
- `KiCADConfig` class with structured configuration categories
|
|
54
|
+
- Property positioning, grid settings, sheet settings, and tolerance configuration
|
|
55
|
+
- Configurable via public `ksa.config` API for user customization
|
|
56
|
+
- Eliminates hardcoded test coordinates and magic numbers from production code
|
|
57
|
+
|
|
58
|
+
- **Enhanced UUID Support**: UUID parameters for exact format matching
|
|
59
|
+
- `add_label()`, `add_sheet()`, and `add_sheet_pin()` now accept optional `uuid` parameter
|
|
60
|
+
- Deterministic UUID management for test reproducibility
|
|
61
|
+
- Support for both auto-generated and user-specified UUIDs
|
|
62
|
+
|
|
63
|
+
### Fixed
|
|
64
|
+
- **Format Preservation**: Achieved byte-for-byte compatibility with KiCAD reference files
|
|
65
|
+
- Custom S-expression formatters for wire `pts` elements
|
|
66
|
+
- Proper float formatting matching KiCAD precision (0.0000 vs 0.0)
|
|
67
|
+
- Fixed coordinate and color formatting inconsistencies
|
|
68
|
+
- All 29 tests now pass with exact format preservation
|
|
69
|
+
|
|
70
|
+
- **Anti-Pattern Elimination**: Removed hardcoded values and test-specific production code
|
|
71
|
+
- Moved test coordinate logic to configurable positioning system
|
|
72
|
+
- Eliminated hardcoded test names in title block generation
|
|
73
|
+
- Centralized magic numbers into structured configuration classes
|
|
74
|
+
- Professional separation of concerns between tests and production code
|
|
75
|
+
|
|
76
|
+
- **Wire Removal Synchronization**: Fixed inconsistency between collection and data structures
|
|
77
|
+
- `remove_wire()` now updates both WireCollection and underlying schematic data
|
|
78
|
+
- Ensures removal operations maintain data integrity across API layers
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
- **Version Bump**: Updated from 0.2.0 to 0.3.0 for major feature additions
|
|
82
|
+
- **Test Coverage**: Expanded from 17 to 29 tests with comprehensive removal validation
|
|
83
|
+
- **Code Quality**: Achieved enterprise-grade configuration management and extensibility
|
|
84
|
+
|
|
85
|
+
### Documentation
|
|
86
|
+
- Updated `CLAUDE.md` with comprehensive removal API documentation
|
|
87
|
+
- Added `REFACTORING_SUMMARY.md` detailing anti-pattern elimination
|
|
88
|
+
- Enhanced README.md with new features and professional configuration examples
|
|
89
|
+
- Documented all new removal methods and configuration options
|
|
90
|
+
|
|
91
|
+
### Technical Notes
|
|
92
|
+
- All changes maintain 100% backward compatibility
|
|
93
|
+
- No breaking API changes - existing code continues to work unchanged
|
|
94
|
+
- Performance optimizations through centralized configuration
|
|
95
|
+
- Enhanced extensibility for future component types and workflows
|
|
96
|
+
|
|
97
|
+
## [0.2.0] - 2025-01-19
|
|
98
|
+
|
|
99
|
+
### Added
|
|
100
|
+
- Initial public release
|
|
101
|
+
- Basic schematic manipulation functionality
|
|
102
|
+
- Component management with ComponentCollection
|
|
103
|
+
- Wire and label creation
|
|
104
|
+
- Symbol library integration
|
|
105
|
+
- Format preservation foundation
|
|
106
|
+
|
|
107
|
+
## [0.1.0] - 2025-01-18
|
|
108
|
+
|
|
109
|
+
### Added
|
|
110
|
+
- Initial development version
|
|
111
|
+
- Core S-expression parsing
|
|
112
|
+
- Basic schematic loading and saving
|
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kicad-sch-api
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Professional KiCAD schematic manipulation library with exact format preservation
|
|
5
|
+
Author-email: Circuit-Synth <shane@circuit-synth.com>
|
|
6
|
+
Maintainer-email: Circuit-Synth <shane@circuit-synth.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/circuit-synth/kicad-sch-api
|
|
9
|
+
Project-URL: Documentation, https://circuit-synth.github.io/kicad-sch-api/
|
|
10
|
+
Project-URL: Repository, https://github.com/circuit-synth/kicad-sch-api.git
|
|
11
|
+
Project-URL: Bug Reports, https://github.com/circuit-synth/kicad-sch-api/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/circuit-synth/kicad-sch-api/blob/main/CHANGELOG.md
|
|
13
|
+
Keywords: kicad,schematic,eda,electronics,circuit-design,ai,automation,pcb
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Operating System :: OS Independent
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: sexpdata>=0.0.3
|
|
29
|
+
Requires-Dist: typing-extensions>=4.0.0; python_version < "3.11"
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-xdist>=3.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: black>=22.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: isort>=5.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: flake8>=4.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
|
|
39
|
+
Provides-Extra: docs
|
|
40
|
+
Requires-Dist: sphinx>=5.0.0; extra == "docs"
|
|
41
|
+
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
|
|
42
|
+
Requires-Dist: myst-parser>=0.18.0; extra == "docs"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
# KiCAD Schematic API
|
|
46
|
+
|
|
47
|
+
**Professional Python library for KiCAD schematic file manipulation with exact format preservation**
|
|
48
|
+
|
|
49
|
+
## Overview
|
|
50
|
+
|
|
51
|
+
Create and manipulate KiCAD schematic files programmatically with guaranteed exact format preservation. This library serves as the foundation for EDA automation tools and AI agents that need reliable, professional-grade schematic manipulation capabilities.
|
|
52
|
+
|
|
53
|
+
## 🎯 Core Features
|
|
54
|
+
|
|
55
|
+
- **📋 Exact Format Preservation**: Byte-perfect KiCAD output that matches native formatting
|
|
56
|
+
- **🏗️ Professional Component Management**: Object-oriented collections with search and validation
|
|
57
|
+
- **⚡ High Performance**: Optimized for large schematics with intelligent caching
|
|
58
|
+
- **🔍 Real KiCAD Library Integration**: Access to actual KiCAD symbol libraries and validation
|
|
59
|
+
- **📐 Component Bounding Boxes**: Precise component boundary calculation and visualization
|
|
60
|
+
- **🎨 Colored Rectangle Graphics**: KiCAD-compatible rectangles with all stroke types and colors
|
|
61
|
+
- **🛣️ Manhattan Routing**: Intelligent wire routing with obstacle avoidance
|
|
62
|
+
- **🤖 AI Agent Ready**: MCP server for seamless integration with AI development tools
|
|
63
|
+
- **📚 Hierarchical Design**: Complete support for multi-sheet schematic projects
|
|
64
|
+
|
|
65
|
+
## 🚀 Quick Start
|
|
66
|
+
|
|
67
|
+
### Installation
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Install from PyPI
|
|
71
|
+
pip install kicad-sch-api
|
|
72
|
+
|
|
73
|
+
# Or install from source
|
|
74
|
+
git clone https://github.com/circuit-synth/kicad-sch-api.git
|
|
75
|
+
cd kicad-sch-api/python
|
|
76
|
+
uv pip install -e .
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Basic Usage
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import kicad_sch_api as ksa
|
|
83
|
+
|
|
84
|
+
# Create a new schematic
|
|
85
|
+
sch = ksa.create_schematic("My Circuit")
|
|
86
|
+
|
|
87
|
+
# Add components with proper validation
|
|
88
|
+
resistor = sch.components.add(
|
|
89
|
+
lib_id="Device:R",
|
|
90
|
+
reference="R1",
|
|
91
|
+
value="10k",
|
|
92
|
+
position=(100.0, 100.0),
|
|
93
|
+
footprint="Resistor_SMD:R_0603_1608Metric",
|
|
94
|
+
datasheet="~",
|
|
95
|
+
description="Resistor"
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
capacitor = sch.components.add(
|
|
99
|
+
lib_id="Device:C",
|
|
100
|
+
reference="C1",
|
|
101
|
+
value="100nF",
|
|
102
|
+
position=(150.0, 100.0),
|
|
103
|
+
footprint="Capacitor_SMD:C_0603_1608Metric"
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
# Add wires for connectivity
|
|
107
|
+
sch.wires.add(start=(100, 110), end=(150, 110))
|
|
108
|
+
|
|
109
|
+
# Pin-to-pin wiring (NEW in v0.3.1)
|
|
110
|
+
wire_uuid = sch.add_wire_between_pins("R1", "2", "C1", "1") # Connect R1 pin 2 to C1 pin 1
|
|
111
|
+
external_wire = sch.add_wire_to_pin((50, 100), "R1", "1") # Connect external point to R1 pin 1
|
|
112
|
+
|
|
113
|
+
# Add labels for nets
|
|
114
|
+
sch.add_label("VCC", position=(125, 110))
|
|
115
|
+
|
|
116
|
+
# Save with exact format preservation
|
|
117
|
+
sch.save("my_circuit.kicad_sch")
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Hierarchical Design
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
# Create main schematic with hierarchical sheet
|
|
124
|
+
main_sch = ksa.create_schematic("Main Board")
|
|
125
|
+
|
|
126
|
+
# Add hierarchical sheet
|
|
127
|
+
power_sheet = main_sch.add_hierarchical_sheet(
|
|
128
|
+
name="Power Supply",
|
|
129
|
+
filename="power.kicad_sch",
|
|
130
|
+
position=(100, 100),
|
|
131
|
+
size=(80, 60)
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
# Add sheet pins for connectivity
|
|
135
|
+
power_sheet.add_pin("VIN", pin_type="input", position=(0, 10))
|
|
136
|
+
power_sheet.add_pin("VOUT", pin_type="output", position=(80, 10))
|
|
137
|
+
|
|
138
|
+
# Create the sub-schematic
|
|
139
|
+
power_sch = ksa.create_schematic("Power Supply")
|
|
140
|
+
power_sch.add_hierarchical_label("VIN", label_type="input", position=(50, 25))
|
|
141
|
+
power_sch.add_hierarchical_label("VOUT", label_type="output", position=(150, 25))
|
|
142
|
+
|
|
143
|
+
# Save both schematics
|
|
144
|
+
main_sch.save("main.kicad_sch")
|
|
145
|
+
power_sch.save("power.kicad_sch")
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 🔧 Advanced Features
|
|
149
|
+
|
|
150
|
+
### Component Bounding Boxes and Colored Graphics (NEW in v0.3.1)
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
from kicad_sch_api.core.component_bounds import get_component_bounding_box
|
|
154
|
+
|
|
155
|
+
# Add components
|
|
156
|
+
resistor = sch.components.add("Device:R", "R1", "10k", (100, 100))
|
|
157
|
+
opamp = sch.components.add("Amplifier_Operational:LM358", "U1", "LM358", (150, 100))
|
|
158
|
+
|
|
159
|
+
# Get component bounding boxes
|
|
160
|
+
bbox_body = get_component_bounding_box(resistor, include_properties=False)
|
|
161
|
+
bbox_full = get_component_bounding_box(resistor, include_properties=True)
|
|
162
|
+
|
|
163
|
+
# Draw colored bounding box rectangles
|
|
164
|
+
sch.draw_bounding_box(bbox_body, stroke_width=0.5, stroke_color="blue", stroke_type="solid")
|
|
165
|
+
sch.draw_bounding_box(bbox_full, stroke_width=0.3, stroke_color="red", stroke_type="dash")
|
|
166
|
+
|
|
167
|
+
# Draw bounding boxes for all components at once
|
|
168
|
+
bbox_uuids = sch.draw_component_bounding_boxes(
|
|
169
|
+
include_properties=True,
|
|
170
|
+
stroke_width=0.4,
|
|
171
|
+
stroke_color="green",
|
|
172
|
+
stroke_type="dot"
|
|
173
|
+
)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Manhattan Routing with Obstacle Avoidance (NEW in v0.3.1)
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
from kicad_sch_api.core.manhattan_routing import ManhattanRouter
|
|
180
|
+
from kicad_sch_api.core.types import Point
|
|
181
|
+
|
|
182
|
+
# Create router
|
|
183
|
+
router = ManhattanRouter()
|
|
184
|
+
|
|
185
|
+
# Add components that act as obstacles
|
|
186
|
+
r1 = sch.components.add("Device:R", "R1", "1k", (50, 50))
|
|
187
|
+
r2 = sch.components.add("Device:R", "R2", "2k", (150, 150))
|
|
188
|
+
obstacle = sch.components.add("Device:C", "C1", "100nF", (100, 100))
|
|
189
|
+
|
|
190
|
+
# Get obstacle bounding boxes
|
|
191
|
+
obstacle_bbox = get_component_bounding_box(obstacle, include_properties=False)
|
|
192
|
+
|
|
193
|
+
# Route around obstacles
|
|
194
|
+
start_point = Point(r1.position.x, r1.position.y)
|
|
195
|
+
end_point = Point(r2.position.x, r2.position.y)
|
|
196
|
+
path = router.route_between_points(start_point, end_point, [obstacle_bbox], clearance=2.0)
|
|
197
|
+
|
|
198
|
+
# Add wires along the path
|
|
199
|
+
for i in range(len(path) - 1):
|
|
200
|
+
sch.wires.add(path[i], path[i + 1])
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Pin-to-Pin Wiring
|
|
204
|
+
|
|
205
|
+
```python
|
|
206
|
+
# Connect component pins directly - automatically calculates pin positions
|
|
207
|
+
wire_uuid = sch.add_wire_between_pins("R1", "2", "R2", "1") # R1 pin 2 to R2 pin 1
|
|
208
|
+
|
|
209
|
+
# Connect arbitrary point to component pin
|
|
210
|
+
external_wire = sch.add_wire_to_pin((75, 125), "R1", "1") # External point to R1 pin 1
|
|
211
|
+
tuple_wire = sch.add_wire_to_pin(Point(100, 150), "C1", "2") # Using Point object
|
|
212
|
+
|
|
213
|
+
# Get component pin positions for advanced operations
|
|
214
|
+
pin_position = sch.get_component_pin_position("R1", "1")
|
|
215
|
+
if pin_position:
|
|
216
|
+
print(f"R1 pin 1 is at ({pin_position.x:.2f}, {pin_position.y:.2f})")
|
|
217
|
+
|
|
218
|
+
# Error handling - returns None for invalid components/pins
|
|
219
|
+
invalid_wire = sch.add_wire_between_pins("R999", "1", "R1", "1") # Returns None
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Component Bounding Box Visualization (NEW in v0.3.1)
|
|
223
|
+
|
|
224
|
+
```python
|
|
225
|
+
from kicad_sch_api.core.component_bounds import get_component_bounding_box
|
|
226
|
+
|
|
227
|
+
# Get component bounding box (body only)
|
|
228
|
+
resistor = sch.components.get("R1")
|
|
229
|
+
bbox = get_component_bounding_box(resistor, include_properties=False)
|
|
230
|
+
print(f"R1 body size: {bbox.width:.2f}×{bbox.height:.2f}mm")
|
|
231
|
+
|
|
232
|
+
# Get bounding box including properties (reference, value, etc.)
|
|
233
|
+
bbox_with_props = get_component_bounding_box(resistor, include_properties=True)
|
|
234
|
+
print(f"R1 with labels: {bbox_with_props.width:.2f}×{bbox_with_props.height:.2f}mm")
|
|
235
|
+
|
|
236
|
+
# Draw bounding box as rectangle graphics (for visualization/debugging)
|
|
237
|
+
rect_uuid = sch.draw_bounding_box(bbox)
|
|
238
|
+
print(f"Drew bounding box rectangle: {rect_uuid}")
|
|
239
|
+
|
|
240
|
+
# Draw bounding boxes for all components
|
|
241
|
+
bbox_uuids = sch.draw_component_bounding_boxes(
|
|
242
|
+
include_properties=False # True to include reference/value labels
|
|
243
|
+
)
|
|
244
|
+
print(f"Drew {len(bbox_uuids)} component bounding boxes")
|
|
245
|
+
|
|
246
|
+
# Expand bounding box for clearance analysis
|
|
247
|
+
expanded_bbox = bbox.expand(2.54) # Expand by 2.54mm (0.1 inch)
|
|
248
|
+
clearance_rect = sch.draw_bounding_box(expanded_bbox)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Manhattan Routing with Obstacle Avoidance (NEW in v0.3.1)
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
# Automatic Manhattan routing between component pins
|
|
255
|
+
wire_segments = sch.auto_route_pins(
|
|
256
|
+
"R1", "2", # From component R1, pin 2
|
|
257
|
+
"R2", "1", # To component R2, pin 1
|
|
258
|
+
routing_mode="manhattan", # Manhattan (L-shaped) routing
|
|
259
|
+
avoid_components=True # Avoid component bounding boxes
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
# Direct routing (straight line)
|
|
263
|
+
direct_wire = sch.auto_route_pins("C1", "1", "C2", "2", routing_mode="direct")
|
|
264
|
+
|
|
265
|
+
# Manual obstacle avoidance using bounding boxes
|
|
266
|
+
bbox_r1 = get_component_bounding_box(sch.components.get("R1"))
|
|
267
|
+
bbox_r2 = get_component_bounding_box(sch.components.get("R2"))
|
|
268
|
+
|
|
269
|
+
# Check if routing path intersects with component
|
|
270
|
+
def path_clear(start, end, obstacles):
|
|
271
|
+
# Custom collision detection logic
|
|
272
|
+
return not any(bbox.intersects_line(start, end) for bbox in obstacles)
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Component Search and Management
|
|
276
|
+
|
|
277
|
+
```python
|
|
278
|
+
# Search for components
|
|
279
|
+
resistors = sch.components.find(lib_id_pattern='Device:R*')
|
|
280
|
+
power_components = sch.components.filter(reference_pattern=r'U[0-9]+')
|
|
281
|
+
|
|
282
|
+
# Bulk updates
|
|
283
|
+
sch.components.bulk_update(
|
|
284
|
+
criteria={'lib_id': 'Device:R'},
|
|
285
|
+
updates={'properties': {'Tolerance': '1%'}}
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
# Component validation
|
|
289
|
+
validation_result = sch.components.validate_component(
|
|
290
|
+
'Device:R',
|
|
291
|
+
'Resistor_SMD:R_0603_1608Metric'
|
|
292
|
+
)
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Component and Element Removal
|
|
296
|
+
|
|
297
|
+
```python
|
|
298
|
+
# Remove components by reference
|
|
299
|
+
removed = sch.components.remove("R1") # Returns True if removed
|
|
300
|
+
|
|
301
|
+
# Remove wires, labels, and other elements
|
|
302
|
+
sch.remove_wire(wire_uuid)
|
|
303
|
+
sch.remove_label(label_uuid)
|
|
304
|
+
sch.remove_hierarchical_label(label_uuid)
|
|
305
|
+
|
|
306
|
+
# Remove from collections
|
|
307
|
+
sch.wires.remove(wire_uuid)
|
|
308
|
+
sch.junctions.remove(junction_uuid)
|
|
309
|
+
|
|
310
|
+
# lib_symbols are automatically cleaned up when last component of type is removed
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Configuration and Customization
|
|
314
|
+
|
|
315
|
+
```python
|
|
316
|
+
import kicad_sch_api as ksa
|
|
317
|
+
|
|
318
|
+
# Access global configuration
|
|
319
|
+
config = ksa.config
|
|
320
|
+
|
|
321
|
+
# Customize property positioning
|
|
322
|
+
config.properties.reference_y = -2.0 # Move reference labels higher
|
|
323
|
+
config.properties.value_y = 2.0 # Move value labels lower
|
|
324
|
+
|
|
325
|
+
# Customize tolerances and precision
|
|
326
|
+
config.tolerance.position_tolerance = 0.05 # Tighter position matching
|
|
327
|
+
config.tolerance.wire_segment_min = 0.005 # Different wire segment threshold
|
|
328
|
+
|
|
329
|
+
# Customize defaults
|
|
330
|
+
config.defaults.project_name = "my_company_project"
|
|
331
|
+
config.defaults.stroke_width = 0.1
|
|
332
|
+
|
|
333
|
+
# Grid and spacing customization
|
|
334
|
+
config.grid.unit_spacing = 10.0 # Tighter multi-unit IC spacing
|
|
335
|
+
config.grid.component_spacing = 5.0 # Closer component placement
|
|
336
|
+
|
|
337
|
+
# Sheet settings for hierarchical designs
|
|
338
|
+
config.sheet.name_offset_y = -1.0 # Different sheet label position
|
|
339
|
+
config.sheet.file_offset_y = 1.0 # Different file label position
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### KiCAD Integration
|
|
343
|
+
|
|
344
|
+
```python
|
|
345
|
+
# Run electrical rules check using KiCAD CLI
|
|
346
|
+
erc_result = sch.run_erc_check()
|
|
347
|
+
print(f"ERC Status: {erc_result.status}")
|
|
348
|
+
for violation in erc_result.violations:
|
|
349
|
+
print(f"- {violation.type}: {violation.message}")
|
|
350
|
+
|
|
351
|
+
# Generate netlist for connectivity analysis
|
|
352
|
+
netlist = sch.generate_netlist()
|
|
353
|
+
net_info = netlist.analyze_net("VCC")
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
## 🤖 AI Agent Integration
|
|
357
|
+
|
|
358
|
+
This library serves as the foundation for AI agent integration. For Claude Code or other AI agents, use the **[mcp-kicad-sch-api](https://github.com/circuit-synth/mcp-kicad-sch-api)** MCP server (included as a submodule in `submodules/mcp-kicad-sch-api/`).
|
|
359
|
+
|
|
360
|
+
## 🏗️ Architecture
|
|
361
|
+
|
|
362
|
+
### Library Structure
|
|
363
|
+
|
|
364
|
+
```
|
|
365
|
+
kicad-sch-api/
|
|
366
|
+
├── kicad_sch_api/ # Core Python library
|
|
367
|
+
│ ├── core/ # Core schematic manipulation
|
|
368
|
+
│ ├── library/ # KiCAD library integration
|
|
369
|
+
│ ├── discovery/ # Component search and indexing
|
|
370
|
+
│ └── utils/ # Validation and utilities
|
|
371
|
+
├── submodules/ # Related projects as submodules
|
|
372
|
+
│ └── mcp-kicad-sch-api/ # MCP server for AI agents
|
|
373
|
+
├── tests/ # Comprehensive test suite
|
|
374
|
+
└── examples/ # Usage examples and tutorials
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Design Principles
|
|
378
|
+
|
|
379
|
+
- **Building Block First**: Designed to be the foundation for other tools
|
|
380
|
+
- **Exact Format Preservation**: Guaranteed byte-perfect KiCAD output
|
|
381
|
+
- **Professional Quality**: Comprehensive error handling and validation
|
|
382
|
+
- **MCP Foundation**: Designed as a stable foundation for MCP servers and AI agents
|
|
383
|
+
- **Performance Optimized**: Fast operations on large schematics
|
|
384
|
+
|
|
385
|
+
## 🧪 Testing & Quality
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
# Run all tests (29 tests covering all functionality)
|
|
389
|
+
uv run pytest tests/ -v
|
|
390
|
+
|
|
391
|
+
# Format preservation tests (critical - exact KiCAD output matching)
|
|
392
|
+
uv run pytest tests/reference_tests/ -v
|
|
393
|
+
|
|
394
|
+
# Component removal tests (comprehensive removal functionality)
|
|
395
|
+
uv run pytest tests/test_*_removal.py -v
|
|
396
|
+
|
|
397
|
+
# Code quality checks
|
|
398
|
+
uv run black kicad_sch_api/ tests/
|
|
399
|
+
uv run mypy kicad_sch_api/
|
|
400
|
+
uv run flake8 kicad_sch_api/ tests/
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Test Categories
|
|
404
|
+
|
|
405
|
+
- **Format Preservation**: Byte-for-byte compatibility with KiCAD native files
|
|
406
|
+
- **Component Management**: Creation, modification, and removal of components
|
|
407
|
+
- **Element Operations**: Wires, labels, junctions, hierarchical sheets
|
|
408
|
+
- **Configuration**: Customizable settings and behavior
|
|
409
|
+
- **Performance**: Large schematic handling and optimization
|
|
410
|
+
- **Integration**: Real KiCAD library compatibility
|
|
411
|
+
|
|
412
|
+
## 🆚 Why This Library?
|
|
413
|
+
|
|
414
|
+
### vs. Direct KiCAD File Editing
|
|
415
|
+
- **Professional API**: High-level operations vs low-level S-expression manipulation
|
|
416
|
+
- **Guaranteed Format**: Byte-perfect output vs manual formatting
|
|
417
|
+
- **Validation**: Real KiCAD library integration and component validation
|
|
418
|
+
- **Performance**: Optimized collections vs manual iteration
|
|
419
|
+
|
|
420
|
+
### vs. Other Python KiCAD Libraries
|
|
421
|
+
- **Format Preservation**: Exact KiCAD compatibility vs approximate output
|
|
422
|
+
- **Modern Design**: Object-oriented collections vs legacy patterns
|
|
423
|
+
- **AI Integration**: Purpose-built MCP server vs no agent support
|
|
424
|
+
- **Professional Focus**: Production-ready vs exploration tools
|
|
425
|
+
|
|
426
|
+
## 🔗 Ecosystem
|
|
427
|
+
|
|
428
|
+
This library serves as the foundation for specialized tools and MCP servers:
|
|
429
|
+
|
|
430
|
+
```python
|
|
431
|
+
# Foundation library
|
|
432
|
+
import kicad_sch_api as ksa
|
|
433
|
+
|
|
434
|
+
# MCP servers and specialized libraries built on this foundation:
|
|
435
|
+
# - mcp-kicad-sch-api: Full MCP server for AI agents
|
|
436
|
+
# - kicad_sourcing_tools: Component sourcing extensions
|
|
437
|
+
# - kicad_placement_optimizer: Layout optimization
|
|
438
|
+
# - kicad_dfm_checker: Manufacturing validation
|
|
439
|
+
|
|
440
|
+
# Foundation provides reliable schematic manipulation
|
|
441
|
+
sch = ksa.load_schematic('project.kicad_sch')
|
|
442
|
+
|
|
443
|
+
# All extensions use the same stable API
|
|
444
|
+
# mcp_server.use_schematic(sch) # MCP server integration
|
|
445
|
+
# sourcing.update_sourcing(sch) # Component sourcing
|
|
446
|
+
# placement.optimize_layout(sch) # Layout optimization
|
|
447
|
+
|
|
448
|
+
# Foundation ensures exact format preservation
|
|
449
|
+
sch.save() # Guaranteed exact KiCAD format
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
## 📖 Documentation
|
|
453
|
+
|
|
454
|
+
- **[API Reference](docs/api.md)**: Complete API documentation
|
|
455
|
+
- **[Examples](examples/)**: Code examples and tutorials
|
|
456
|
+
- **[MCP Integration](docs/mcp.md)**: AI agent integration guide
|
|
457
|
+
- **[Development](docs/development.md)**: Contributing and development setup
|
|
458
|
+
|
|
459
|
+
## 🤝 Contributing
|
|
460
|
+
|
|
461
|
+
We welcome contributions! Key areas:
|
|
462
|
+
|
|
463
|
+
- KiCAD library integration and component validation
|
|
464
|
+
- Performance optimizations for large schematics
|
|
465
|
+
- Additional MCP tools for AI agents
|
|
466
|
+
- Test coverage and format preservation validation
|
|
467
|
+
|
|
468
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
469
|
+
|
|
470
|
+
## 📄 License
|
|
471
|
+
|
|
472
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
473
|
+
|
|
474
|
+
## 🔗 Related Projects
|
|
475
|
+
|
|
476
|
+
- **[mcp-kicad-sch-api](https://github.com/circuit-synth/mcp-kicad-sch-api)**: MCP server for AI agents built on this library (included as submodule)
|
|
477
|
+
- **[circuit-synth](https://github.com/circuit-synth/circuit-synth)**: High-level circuit design automation using this library
|
|
478
|
+
- **[Claude Code](https://claude.ai/code)**: AI development environment with MCP support
|
|
479
|
+
- **[KiCAD](https://kicad.org/)**: Open source electronics design automation suite
|
|
480
|
+
|
|
481
|
+
---
|
|
482
|
+
|
|
483
|
+
**Professional KiCAD schematic manipulation for the AI age ⚡**
|