Ki-nTree - Fast part creation for KiCad and InvenTree

Maintenance release: 0.4.8 :slight_smile:

Enjoy!

2 Likes

Awesome work. Thank you for sharing.

1 Like

Happy new year KiCad community!

I have just updated Ki-nTree to 0.5.0 which now functions exclusively with KiCad version 6 :smiley:
So if you just switched to V6, head up to your terminal to update Ki-nTree (pip install -U kintree) and keep on using it the same way, just make sure all your libraries were updated with the newer V6 format (.kicad_sym).

And if you are still on V5 then you can keep on using the current version of Ki-nTree (0.4.8 or older).

Enjoy!

1 Like

0.5.2 on the way with some bug fixes! (mostly to keep this topic open :slight_smile: )

1 Like

I made the opening post a WIKI. You should be able to modify it indefinitely. I manually set the timer to Jan. 1. No option for me to delete it. I think any mod could reopen it should it close on you.

That’s very nice of you! I wanted to keep it regularly updated anyway but this time I was a little behind… One less thing to stress about :sweat_smile:

0.5.2 is released! :partying_face:

2 Likes

And 2 more maintenance releases, now 0.5.4: Release 0.5.4 · sparkmicro/Ki-nTree · GitHub

2 Likes

0.6.0 is out! :partying_face:

And a BIG shootout to the InvenTree team and their new website!
There is huge effort and community behind it, it is a very stable inventory platform with plenty of great features, so don’t forget to check them out, totally worth it!

3 Likes

Multiple maintenance releases and a new LCSC URL later, 0.6.3 is out! :wink:

I just tried Ki-nTree and I just want to share my user experience. I would basically like to use it to import parts into Inventree from Mouser and others…

First the installation. As I am using Windows, I do expect the process to be a little more complicated but to have to install Visual Studio C++ just because of some python crypto library? That seems a little too much.

The next part is that the post-installation configuration process should be described a little better on the github page. The description how to get Mouser API key is great and so I thought that there is no need to configure it more.
After I managed to get it running I entered the Mouser part id, it did find it and it showed me a dialog with some strange part categories (definitely not from my inventree). So I tried to enter the category name directly but then the GUI froze with some warning in the command line (unable to find part category or something like that).
On a second try I managed to enter the right category somehow (I do not know what I did differently) and it created the part. And also a Mouser and Microchip companies just because mine in Inventree are named a little differently (Mouser vs Mouser Electronics or something like that). And it did not download datasheet and it did create some IPN.

Then I found out that there are some more configuration files but with a little documentation. And so I am not sure if what I need could be achieved with those files. At first glance it seems that I can not use them to map company names.

So the result of the test is that the tool looks fine but for me to be useful (meaning it saves time) I would need cca this:

  • Import parts from Farnell
  • Clearer way how to select category from my Inventree instance
  • The way to specify the companies i.e. combobox or at least configfile mapping
  • Download the datasheet as part attachment
  • Ability to set IPN creation template or to enter it manually or at least to not create it so I can specify it later

Hello @Kedarius

Very nice feedback, thanks for taking the time to write it!

That cryptography library you are referring to is necessary to run the pyopenssl library used by the digikey-api package allowing to pull data from Digi-Key. In your case it might feel unnecessary but Digi-Key is one of the biggest distributors in North America and used by many companies and people. Sorry for causing you trouble but happy to hear that you got Ki-nTree running fine on your machine :smiley:

Let’s find out how can we improve it :wink:

Have you scrolled past this section maybe? GitHub - sparkmicro/Ki-nTree: Fast part creation in KiCad and InvenTree
Or wasn’t it clear to you?

Would love to look at this issue if it’s still happening after category setup, would you mind opening one here and post the log output of Ki-nTree: Issues · sparkmicro/Ki-nTree · GitHub

Right that’s something I tried to improve in version 0.6.0 but it still not immune to creating new companies when it thinks they don’t exist yet in the database… It might require a download of the database and manual pick from user, in my experience it takes a few more manual step in InvenTree to fix this and happens only in very rare occasions, especially after the 0.6.0 version release.

Those are two intended behaviors at the moment.

Granted those are not well documented, if you have any question regarding those, don’t hesitate to open an issue, I’ll be happy to get back to you :smiley:

See my comment above, I didn’t really want to introduce a new lookup table just for this.

Concerning your feature proposals:

I never looked into their API, seems straight forward! I will add it soon :partying_face:

It’s a work in progress: Support hierarchical categories · Issue #87 · sparkmicro/Ki-nTree · GitHub
May take a bit more time to implement.

Will think about this one a bit more, thanks for bringing it up :wink:

I’m not sure what do you intend to do with the downloaded datasheet: where do you want it to be stored? Why would you need the datasheet locally?
My colleagues and I store all the datasheet links in InvenTree under “Suppliers” tab (Ki-nTree does that) and that’s how we use them.

Fair enough, I will look into this too.

Thanks again!

Thanks for your reply.

I understand that the openssl binding library is important and the reasoning behind why it is needed, but I’ve never had to install 6GB+ of development tool to use openssl. It took me cca an hour to download and install just the minimal set of features :slight_smile:

