Welcome to kinparse’s documentation!¶
Contents:
kinparse¶
This is a parser for KiCad V5 through V8 schematic netlist files that are output by EESCHEMA. Just pass a file containing a netlist to the parse_netlist() function and it will deliver a pyparsing object containing all the netlist’s information.
Free software: MIT license
Documentation: http://devbisme.github.io/kinparse
Installation¶
This is a Python package, so you’ll need to have Python installed to use it. If you’re using linux, you probably already have Python. If you’re on Windows, you can download a Python installer from Anaconda , Active State , or even WinPython .
Once you have Python, you can install this package by opening a terminal window and typing the command:
$ easy_install kinparse
Or:
$ pip install kinparse
Usage¶
To use kinparse in a project:
from kinparse import parse_netlist
There is a single function that will parse a KiCad EESCHEMA netlist file, a file object, or a text string and return a pyparsing object
nlst = parse_netlist('my_schematic.net')
Then you can query the parsing object as shown below to get information about the netlist.
- Global netlist information:
nlst.version
: Netlist format version.
- Global design information:
nlst.source
: File name for the top-level schematic that generated this netlist.nlst.date
: Date the schematic was created.nlst.tool
: Tool used to create the schematic.
- Schematic sheet information:
nlst.sheets
: List of sheets for the schematic.len(nlst.sheets)
: Number of sheets in the list.nlst.sheets[0].num
: Number of the first schematic sheet.nlst.sheets[0].name
: Name of the first schematic sheet.nlst.sheets[0].tstamps
: Time stamp of the first schematic sheet.nlst.sheets[0].title
: Title of the first schematic sheet.nlst.sheets[0].company
: Name of company.nlst.sheets[0].rev
: Revision number of the first schematic sheet.nlst.sheets[0].date
: Date of the first schematic sheet.nlst.sheets[0].source
: Source file for the first schematic sheet.nlst.sheets[0].comments
: List of comments for the first schematic sheet.len(nlst.sheets[0].comments)
: Number of comments for the first schematic sheet.nlst.sheets[0].comments[0].num
: Number of the first comment.nlst.sheets[0].comments[0].text
: Text of the first comment.
- Library information:
nlst.libraries
: List of libraries used in the netlist.len(nlst.libraries)
: Number of libraries in the list.nlst.libraries[0].name
: Name of the first library.nlst.libraries[0].uri
: File location of the first library.
- Library of components:
nlst.libparts
: List of part types used in the netlist.len(nlst.libparts)
: Number of part types in the list.nlst.libparts[0].lib
: Library containing the first part.nlst.libparts[0].name
: Part type name of the first part.nlst.libparts[0].desc
: Description of the first part.nlst.libparts[0].docs
: Document file name for the first part.nlst.libparts[0].fields
: List of fields for the first part.len(nlst.libparts[0].fields)
: Number of fields for the first part.nlst.libparts[0].fields[0].name
: Name of the first field of the first part.nlst.libparts[0].fields[0].value
: Value assigned to the first field of the first part.nlst.libparts[0].pins
: List of pins for the first part.len(nlst.libparts[0].pins)
: Number of pins on the first part.nlst.libparts[0].pins[0].num
: Pin number of the first pin of the first part.nlst.libparts[0].pins[0].name
: Pin name of the first pin of the first part.nlst.libparts[0].pins[0].type
: Electrical type of the first pin of the first part.nlst.libparts[0].footprints
: List of footprints for the first part.len(nlst.libparts[0].footprints)
: Number of footprints for the first part.nlst.libparts[0].footprints[0]
: First footprint for the first part.nlst.libparts[0].aliases
: List of aliases for the first part.len(nlst.libparts[0].aliases)
: List of aliases for the first part.nlst.libparts[0].aliases[0]
: First alias for the first part.
- parts:
nlst.parts
: List of part instances used in the netlist.len(nlst.parts)
: Number of parts used in the list.nlst.parts[0].ref
: Reference designator for the first part.nlst.parts[0].value
: Value of the first part.nlst.parts[0].tstamp
: Time stamp for the first part.nlst.parts[0].datasheet
: File location of datasheet for the first part.nlst.parts[0].lib
: Name of the library containing the first part.nlst.parts[0].name
: Part type name for the first part.nlst.parts[0].desc
: Description for the first part.nlst.parts[0].footprint
: PCB footprint for the first part.nlst.parts[0].sheetpath.names
: Sheet name on which the first part appears.nlst.parts[0].sheetpath.tstamps
: Time stamp for the sheet on which the first part appears.nlst.parts[0].fields
: List of fields for the first part.len(nlst.parts[0].fields)
: Number of fields for the first part.nlst.parts[0].fields[0].name
: Name of the first field of the first part.nlst.parts[0].fields[0].value
: Value assigned to the first field of the first part.
- Net connections:
nlst.nets
: List of nets connecting the component pins.len(nlst.nets)
: Number of nets in the list.nlst.nets[0].name
: Name of the first net.nlst.nets[0].code
: Code number for the first net.nlst.nets[0].pins
: List of pins attached to the first net.len(nlst.nets[0].pins)
: Number of pins attached to the first net.nlst.nets[0].pins[0].ref
: Part reference designator for first pin on the first net.nlst.nets[0].pins[0].num
: Pin number of referenced part for the first pin on the first net.
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/devbisme/kinparse/issues.
If you are reporting a bug, please include:
Your operating system name and version.
Any details about your local setup that might be helpful in troubleshooting.
Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “feature” is open to whoever wants to implement it.
Write Documentation¶
kinparse could always use more documentation, whether as part of the official kinparse docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/devbisme/kinparse/issues.
If you are proposing a feature:
Explain in detail how it would work.
Keep the scope as narrow as possible, to make it easier to implement.
Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up kinparse for local development.
Fork the kinparse repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/kinparse.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv kinparse $ cd kinparse/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass the tests, including testing other Python versions with tox:
$ tox
To get tox, just pip install it into your virtualenv.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
The pull request should include tests if you’ve added functionality.
If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
The pull request should work for all the Python versions in the tox.ini file.
Credits¶
Development Lead¶
Dave Vandenbout <devb@xess.com>
Other Contributors¶
History¶
1.2.2 (2024-09-22)¶
Updated to handle KiCad V8 netlist files.
1.2.1 (2023-10-12)¶
Ignore future module ImportError exception that aborts execution with Python 3.12.
1.2.0 (2022-11-7)¶
Updated to handle exclude_from_bom in KiCad V6 netlist files.
1.1.0 (2022-03-23)¶
Updated to handle both KiCad V5 and V6 netlist files.
1.0.0 (2021-09-17)¶
Decided this tool was mature enough that it could be called 1.0.0.
0.1.2 (2019-02-23)¶
Files are now opened with latin_1 encoding to allow special symbols used by KiCad.
0.1.1 (2019-01-28)¶
Fixed problem where sheetpath.names and sheetpath.tstamps were not retrievable.
0.1.0 (2019-01-24)¶
Restructured the parser to make it work with the current version of pyparsing.
0.0.5 (2018-12-30)¶
Restricted pyparsing package to version < 2.3.0 because that one started breaking things.
0.0.4 (2018-08-27)¶
KiCad V5 started putting description fields in component libsource.
0.0.3 (2018-02-14)¶
Non-numeric revision is now allowed in the netlist rev field.
0.0.2 (2017-12-21)¶
Fixed parse errors caused by fields with labels but no data like “(date)” .
0.0.1 (2017-07-12)¶
First release on PyPI.