← Back to team overview

kicad-developers team mailing list archive

Re: Python 3 now required

 

I have a related qestion regarding "shebangs" in python code.  In a few files we have #!/usr/bin/env python3, which is great, because it fully specifies which interpreter to use.  For example tools/create_dark_theme.py has this.

In other files, the python version is not specified, and we just have !/usr/bin/env python.  This is ambiguous - you might get python2 or python3 depending on the OS.  For example, translation/plot_i18n_status.py has this.

Lastly, there are a number of python files that have no shebangs at all.  Fedora's RPM builder warns about this on 15 files, and disables the scripts by clearing the "executable" bit.  Here is an example:

*** WARNING: ./usr/share/kicad/scripting/plugins/zip_wizard.py is executable but has no shebang, removing executable bit

Now that python3 is the only allowed version, can all python files be modified to have the "#!/usr/bin/env python3" shebang, or would that negatively impact some target OS's?

	Steve


On 6/4/21 1:34 PM, Seth Hillbrand wrote:
Hi Folks-

KiCad now officially only supports Python 3.  Note that this comes a full year and 6 months after Python 2 was deprecated (https://pythonclock.org/ <https://pythonclock.org/>) and most, if not all, of our supporting packages have pledged to stop supporting Python 2 (https://python3statement.org/ <https://python3statement.org/>)

We are now making the same transition.

As part of this transition, we are also binding the Python interpreter more closely with KiCad.  This means that we have removed the following build settings and set them all to 'ON':

KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=ON
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
KICAD_SCRIPTING_ACTION_MENU=ON

For the moment, `KICAD_SCRIPTING_WXPYTHON` does remain an advanced build setting but we'll be moving that to the advanced_config file shortly as it does not control a build setting (only a run-time operation).

The current minimum Python version is 3.7 (due to a module test call we use) but we are looking at potentially supporting Python 3.6 if we can handle dynamic reloads.

A large thank you in this effort goes to Mark Roszko and Adam Wolf who wrangled the build requirements for Windows and Mac respectively.  The transition was non-trivial and largely invisible.  KiCad has come out better for the work that they contributed.  Thank you!

-Seth
--
KiCad Services Corporation Logo
Seth Hillbrand
*Lead Developer*
+1-530-302-5483‬
Long Beach, CA
www.kipro-pcb.com <https://www.kipro-pcb.com/> info@xxxxxxxxxxxxx <mailto:info@xxxxxxxxxxxxx>


_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp




Follow ups

References