You got me on this :slight_smile: I glanced trough this section and I did not do it as it seemed to me as it is related to setting up categories in inventree - I mean the direction Ki-nTree → Inventree. And I am already using inventree with my own categories, so I did not want to make mess in my inventree.

What I am missing is some sort of top-level overview, what are the files used for and what can/must be done with them.

Other way could be to put the new part into one predefined category and I will move it later from Inventree.

I am using inventree also as a “local” storage for all the related files - datasheets, ECAD models, drivers, utilities,… So on the attachment tab I have a collection of all related files. I.e. datasheet from the manufacturer, from the vendor, snapeda ECAD files, Mouser ECAD files, etc… And why locally? As some of the files are from various strange sites, I prefer to store them instead of just linking them. For example I have some drivers related to an ancient HW that we still need to use and it is from a company that does not exist anymore. Or I am using a cheap USB microscope where I downloaded the docs from some Chinese “dropbox-like” site…

1 Like

Unfortunately I don’t quite know what to do with this info… if you have a well documented workaround I can add it to the README.

Done, checkout: GitHub - sparkmicro/Ki-nTree: Fast part creation in KiCad and InvenTree

I have added it to the TODO list for the moment. I may revamp the download to local files part of the software so it can be redirect to anywhere on your filesystem.

In other news I added Element14 API integration to Ki-nTree, check it out and let me know if you have any issue!

Oh and you can now disable IPN auto-creation in the configuration files (see release notes).

The cryptography package is available as a binary wheel on Windows – if you run pip install cryptography nothing needs to be compiled. @Kedarius what version of Windows are you using?

Wow, looks like very promising, I will try it tommorow and report back.

1 Like

I am using Windows 10 but my python knowledge is limited to a simple programs. I do not know what pip does in the background. I have no idea what binary wheel means (although I guess that it is some sort of prebuilt package) and I have no idea what kintree pip needs or uses…
But I did
pip install -U kintree
and it said something like this:

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual
C++ Build Tools": http.....

(I am not sure that this is the exactly same error message as I already installed VS but it looks the same). And after some googling and stackoverflowing I’ve found that people recommend installing Visual Studio. And also a lengthy discussions that you should compile your own crypto libraries because it is more secure…

So I’ve tried to install the minimal installation of the Visual Studio and the error message changed to some missing header files. Which turned out that I needed Windows 10/11 SDK.

And after installing that pip was happy and kintree started…

I have a programming background, just installed VS from the link which took me to a general page of Microsoft Tools, but am lacking the time to look at this. Here is the error message I get under Windows 11, which I hope is helpful, until I have time to find my own way around this install issue.

I should mention I just updated KiCad to 6.0.10 prior to this install:
Application: KiCad PCB Editor (64-bit)

Version: (6.0.10), release build

Libraries:
wxWidgets 3.2.1
libcurl/7.86.0-DEV Schannel zlib/1.2.13

Platform: Windows 11 (build 22621), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
Date: Dec 19 2022 21:23:04
wxWidgets: 3.2.1 (wchar_t,wx containers)
Boost: 1.80.0
OCC: 7.6.2
Curl: 7.86.0-DEV
ngspice: 38
Compiler: Visual C++ 1929 without C++ ABI

Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON

What is the command you ran to get this error? It is not shown in your prompt.

Also a bit confused on what are you trying to do…? Ki-nTree is separate from KiCad so it is unrelated to your issue with the python-Levenshtein library.

First I would like to thank you for such a quick update. Almost everything I need is working now and it basically changed the tool from “unusable for me” to “usable with minor issues” :slight_smile:

As I said in other post, although I have a multi-decade programmer background, I do not know the python ecosystem (mainly PIP) inner workings. But I have installed a quite a few pip packages (i.e. fpga development chain) and I never had to install Visual C. However that solved it for me and if it was only mine problem then it is fine…

Great, this is exactly what I wanted. The only part that I am still confused about are the categories :slight_smile: I feel like just something is not clicking in the right place in my brain and/or there is something that I am completely missing.
I have a structure in my inventree, for example:

So all the components are in a component main category and there are subcategories like Capacitor, Button, Resistor,…
So I edited the categories.yaml to contain a few of them to test it:

CATEGORIES:
  Component:
  - Resistor
  - Logic
  - Capacitor
  - Button
CODES: null

But when I try to add a part from farnell, Ki-nTree still shows some categories from somewhere (maybe from digikey_categories.yaml ?):

image

However if I select Component and enter a custom name Resistor, then it works :slight_smile: So there is a way however it would be much better if I would be able to select the category from the combobox…

This works fine, I only found a small glitch that the Ki-nTree crashes if there is no store selected. But it crashes even as I try to open the config dialog, so I had to manually specify the store in the config file…

Traceback (most recent call last):
...
File "C:\Users\root\AppData\Roaming\Python\Python38\site-packages\kintree\kintree_gui.py", line 226, in element14_api_settings_window
sg.Text(f'URL: {element14_api.STORES[supplier][default_store]}', key='store_url'),                                                                                                                             KeyError: None                                                                 

Great it works fine…

And last thing is the Manufacturer naming. I found out that you can setup supplier name in its config and that solved a lot of work for me. This should be mentioned in the README as it is a very useful option. And one last thing (except for being able to select the company from a combobox), would it be possible to match the company in inventree case insensitive?
image

Once more thank you for a great work.

1 Like