python-kicad
python-kicad provides Pydantic models and parsers for KiCad schematic,
PCB, and exported netlist files.
- KiCad 6 and newer
- Python 3.10 and newer
- No KiCad installation required
- MIT licensed
Installation
python -m pip install python-kicad
The distribution is named python-kicad, while the import package remains
pykicad:
from pykicad import Pcb, Schematic, read_from_file
document = read_from_file("project.kicad_pcb")
if isinstance(document, Pcb):
print(document.version)
print(len(document.footprint))
elif isinstance(document, Schematic):
print(document.version)
print(len(document.symbols))
An older, unrelated distribution already uses the pykicad name on PyPI and
installs into the same Python import namespace. Do not install pykicad and
python-kicad into the same environment.
Supported documents
read_from_file() and read_from_string() recognize:
.kicad_pcbboard files asPcb.kicad_schschematic files asSchematic- KiCad-exported S-expression netlists as
Netlist
The parser uses one Pydantic model family for released KiCad 6 and newer file variants. Unknown enum values and malformed S-expressions remain validation errors.
from pydantic import ValidationError
from pykicad import read_from_string
try:
board = read_from_string(
"(kicad_pcb (version 20240101) (generator pcbnew))"
)
except (ValueError, ValidationError) as error:
print(f"Invalid KiCad document: {error}")
Writing limitations
Exact PCB round-tripping is available for an unchanged Pcb loaded through
read_from_file() or read_from_string():
from pykicad import read_from_file, write_to_file
board = read_from_file("project.kicad_pcb")
write_to_file(board, "copy.kicad_pcb")
Structured serialization of modified PCB models and schematic writing are not
implemented. Attempting either raises ValueError.
Development
Create an environment and install the development dependencies:
python -m pip install -e ".[dev]"
python -m pytest
Build and validate release artifacts with:
python -m build
python -m twine check dist/*
python scripts/check_distribution.py dist/*
See RELEASING.md for the trusted-publishing release process.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_kicad-0.5.0.tar.gz.
File metadata
- Download URL: python_kicad-0.5.0.tar.gz
- Upload date:
- Size: 133.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39a2651898cbdf34c5e8125a3509c5b5657396b17e34dbd8d620157009a1f8aa
|
|
| MD5 |
27c51e7123b4f29cb727a413b71015f4
|
|
| BLAKE2b-256 |
e2c79c24e8d332cfb2acbf14b94a2abdb74c8b6a925ace33b0b0d730afa739a8
|
Provenance
The following attestation bundles were made for python_kicad-0.5.0.tar.gz:
Publisher:
publish.yml on esophagoose/python-kicad
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_kicad-0.5.0.tar.gz -
Subject digest:
39a2651898cbdf34c5e8125a3509c5b5657396b17e34dbd8d620157009a1f8aa - Sigstore transparency entry: 2305051731
- Sigstore integration time:
-
Permalink:
esophagoose/python-kicad@471b1a097a6b23de8fe9983ce5739654c0774ae3 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/esophagoose
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@471b1a097a6b23de8fe9983ce5739654c0774ae3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file python_kicad-0.5.0-py3-none-any.whl.
File metadata
- Download URL: python_kicad-0.5.0-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c420e4a470df8c1a60b7ec76d58430bf908f0e27c847c8056424ec2282aaddd
|
|
| MD5 |
f764b8d7b4d6ad490e2f49f760b5071e
|
|
| BLAKE2b-256 |
cb17cac388131144a47d4c5f05fa72358248af29e92191032fa6a658e6f629de
|
Provenance
The following attestation bundles were made for python_kicad-0.5.0-py3-none-any.whl:
Publisher:
publish.yml on esophagoose/python-kicad
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_kicad-0.5.0-py3-none-any.whl -
Subject digest:
7c420e4a470df8c1a60b7ec76d58430bf908f0e27c847c8056424ec2282aaddd - Sigstore transparency entry: 2305051783
- Sigstore integration time:
-
Permalink:
esophagoose/python-kicad@471b1a097a6b23de8fe9983ce5739654c0774ae3 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/esophagoose
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@471b1a097a6b23de8fe9983ce5739654c0774ae3 -
Trigger Event:
release
-
Statement type: