Configuration Strategy and Parameters
Hierarchy
zugbruecke retrieves configuration parameters from a number of places. It follows a hierarchy from highest to lowest priority, in the following order:
Environment variables
Keyword arguments provided by the user to the constructor of
zugbruecke.CtypesSessionConfiguration files
Default values
Warning
Environment variables are overwriting literally everything, including parameters passed directly into the zugbruecke session constructor!
Via Environment Variables
All configurable parameters of zugbruecke can directly be overridden with environment variables. Values from environment variables will always take precedence. Environment variables are named using a combination of the ZUGBRUECKE_ prefix and the name of the parameter in question converted to upper case. The pythonversion could for instance be configured as follows: ZUGBRUECKE_PYTHONVERSION=3.7.9
Via Files
zugbruecke uses JSON configuration files. They are expected in the following locations, from highest to lowest priority:
file specified in the
ZUGBRUECKEenvironment variable:{os.environ.get("ZUGBRUECKE")}directory specified in the
ZUGBRUECKEenvironment variable:{os.environ.get("ZUGBRUECKE")}/.zugbruecke.jsoncurrent working directory:
{os.getcwd()}/.zugbruecke.jsonuser profile folder:
{os.path.expanduser("~")}/.zugbruecke.jsonetcfolder:/etc/zugbruecke.jsonetcfolder (deprecated):/etc/.zugbruecke.jsonetcfolder:/etc/zugbruecke
A configuration file may only deal with a subset of configuration parameters. For instance, a configuration file could only be used to specify a version of Windows Python:
{"pythonversion": "3.7.9"}
Parameters
The following parameters can be configured:
name |
type |
description |
default |
|---|---|---|---|
id |
|
Unique, only configure it if necessary. |
Random hash |
stdout |
|
Show Windows Python |
|
stderr |
|
Show Windows Python |
|
log_write |
|
Write log to current working directory. |
|
log_level |
|
Verbosity, from |
|
arch |
|
Windows Python architecture, |
|
pythonversion |
|
Version / build of Windows Python, >= 3.7. |
|
timeout_start |
|
Wait seconds for Windows Python to show up. |
|
timeout_stop |
|
Wait seconds for Windows Python to terminate. |
|
copy_modules |
|
Copy |
|
Note
(Only) log_level and log_write can be changed at run-time. log_level follows Python’s logging module’s log levels, i.e. DEBUG == 10, INFO == 20, WARNING == 30, ERROR == 40 and CRITICAL == 50. Default is 0 for no logs as per NOTSET.
Note
pythonversion accepts wenv.PythonVersion objects, see relevant section of wenv documentation. Version 3.6 and earlier are not supported. You can only specify versions / builds for which an “Windows embeddable zip file” is available, see python.org for details. wenv.get_available_python_builds (see here) and wenv.get_latest_python_build (also see here) can be used to automatically query available builds.
Note
Next to the parameters listed above, zugbruecke also accepts every valid wenv configuration parameter and passes them on to wenv itself. See relevant chapter of wenv documentation for details.