Fast part creation in KiCad and InvenTree
Project description
Ki-nTree
Fast part creation in KiCad and InvenTree
Demo Videos :fast_forward: Full Demo :fast_forward: KiCad Demo
Introduction
Ki-nTree (pronounced "Key Entry" or "Key 'n' Tree") aims to:
- automate part creation of KiCad library parts
- automate part creation of InvenTree parts
- synchronize parts data between KiCad and InvenTree
Ki-nTree works with:
- Digi-Key's enormous part database and free API
- the awesome open-source Digi-Key API python library built and maintained by @peeter123
- the awesome open-source InvenTree Inventory Management System built and maintained by @SchrodingersGat
- KiCad (of course!) and their open-source library utils
Ki-nTree was developped by @eeintech for SPARK Microsystems, who generously accepted to make it open-source!
Get Started
Requirements
- Ki-nTree is currently tested for Python 3.7 to 3.9 versions.
- Ki-nTree requires a Digi-Key production API instance. To create one, go to https://developer.digikey.com/. Create an account, an organization and add a production API to your organization. Save both Client ID and Secret keys.
Here is a video to help with the different steps
Installation
- (Optional) Create virtual environment and activate it
$ python3 -m venv env-kintree
$ source env-kintree/bin/activate
- Install using Pip
$ pip install -U kintree
- Run Ki-nTree
$ kintree
Usage Instructions
Settings
- With Ki-nTree GUI open, click on "Settings > Digi-Key" and fill in both Digi-Key API Client ID and Secret keys (optional: click on "Test" to get an API token)
- Click on "Settings > KiCad", browse to the location where KiCad symbol and footprint libraries are stored on your computer then click "Save"
- If you intend to use InvenTree with this tool, click on "Settings > InvenTree" and fill in your InvenTree server address and credentials then click "Save" (optional: click on "Test" to get an API token)
Get Digi-Key API token
Show steps (click to expand)
Enter your Digi-Key developper account credentials then login. The following page will appear (user@email.com
will show your email address):
Click on "Allow", another page will open.
Click on the "Advanced" button, then click on "Proceed to localhost (unsafe)" at the bottom of the page:
On Chrome, if the "Proceed to localhost (unsafe)" link does not appear, enable the following flag: chrome://flags/#allow-insecure-localhost
Lastly, a new page will open with a "You may now close this window." message, proceed to get the token.
Part Number Search
- In the main window, enter the part number and click "OK", it will start by fetching part data using the Digi-Key API
- In the case the Digi-Key API token is not found or expired, a browser window will pop-up. To get a new token: follow those steps
- Once the part data has been successfully fetched from Digi-Key, you will be prompted to add/confirm/edit the
Category
andSubcategory
to use for this part (Ki-nTree tries to match them automatically) - Then, you will be prompted with selecting the KiCad symbol library, template and footprint library to use for this part
- It will take some time to complete the part creation in InvenTree and/or KiCad, once it finishes you'll be notified of the result
- Finally, if the part was created or found in InvenTree, your browser will automatically open a new tab with the part information
Enjoy!
For any problem/bug you find, please report an issue.
Development
Requirements
You need python>=3.7
and poetry
.
You can install poetry by following the instructions on its official
website, by using pip install poetry
or by installing a package on your Linux distro.
Installation
- Clone this repository:
$ git clone https://github.com/sparkmicro/Ki-nTree
- Install the requirements into a
poetry
-managed virtual environment.
$ poetry install --no-dev
- Run Ki-nTree in the virtual environment.
$ poetry run python -m kintree.kintree_gui
or
$ poetry shell
$ python -m kintree.kintree_gui
Install it system-wide
- Make sure you followed the previous installation steps, then run:
$ poetry build
You will get a message similar to this:
Building kintree (0.3.10)
- Building sdist
- Built kintree-0.3.10.tar.gz
- Building wheel
- Built kintree-0.3.10-py3-none-any.whl
-
Exit the virtual environment (
Ctrl + D
on Linux; you can also close the terminal and reopen it in the same folder).Run
pip install dist/<wheel_file>.whl
with the file name from the previous step. For example:
pip install dist/kintree-0.3.10-py3-none-any.whl
- You can now start Ki-nTree by typing
kintree
in the terminal, provided that your python dist path is a part of your$PATH
.
Roadmap
Version 0.5
Global
- Allow user to decide the category code to use for IPN
- Add "Synchronize" menu option to pull InvenTree parts data into KiCad
- Fetch Digi-Key price breakdown and add it to Supplier Part (InvenTree)
- Add option to add as alternate (supplier part) to existing part
- Document configuration and backend
GUI
- Look to improve cosmetics
- Add icon to GUI and executable (not successful earlier, try with PySimpleGUIQt?)
- Create loading animation for API searches (asyncio)
Project details
Release history Release notifications | RSS feed
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
Hashes for kintree-0.4.0rc0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b72f276a07844bf517e2721c0e548f173715304673523190455996049bc30de |
|
MD5 | 9fd892cd1116fa159a91b38fc9246e1a |
|
BLAKE2b-256 | d62c3cf9aa42d1a1f42e624bdbc8b8f7992a86e5fb784c0e6051bc399fad890c |