How to import nightly pcbnew module in python?

Under linux one can have Kicad V5 and Kicad-nighly both installed. As KiCad uses system python, by default when you import pcbnew it imports 5.1.x version. How does one import nightly pcbnew module?

I am checking pcbnew module version with pcbnew.GetBuildVersion()

And if one can elaborate even further. Under Windows, when developing standalone pcbnew code I could do that using pyCharm or VSCode and point them to use KiCad or KiCad-nightly interpreter. This way it was easy for me to check how code works both in 5.1.x and nightly just by switching interpreter. And as interpreter was used only and only for KiCad I alos did not have to worry I’d put it unsuable state. How does one achieve this under linux?

My specifics:
Kubuntu 20.04
Kicad 5.1.8 and Kicad-nightly installed via official ppa repositories

Here is what stable package contains (filtered to dist-packages):

$ dpkg --contents /var/cache/apt/archives/kicad_5.1.8-202011242336+db9833491~88~ubuntu18.04.1_amd64.deb | grep dist
drwxr-xr-x root/root         0 2020-11-24 15:36 ./usr/lib/python3/dist-packages/
-rw-r--r-- root/root  22284952 2020-11-24 15:36 ./usr/lib/python3/dist-packages/_pcbnew.so
-rw-r--r-- root/root    787055 2020-11-24 15:36 ./usr/lib/python3/dist-packages/pcbnew.py

Same with nightly

$ dpkg --contents /var/cache/apt/archives/kicad-nightly_202011261018+09587ef4f~106~ubuntu18.04.1_amd64.deb | grep dist
drwxr-xr-x root/root         0 2020-11-26 02:18 ./usr/lib/kicad-nightly/lib/python3/dist-packages/
-rw-r--r-- root/root  30797728 2020-11-26 02:18 ./usr/lib/kicad-nightly/lib/python3/dist-packages/_pcbnew.so
-rw-r--r-- root/root    834627 2020-11-26 02:18 ./usr/lib/kicad-nightly/lib/python3/dist-packages/pcbnew.py

Looks like you will have to manually add /usr/lib/kicad-nightly/lib/python3/dist-packages to PYTHON_PATH and LD_LIBRARY_PATH to load nightly pcbnew python module.

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.