kicad-sch-api 0.1.7__py3-none-any.whl → 0.2.1__py3-none-any.whl

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.
@@ -1,322 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: kicad-sch-api
3
- Version: 0.1.7
4
- Summary: Professional KiCAD schematic manipulation library with exact format preservation and AI agent integration
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: fastmcp>=2.0.0
29
- Requires-Dist: mcp[cli]>=1.13.0
30
- Requires-Dist: sexpdata>=0.0.3
31
- Requires-Dist: typing-extensions>=4.0.0; python_version < "3.11"
32
- Provides-Extra: dev
33
- Requires-Dist: pytest>=7.0.0; extra == "dev"
34
- Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
35
- Requires-Dist: pytest-xdist>=3.0.0; extra == "dev"
36
- Requires-Dist: black>=22.0.0; extra == "dev"
37
- Requires-Dist: isort>=5.0.0; extra == "dev"
38
- Requires-Dist: flake8>=4.0.0; extra == "dev"
39
- Requires-Dist: mypy>=1.0.0; extra == "dev"
40
- Requires-Dist: pre-commit>=3.0.0; extra == "dev"
41
- Provides-Extra: mcp
42
- Requires-Dist: mcp[cli]>=1.0.0; extra == "mcp"
43
- Requires-Dist: fastmcp>=2.0.0; extra == "mcp"
44
- Provides-Extra: docs
45
- Requires-Dist: sphinx>=5.0.0; extra == "docs"
46
- Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
47
- Requires-Dist: myst-parser>=0.18.0; extra == "docs"
48
- Dynamic: license-file
49
-
50
- # KiCAD Schematic API
51
-
52
- **Professional Python library for KiCAD schematic file manipulation with exact format preservation**
53
-
54
- ## Overview
55
-
56
- 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.
57
-
58
- ## 🎯 Core Features
59
-
60
- - **📋 Exact Format Preservation**: Byte-perfect KiCAD output that matches native formatting
61
- - **🏗️ Professional Component Management**: Object-oriented collections with search and validation
62
- - **⚡ High Performance**: Optimized for large schematics with intelligent caching
63
- - **🔍 Real KiCAD Library Integration**: Access to actual KiCAD symbol libraries and validation
64
- - **🤖 AI Agent Ready**: MCP server for seamless integration with AI development tools
65
- - **📚 Hierarchical Design**: Complete support for multi-sheet schematic projects
66
-
67
- ## 🚀 Quick Start
68
-
69
- ### Installation
70
-
71
- ```bash
72
- # Install from PyPI
73
- pip install kicad-sch-api
74
-
75
- # Or install from source
76
- git clone https://github.com/circuit-synth/kicad-sch-api.git
77
- cd kicad-sch-api/python
78
- uv pip install -e .
79
- ```
80
-
81
- ### Basic Usage
82
-
83
- ```python
84
- import kicad_sch_api as ksa
85
-
86
- # Create a new schematic
87
- sch = ksa.create_schematic("My Circuit")
88
-
89
- # Add components with proper validation
90
- resistor = sch.components.add(
91
- lib_id="Device:R",
92
- reference="R1",
93
- value="10k",
94
- position=(100.0, 100.0),
95
- footprint="Resistor_SMD:R_0603_1608Metric",
96
- datasheet="~",
97
- description="Resistor"
98
- )
99
-
100
- capacitor = sch.components.add(
101
- lib_id="Device:C",
102
- reference="C1",
103
- value="100nF",
104
- position=(150.0, 100.0),
105
- footprint="Capacitor_SMD:C_0603_1608Metric"
106
- )
107
-
108
- # Save with exact format preservation
109
- sch.save("my_circuit.kicad_sch")
110
- ```
111
-
112
- ### Hierarchical Design
113
-
114
- ```python
115
- # Create main schematic with hierarchical sheet
116
- main_sch = ksa.create_schematic("Main Board")
117
-
118
- # Add hierarchical sheet
119
- power_sheet = main_sch.add_hierarchical_sheet(
120
- name="Power Supply",
121
- filename="power.kicad_sch",
122
- position=(100, 100),
123
- size=(80, 60)
124
- )
125
-
126
- # Add sheet pins for connectivity
127
- power_sheet.add_pin("VIN", pin_type="input", position=(0, 10))
128
- power_sheet.add_pin("VOUT", pin_type="output", position=(80, 10))
129
-
130
- # Create the sub-schematic
131
- power_sch = ksa.create_schematic("Power Supply")
132
- power_sch.add_hierarchical_label("VIN", label_type="input", position=(50, 25))
133
- power_sch.add_hierarchical_label("VOUT", label_type="output", position=(150, 25))
134
-
135
- # Save both schematics
136
- main_sch.save("main.kicad_sch")
137
- power_sch.save("power.kicad_sch")
138
- ```
139
-
140
- ## 🔧 Advanced Features
141
-
142
- ### Component Search and Management
143
-
144
- ```python
145
- # Search for components
146
- resistors = sch.components.find(lib_id_pattern='Device:R*')
147
- power_components = sch.components.filter(reference_pattern=r'U[0-9]+')
148
-
149
- # Bulk updates
150
- sch.components.bulk_update(
151
- criteria={'lib_id': 'Device:R'},
152
- updates={'properties': {'Tolerance': '1%'}}
153
- )
154
-
155
- # Component validation
156
- validation_result = sch.components.validate_component(
157
- 'Device:R',
158
- 'Resistor_SMD:R_0603_1608Metric'
159
- )
160
- ```
161
-
162
- ### KiCAD Integration
163
-
164
- ```python
165
- # Run electrical rules check using KiCAD CLI
166
- erc_result = sch.run_erc_check()
167
- print(f"ERC Status: {erc_result.status}")
168
- for violation in erc_result.violations:
169
- print(f"- {violation.type}: {violation.message}")
170
-
171
- # Generate netlist for connectivity analysis
172
- netlist = sch.generate_netlist()
173
- net_info = netlist.analyze_net("VCC")
174
- ```
175
-
176
- ## 🤖 AI Agent Integration (MCP Server)
177
-
178
- Use with Claude Code or other AI agents via Model Context Protocol:
179
-
180
- ### Setup MCP Server
181
-
182
- ```bash
183
- # Install MCP server
184
- pip install kicad-sch-api[mcp]
185
-
186
- # Configure for Claude Code (automatic)
187
- kicad-sch-api --setup-claude-code
188
- ```
189
-
190
- ### Usage with AI Agents
191
-
192
- ```
193
- # Natural language commands to your AI agent:
194
- "Create a voltage divider with two 10kΩ resistors"
195
- "Add an ESP32 microcontroller with USB connector"
196
- "Generate a hierarchical schematic with power supply subcircuit"
197
- ```
198
-
199
- The AI agent will use the MCP server to:
200
- 1. Create professional schematics with proper component references
201
- 2. Use hierarchical labels instead of messy wires
202
- 3. Apply KiCAD design best practices automatically
203
- 4. Generate clean, industry-standard layouts
204
-
205
- ### Available MCP Tools
206
-
207
- | Tool | Description |
208
- |------|-------------|
209
- | `create_schematic` | Create new schematic files |
210
- | `add_component` | Add components with validation |
211
- | `search_components` | Find components in KiCAD libraries |
212
- | `add_hierarchical_sheet` | Create multi-sheet designs |
213
- | `validate_component` | Check component/footprint compatibility |
214
- | `list_components` | Get all components in schematic |
215
- | `save_schematic` | Save with exact format preservation |
216
-
217
- ## 🏗️ Architecture
218
-
219
- ### Library Structure
220
-
221
- ```
222
- kicad_sch_api/
223
- ├── core/ # Core schematic manipulation
224
- ├── library/ # KiCAD library integration
225
- ├── integration/ # KiCAD CLI and tool integration
226
- ├── mcp/ # MCP server for AI agents
227
- └── utils/ # Validation and utilities
228
- ```
229
-
230
- ### Design Principles
231
-
232
- - **Building Block First**: Designed to be the foundation for other tools
233
- - **Exact Format Preservation**: Guaranteed byte-perfect KiCAD output
234
- - **Professional Quality**: Comprehensive error handling and validation
235
- - **AI-Native**: Built specifically for AI agent integration
236
- - **Performance Optimized**: Fast operations on large schematics
237
-
238
- ## 🧪 Testing & Quality
239
-
240
- ```bash
241
- # Run all tests
242
- uv run pytest tests/ -v
243
-
244
- # Format preservation tests (critical)
245
- uv run pytest tests/reference_tests/ -v
246
-
247
- # Code quality checks
248
- uv run black kicad_sch_api/ tests/
249
- uv run mypy kicad_sch_api/
250
- uv run flake8 kicad_sch_api/ tests/
251
- ```
252
-
253
- ## 🆚 Why This Library?
254
-
255
- ### vs. Direct KiCAD File Editing
256
- - **Professional API**: High-level operations vs low-level S-expression manipulation
257
- - **Guaranteed Format**: Byte-perfect output vs manual formatting
258
- - **Validation**: Real KiCAD library integration and component validation
259
- - **Performance**: Optimized collections vs manual iteration
260
-
261
- ### vs. Other Python KiCAD Libraries
262
- - **Format Preservation**: Exact KiCAD compatibility vs approximate output
263
- - **Modern Design**: Object-oriented collections vs legacy patterns
264
- - **AI Integration**: Purpose-built MCP server vs no agent support
265
- - **Professional Focus**: Production-ready vs exploration tools
266
-
267
- ## 🔗 Ecosystem
268
-
269
- This library is designed as a building block for specialized tools:
270
-
271
- ```python
272
- # Foundation library
273
- import kicad_sch_api as ksa
274
-
275
- # Specialized libraries (examples of what could be built)
276
- # import kicad_sourcing_tools as sourcing # Component sourcing
277
- # import kicad_placement_optimizer as placement # Layout optimization
278
- # import kicad_dfm_checker as dfm # Manufacturing validation
279
-
280
- # Foundation provides reliable schematic manipulation
281
- sch = ksa.load_schematic('project.kicad_sch')
282
-
283
- # Specialized tools extend functionality
284
- # sourcing.update_component_sourcing(sch.components)
285
- # placement.optimize_layout(sch)
286
- # dfm.check_manufacturing_rules(sch)
287
-
288
- # All save through foundation's format preservation
289
- sch.save() # Guaranteed exact KiCAD format
290
- ```
291
-
292
- ## 📖 Documentation
293
-
294
- - **[API Reference](docs/api.md)**: Complete API documentation
295
- - **[Examples](examples/)**: Code examples and tutorials
296
- - **[MCP Integration](docs/mcp.md)**: AI agent integration guide
297
- - **[Development](docs/development.md)**: Contributing and development setup
298
-
299
- ## 🤝 Contributing
300
-
301
- We welcome contributions! Key areas:
302
-
303
- - KiCAD library integration and component validation
304
- - Performance optimizations for large schematics
305
- - Additional MCP tools for AI agents
306
- - Test coverage and format preservation validation
307
-
308
- See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
309
-
310
- ## 📄 License
311
-
312
- MIT License - see [LICENSE](LICENSE) for details.
313
-
314
- ## 🔗 Related Projects
315
-
316
- - **[circuit-synth](https://github.com/circuit-synth/circuit-synth)**: High-level circuit design automation using this library
317
- - **[Claude Code](https://claude.ai/code)**: AI development environment with MCP support
318
- - **[KiCAD](https://kicad.org/)**: Open source electronics design automation suite
319
-
320
- ---
321
-
322
- **Professional KiCAD schematic manipulation for the AI age ⚡**
@@ -1,26 +0,0 @@
1
- kicad_sch_api/__init__.py,sha256=mogTeOic6O-WWOfpoRuBzPicVNha-gbdMrhJX4ir5PY,2821
2
- kicad_sch_api/cli.py,sha256=zBu5939tFxBkHDireUpKUi73G2VG75qZacsWhsZz9Ro,14247
3
- kicad_sch_api/py.typed,sha256=e4ldqxwpY7pNDG1olbvj4HSKr8sZ9vxgA_2ek8xXn-Q,70
4
- kicad_sch_api/core/__init__.py,sha256=ur_KeYBlGKl-e1hLpLdxAhGV2A-PCCGkcqd0r6KSeBA,566
5
- kicad_sch_api/core/components.py,sha256=TiQrl7jdDTnuCWKdrlQC8-3b9PU58KoxTTnPX6VyZZk,24759
6
- kicad_sch_api/core/formatter.py,sha256=kvKbuVLkZOV7iyEmzAeFvxnOd4FpQ-7dwG8rvyTrXss,14346
7
- kicad_sch_api/core/ic_manager.py,sha256=5pw0FtUBXeF6afbiYej7kQe6ga32N4bNTScEHWYGq7A,7298
8
- kicad_sch_api/core/junctions.py,sha256=p99iv8pBb-3oktVsTeHgjl7QkkZa9EeN32nSy4g23o4,6251
9
- kicad_sch_api/core/parser.py,sha256=s1NwkuhouOplsBy-yZ_6RISmlunhWqRlD_8aNxIpYdU,44741
10
- kicad_sch_api/core/schematic.py,sha256=EHofbbfZfBfDcdHNNsO9peNNu3Iq07m2g_xQjL41p20,45972
11
- kicad_sch_api/core/types.py,sha256=I56eG0G8C4t9OaMiTcbxn6-xivwjpP5EXZUHnDoB6mY,12853
12
- kicad_sch_api/core/wires.py,sha256=kvANBg79KxOd5TKZNpHbjMyouZbGwRKLPNz4ePvvHgk,8207
13
- kicad_sch_api/discovery/__init__.py,sha256=0ky_FT58x-6aez6R9nhH2BBV27yG1N8EutRbRu7USxo,328
14
- kicad_sch_api/discovery/search_index.py,sha256=Yl3PXRk19mXCDtABM6Bs0ii0HMGiUAmIpD7xZjt7oEU,15943
15
- kicad_sch_api/library/__init__.py,sha256=NG9UTdcpn25Bl9tPsYs9ED7bvpaVPVdtLMbnxkQkOnU,250
16
- kicad_sch_api/library/cache.py,sha256=NPJT-apWH_JfVG1aXJ0gDnfGu8es_2tYiyZr-chcTxY,33511
17
- kicad_sch_api/mcp/__init__.py,sha256=Jw4gKdn9H-2MVUYBTIAb6s5Tz2mYc9KoQPRsx-voD4s,159
18
- kicad_sch_api/mcp/server.py,sha256=OB79fTR0lZubxC1jm0Avib37Zv_-nqZPl4XrrL_qO4c,54445
19
- kicad_sch_api/utils/__init__.py,sha256=1V_yGgI7jro6MUc4Pviux_WIeJ1wmiYFID186SZwWLQ,277
20
- kicad_sch_api/utils/validation.py,sha256=XlWGRZJb3cOPYpU9sLQQgC_NASwbi6W-LCN7PzUmaPY,15626
21
- kicad_sch_api-0.1.7.dist-info/licenses/LICENSE,sha256=Em65Nvte1G9MHc0rHqtYuGkCPcshD588itTa358J6gs,1070
22
- kicad_sch_api-0.1.7.dist-info/METADATA,sha256=kbs3QfDqzcDwbRrrk133KSJz-by8LTdO8qpcJPHafWw,10566
23
- kicad_sch_api-0.1.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
- kicad_sch_api-0.1.7.dist-info/entry_points.txt,sha256=Ibo-83_EdwmiuQwMcOHEzClKgl8MC9syASWtYzeD-os,103
25
- kicad_sch_api-0.1.7.dist-info/top_level.txt,sha256=n0ex4gOJ1b_fARowcGqRzyOGZcHRhc5LZa6_vVgGxcI,14
26
- kicad_sch_api-0.1.7.dist-info/RECORD,,