# kicad-sch-api
**Professional KiCAD Schematic Manipulation Library with AI Agent Integration**
## ๐ Key Features
- **๐ Exact Format Preservation**: Output matches KiCAD's native formatting exactly
- **โก High Performance**: Optimized for large schematics with symbol caching
- **๐ง Enhanced API**: Intuitive object-oriented interface with bulk operations
- **๐ Advanced Library Management**: Multi-source symbol lookup and caching
- **โ
Professional Validation**: Comprehensive error collection and reporting
- **๐ฏ KiCAD 9 Optimized**: Built specifically for latest KiCAD format
## ๐ vs. Existing Solutions
| Feature | kicad-sch-api | Other Solutions | KiCAD Official API |
|---------|---------------|-----------------|-------------------|
| **Schematic Support** | โ
Full | โ ๏ธ Varies | โ PCB Only |
| **Format Preservation** | โ
Exact | โ Basic | N/A |
| **Performance** | โ
Optimized | โ ๏ธ Basic | N/A |
| **Library Management** | โ
Advanced | โ ๏ธ Limited | N/A |
| **Runtime Dependencies** | โ None | โ ๏ธ Varies | โ
KiCAD Required |
## ๐ฆ Installation
```bash
# Install from PyPI (coming soon)
pip install kicad-sch-api
# Or install from source
git clone https://github.com/circuit-synth/kicad-sch-api.git
cd kicad-sch-api/python
pip install -e .
npm install
npm run build
```
## ๐ฏ Quick Start
### Basic Schematic Manipulation
```python
import kicad_sch_api as ksa
# Create new schematic
sch = ksa.create_schematic('My Circuit')
# Add components
resistor = sch.components.add('Device:R', reference='R1', value='10k', position=(100, 100))
capacitor = sch.components.add('Device:C', reference='C1', value='0.1uF', position=(150, 100))
# Update properties
resistor.footprint = 'Resistor_SMD:R_0603_1608Metric'
resistor.set_property('MPN', 'RC0603FR-0710KL')
# Save with exact format preservation
sch.save('my_circuit.kicad_sch')
```
### Advanced Operations
```python
# Bulk operations for large schematics
resistors = sch.components.filter(lib_id='Device:R')
for r in resistors:
r.set_property('Tolerance', '1%')
# Search and analysis
power_components = sch.components.in_area(0, 0, 50, 50)
high_value_resistors = sch.components.filter(
lib_id='Device:R',
value_pattern='*k' # Components with 'k' in value
)
# Validation and error checking
issues = sch.validate()
if issues:
print(f"Found {len(issues)} validation issues:")
for issue in issues:
print(f" {issue}")
# Performance statistics
stats = sch.get_performance_stats()
print(f"Cache hit rate: {stats['symbol_cache']['hit_rate_percent']}%")
```
```json
{
"kicad-sch": {
"command": "node",
"env": {
"PYTHON_PATH": "python3",
"KICAD_SCH_API_PATH": "/path/to/kicad-sch-api/python"
}
}
}
```
Then use natural language with your AI agent:
```
User: "Create a voltage divider circuit with two 10k resistors"
Claude: I'll create a voltage divider circuit for you.
1. Create new schematic
2. Add R1 (10k resistor) at (100, 100)
3. Add R2 (10k resistor) at (100, 150)
4. Connect components with wires
5. Add voltage input and output labels
6. Save schematic with exact formatting
Your voltage divider circuit is ready! The circuit provides 50% voltage division
with two 10kฮฉ resistors in series configuration.
```
## ๐๏ธ Architecture
The library consists of two main components:
### Python Library (Core)
- **Enhanced Object Model**: Intuitive API with fast component collections
- **Exact Format Preservation**: S-expression writer that matches KiCAD output
- **Symbol Caching**: High-performance library symbol management
- **Comprehensive Validation**: Error collection and professional reporting
- **Python Bridge**: Reliable subprocess communication
- **Comprehensive Tools**: 15+ tools for complete schematic manipulation
- **Professional Error Handling**: Detailed error context for AI agents
## ๐งช Testing & Quality
```bash
# Python tests
cd python
python -m pytest tests/ -v --cov=kicad_sch_api
npm test
# Format preservation tests
python -m pytest tests/test_format_preservation.py -v
```
## ๐ค Contributing
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
## ๐ License
MIT License - see [LICENSE](LICENSE) for details.
## ๐ Related Projects
- **[circuit-synth](https://github.com/circuit-synth/circuit-synth)**: Comprehensive circuit design automation
- **[sexpdata](https://github.com/jd-boyd/sexpdata)**: S-expression parsing library
---
**Built with โค๏ธ by the Circuit-Synth team**
Raw data
{
"_id": null,
"home_page": null,
"name": "kicad-sch-api",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Circuit-Synth <shane@circuit-synth.com>",
"keywords": "kicad, schematic, eda, electronics, circuit-design, ai, automation, pcb",
"author": null,
"author_email": "Circuit-Synth <shane@circuit-synth.com>",
"download_url": "https://files.pythonhosted.org/packages/eb/4e/c2fd364b42dc666dcdfa987c44d828ccd8af97987b75059ffe8735f4a80b/kicad_sch_api-0.1.1.tar.gz",
"platform": null,
"description": "# kicad-sch-api\n\n**Professional KiCAD Schematic Manipulation Library with AI Agent Integration**\n\n\n## \ud83d\ude80 Key Features\n\n- **\ud83d\udccb Exact Format Preservation**: Output matches KiCAD's native formatting exactly\n- **\u26a1 High Performance**: Optimized for large schematics with symbol caching\n- **\ud83d\udd27 Enhanced API**: Intuitive object-oriented interface with bulk operations\n- **\ud83d\udcda Advanced Library Management**: Multi-source symbol lookup and caching\n- **\u2705 Professional Validation**: Comprehensive error collection and reporting\n- **\ud83c\udfaf KiCAD 9 Optimized**: Built specifically for latest KiCAD format\n\n## \ud83c\udd9a vs. Existing Solutions\n\n| Feature | kicad-sch-api | Other Solutions | KiCAD Official API |\n|---------|---------------|-----------------|-------------------|\n| **Schematic Support** | \u2705 Full | \u26a0\ufe0f Varies | \u274c PCB Only |\n| **Format Preservation** | \u2705 Exact | \u274c Basic | N/A |\n| **Performance** | \u2705 Optimized | \u26a0\ufe0f Basic | N/A |\n| **Library Management** | \u2705 Advanced | \u26a0\ufe0f Limited | N/A |\n| **Runtime Dependencies** | \u274c None | \u26a0\ufe0f Varies | \u2705 KiCAD Required |\n\n## \ud83d\udce6 Installation\n\n```bash\n# Install from PyPI (coming soon)\npip install kicad-sch-api\n\n# Or install from source\ngit clone https://github.com/circuit-synth/kicad-sch-api.git\ncd kicad-sch-api/python\npip install -e .\n\nnpm install\nnpm run build\n```\n\n## \ud83c\udfaf Quick Start\n\n### Basic Schematic Manipulation\n\n```python\nimport kicad_sch_api as ksa\n\n# Create new schematic\nsch = ksa.create_schematic('My Circuit')\n\n# Add components\nresistor = sch.components.add('Device:R', reference='R1', value='10k', position=(100, 100))\ncapacitor = sch.components.add('Device:C', reference='C1', value='0.1uF', position=(150, 100))\n\n# Update properties\nresistor.footprint = 'Resistor_SMD:R_0603_1608Metric'\nresistor.set_property('MPN', 'RC0603FR-0710KL')\n\n# Save with exact format preservation\nsch.save('my_circuit.kicad_sch')\n```\n\n### Advanced Operations\n\n```python\n# Bulk operations for large schematics\nresistors = sch.components.filter(lib_id='Device:R')\nfor r in resistors:\n r.set_property('Tolerance', '1%')\n\n# Search and analysis\npower_components = sch.components.in_area(0, 0, 50, 50)\nhigh_value_resistors = sch.components.filter(\n lib_id='Device:R', \n value_pattern='*k' # Components with 'k' in value\n)\n\n# Validation and error checking\nissues = sch.validate()\nif issues:\n print(f\"Found {len(issues)} validation issues:\")\n for issue in issues:\n print(f\" {issue}\")\n\n# Performance statistics\nstats = sch.get_performance_stats()\nprint(f\"Cache hit rate: {stats['symbol_cache']['hit_rate_percent']}%\")\n```\n\n\n\n```json\n{\n \"kicad-sch\": {\n \"command\": \"node\",\n \"env\": {\n \"PYTHON_PATH\": \"python3\",\n \"KICAD_SCH_API_PATH\": \"/path/to/kicad-sch-api/python\"\n }\n }\n}\n```\n\nThen use natural language with your AI agent:\n\n```\nUser: \"Create a voltage divider circuit with two 10k resistors\"\n\nClaude: I'll create a voltage divider circuit for you.\n\n1. Create new schematic\n2. Add R1 (10k resistor) at (100, 100)\n3. Add R2 (10k resistor) at (100, 150) \n4. Connect components with wires\n5. Add voltage input and output labels\n6. Save schematic with exact formatting\n\nYour voltage divider circuit is ready! The circuit provides 50% voltage division\nwith two 10k\u03a9 resistors in series configuration.\n```\n\n## \ud83c\udfd7\ufe0f Architecture\n\nThe library consists of two main components:\n\n### Python Library (Core)\n- **Enhanced Object Model**: Intuitive API with fast component collections\n- **Exact Format Preservation**: S-expression writer that matches KiCAD output\n- **Symbol Caching**: High-performance library symbol management\n- **Comprehensive Validation**: Error collection and professional reporting\n\n- **Python Bridge**: Reliable subprocess communication\n- **Comprehensive Tools**: 15+ tools for complete schematic manipulation\n- **Professional Error Handling**: Detailed error context for AI agents\n\n## \ud83e\uddea Testing & Quality\n\n```bash\n# Python tests\ncd python\npython -m pytest tests/ -v --cov=kicad_sch_api\n\nnpm test\n\n# Format preservation tests\npython -m pytest tests/test_format_preservation.py -v\n```\n\n## \ud83e\udd1d Contributing\n\nWe welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## \ud83d\udcc4 License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n## \ud83d\udd17 Related Projects\n\n- **[circuit-synth](https://github.com/circuit-synth/circuit-synth)**: Comprehensive circuit design automation\n- **[sexpdata](https://github.com/jd-boyd/sexpdata)**: S-expression parsing library\n\n---\n\n**Built with \u2764\ufe0f by the Circuit-Synth team**\n",
"bugtrack_url": null,
"license": null,
"summary": "Professional KiCAD schematic manipulation library with exact format preservation and AI agent integration",
"version": "0.1.1",
"project_urls": {
"Bug Reports": "https://github.com/circuit-synth/kicad-sch-api/issues",
"Changelog": "https://github.com/circuit-synth/kicad-sch-api/blob/main/CHANGELOG.md",
"Documentation": "https://circuit-synth.github.io/kicad-sch-api/",
"Homepage": "https://github.com/circuit-synth/kicad-sch-api",
"Repository": "https://github.com/circuit-synth/kicad-sch-api.git"
},
"split_keywords": [
"kicad",
" schematic",
" eda",
" electronics",
" circuit-design",
" ai",
" automation",
" pcb"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "97e19510ee875dce43a0ae465551cb0f00b51506365b4b8a1e5116fa0f6e29ae",
"md5": "9dea58ef160ca601abe76da2fd61bbac",
"sha256": "3e78d9506679a4a4ab1c10e3352f93495bcd515a7b5f31f9e7732f20280fdca9"
},
"downloads": -1,
"filename": "kicad_sch_api-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9dea58ef160ca601abe76da2fd61bbac",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 57211,
"upload_time": "2025-08-18T01:50:35",
"upload_time_iso_8601": "2025-08-18T01:50:35.879137Z",
"url": "https://files.pythonhosted.org/packages/97/e1/9510ee875dce43a0ae465551cb0f00b51506365b4b8a1e5116fa0f6e29ae/kicad_sch_api-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "eb4ec2fd364b42dc666dcdfa987c44d828ccd8af97987b75059ffe8735f4a80b",
"md5": "4b122ff267692726a2f2532232606572",
"sha256": "23e8c2d65165ad35d83cbb45d25d7e43d5ed4c4d6d954a078a9f404b836f890d"
},
"downloads": -1,
"filename": "kicad_sch_api-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "4b122ff267692726a2f2532232606572",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 92854,
"upload_time": "2025-08-18T01:50:37",
"upload_time_iso_8601": "2025-08-18T01:50:37.333737Z",
"url": "https://files.pythonhosted.org/packages/eb/4e/c2fd364b42dc666dcdfa987c44d828ccd8af97987b75059ffe8735f4a80b/kicad_sch_api-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-18 01:50:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "circuit-synth",
"github_project": "kicad-sch-api",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "kicad-sch-api"
}