kicad-sch-api 0.0.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.

Potentially problematic release.


This version of kicad-sch-api might be problematic. Click here for more details.

@@ -0,0 +1,112 @@
1
+ """
2
+ kicad-sch-api: Professional KiCAD Schematic Manipulation Library
3
+
4
+ A modern, high-performance Python library for programmatic manipulation of KiCAD schematic files
5
+ with exact format preservation, advanced component management, and AI agent integration.
6
+
7
+ Key Features:
8
+ - Exact format preservation (output matches KiCAD exactly)
9
+ - Enhanced object model with intuitive API
10
+ - Symbol library caching and management
11
+ - Multi-source component intelligence
12
+ - Native MCP server for AI agent integration
13
+ - Professional error handling and validation
14
+
15
+ Basic Usage:
16
+ import kicad_sch_api as ksa
17
+
18
+ # Load schematic
19
+ sch = ksa.Schematic('my_circuit.kicad_sch')
20
+
21
+ # Add components
22
+ resistor = sch.components.add('Device:R', ref='R1', value='10k', pos=(100, 100))
23
+
24
+ # Modify properties
25
+ resistor.footprint = 'Resistor_SMD:R_0603_1608Metric'
26
+
27
+ # Save with exact format preservation
28
+ sch.save()
29
+
30
+ Advanced Usage:
31
+ # Bulk operations
32
+ resistors = sch.components.filter(lib_id='Device:R')
33
+ for r in resistors:
34
+ r.properties['Tolerance'] = '1%'
35
+
36
+ # Library management
37
+ sch.libraries.add_path('/path/to/custom/symbols.kicad_sym')
38
+
39
+ # Validation
40
+ issues = sch.validate()
41
+ if issues:
42
+ print(f"Found {len(issues)} validation issues")
43
+ """
44
+
45
+ __version__ = "0.0.1"
46
+ __author__ = "Circuit-Synth"
47
+ __email__ = "info@circuit-synth.com"
48
+
49
+ from .core.components import Component, ComponentCollection
50
+
51
+ # Core imports for public API
52
+ from .core.schematic import Schematic
53
+ from .library.cache import SymbolLibraryCache, get_symbol_cache
54
+ from .utils.validation import ValidationError, ValidationIssue
55
+
56
+ # Version info
57
+ VERSION_INFO = (0, 0, 1)
58
+
59
+ # Public API
60
+ __all__ = [
61
+ # Core classes
62
+ "Schematic",
63
+ "Component",
64
+ "ComponentCollection",
65
+ "SymbolLibraryCache",
66
+ "get_symbol_cache",
67
+ # Exceptions
68
+ "ValidationError",
69
+ "ValidationIssue",
70
+ # Version info
71
+ "__version__",
72
+ "VERSION_INFO",
73
+ ]
74
+
75
+
76
+ # Convenience functions
77
+ def load_schematic(file_path: str) -> "Schematic":
78
+ """
79
+ Load a KiCAD schematic file.
80
+
81
+ Args:
82
+ file_path: Path to .kicad_sch file
83
+
84
+ Returns:
85
+ Schematic object for manipulation
86
+
87
+ Example:
88
+ >>> sch = ksa.load_schematic('my_circuit.kicad_sch')
89
+ >>> print(f"Loaded {len(sch.components)} components")
90
+ """
91
+ return Schematic.load(file_path)
92
+
93
+
94
+ def create_schematic(name: str = "Untitled") -> "Schematic":
95
+ """
96
+ Create a new empty schematic.
97
+
98
+ Args:
99
+ name: Optional schematic name
100
+
101
+ Returns:
102
+ New empty Schematic object
103
+
104
+ Example:
105
+ >>> sch = ksa.create_schematic("My New Circuit")
106
+ >>> sch.components.add('Device:R', 'R1', '10k')
107
+ """
108
+ return Schematic.create(name)
109
+
110
+
111
+ # Add convenience functions to __all__
112
+ __all__.extend(["load_schematic", "create_schematic"])
@@ -0,0 +1,23 @@
1
+ """Core kicad-sch-api functionality."""
2
+
3
+ from .components import Component, ComponentCollection
4
+ from .formatter import ExactFormatter
5
+ from .parser import SExpressionParser
6
+ from .schematic import Schematic, create_schematic, load_schematic
7
+ from .types import Junction, Label, Net, Point, SchematicSymbol, Wire
8
+
9
+ __all__ = [
10
+ "Schematic",
11
+ "Component",
12
+ "ComponentCollection",
13
+ "Point",
14
+ "SchematicSymbol",
15
+ "Wire",
16
+ "Junction",
17
+ "Label",
18
+ "Net",
19
+ "SExpressionParser",
20
+ "ExactFormatter",
21
+ "load_schematic",
22
+ "create_schematic",
23
+ ]