Today I worked on the makeDigikeyBOM.py tool. I like evolving “quicky” tools I wrote. In this case, it is a tool that gets component information from the (Kicad) eeSchema file, scrapes the Digikey site to get pricing information, and then creates a CSV with BoM information. I posted about this tool in several posts including this one. The challenge I have is I’m not fluent in Eclipse (the IDE I use), Python, or the innards of XML. This means my progress is M-U-C-H slower than if I had a clue. On the positive note, each time I come back to Eclipse/Python/innards of XML it takes me less time to get up to speed than it did the previous time.
I worked on cleaning up the python code – adding robustness and a new feature. The new feature supports a component that is in eeSchema to be ignored when creating the Bom. If the PN field equals X or x, the python script will remove that component (in Beautiful Soup speak – extract) from the outputted BoM (GitHub location).
I have a bit more to do with clean up. When I ran the script on the Sensor Puck eeSchema (see Kicad and MakeDigikeyBoM files for the Sensor Puck at this GitHub location), most of the price fields weren’t filled in:
I updated the makeDigikeyBOM (GitHub location) project to reflect the changes made for this post.
I like Eclipse for this project. Eclipse has a great debugger, manages files well, and has great Python support through PyDev. At this point, I run makeDigikeyBOM.py ONLY within Eclipse.
I’m not surprised that upgrading Eclipse was more complex than hitting some “START” button. I installed Eclipse when I was coding for the nRF51 SDK. The first thing I’ll do is update to the neon version. The steps I took to upgrade include:
- Install the latest version of Eclipse from here. While installing, I got the dialog box:
I’ve been ignoring updating the Java VM on my Mac. I go to Oracle’s page for downloading the JVM and install the JRE for OSX. Ignoring the warnings:
Checking the Java icon within System Preferences:
I’m told I have the most current version of Java installed. Yet I still got the same message when installing Eclipse. What gives? Turns out Eclipse requires the JDK (would be nice if the Eclipse install let us know!)…So I went back to Oracle’s Java downloads and installed the OS X version of the Java Development Kit.
The Eclipse Installer opens open with a cacophony of choices:
There isn’t one for Python so I installed the C/C++ option.
- Put the folder’s path of the workspace where my code for the MakeDigikeyBoM is kept.
This brings up the warning dialog box about upgrading the files to work with neon:
Which true to my character, I ignore.
Ooh…awesome..the spiffy Neon update of Eclipse opens…but…
I go into Help->Install Software menu and install PyDev. I choose not to install Mylyn for now.
And FINALLY! Oh…about an hour and a half later…I’m in the latest, greatest Eclipse IDE customized with PyDev…VROOM, VROOM!
Updating The Code
I haven’t looked at the makeDigikeyBOM.py tool since I wrote posts about it (including this one). On top of that, I’m not that fluent with Python – or the other skill I need – the innards of XML. There is a sense of thrill though to be able to evolve and just believe I’ll make progress. And I did. The code is a bit more robust. Also, I added the ability to ignore a component by setting the PN value to ‘X’ or ‘x’. The MakeDigikeyBOM GitHub project location is here. As I noted at the start of this post, there is still work to do. That will wait for another day.