Skip to main content

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_pcb board files as Pcb
  • .kicad_sch schematic files as Schematic
  • 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

python_kicad-0.5.0.tar.gz (133.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_kicad-0.5.0-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

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

Hashes for python_kicad-0.5.0.tar.gz
Algorithm Hash digest
SHA256 39a2651898cbdf34c5e8125a3509c5b5657396b17e34dbd8d620157009a1f8aa
MD5 27c51e7123b4f29cb727a413b71015f4
BLAKE2b-256 e2c79c24e8d332cfb2acbf14b94a2abdb74c8b6a925ace33b0b0d730afa739a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_kicad-0.5.0.tar.gz:

Publisher: publish.yml on esophagoose/python-kicad

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for python_kicad-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c420e4a470df8c1a60b7ec76d58430bf908f0e27c847c8056424ec2282aaddd
MD5 f764b8d7b4d6ad490e2f49f760b5071e
BLAKE2b-256 cb17cac388131144a47d4c5f05fa72358248af29e92191032fa6a658e6f629de

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_kicad-0.5.0-py3-none-any.whl:

Publisher: publish.yml on esophagoose/python-kicad

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.6.1

2 files

0.6.0

2 files

This release

0.5.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page