Python Application Development Notes

As of 19 Jan 2020

These are specific notes for developing the upc application, which reads an svg file created by Inkscape containing paths describing a multi-sided polygonal figure.

I. Setting up the development environment

A. Install Python 3

1. Download it from https://www.python.org/ (not the Windows store)

2. Launch the executable (defaults are okay, but choose the option to modify the PATH variable).

B. Install needed libraries

1. svgpathtools (ref: https://github.com/mathandy/svgpathtools)

a. Prerequisites for latest release (13.3 at the time of this writing)

i. pip install numpy

ii. pip install svgwrite

b. pip install svgpathtools

II. Issues during development

A. Inkscape compatibility

1. The application was developed for an upcoming 1.0 version of Inkscape, which was in beta at the time of this writing. Unlike the previous versions, this one places the origin in the upper-left. The application doesn't support a lower-left origin.

2. The application doesn't handle grouped paths, so they need to be ungrouped in the input file first.

III. Packaging a windows 10 executable

A. Install cx_freeze (ref: https://anthony-tuininga.github.io/cx_Freeze/)

1. python -m pip install cx_Freeze --upgrade

B. Create icon from 256 x 256 png

1. Use your favorite png to ico online converter

C. Execute packaging script

1. cxfreeze upc.py --target-dir upc --icon upc.ico

a. upc folder created with upc.exe executable file

IV. Issues during packaging

A. Latest version of cx_freeze (6.1, at the time of this writing) had a problem with the cxfreeze script and required a patch (see https://github.com/anthony-tuininga/cx_Freeze/commit/4a24f1cdefe05c84c215c9f1b3694697e6ccab60 for fix that will be included in version 6.2)

IV. Command Line Execution

A. As a python program (python file in current directory)

1. python upc.py -h

B. As a windows executable (upc folder in current directory)

1.upc/upc.exe -h

C. With a shortcut created for upc.exe (shortcut in current directory)

1. upc.lnk -h