config_settings¶
- drain_swamp.monkey.config_settings.log: logging.Logger¶
Module level logger
- class drain_swamp.monkey.config_settings.ConfigSettings(file_name=None)¶
There is no clear guidance on how build module should communicate
config settings
command line options to the build back end.This is the communication flow:
- build --> setuptools --> build front end --> build backend (within a subprocess) --> (plugin) manager --> build plugin
Requires a PEP, for all to agree, on how to pass these config settings to the build backend subprocess
In the meantime, this is the work around for communication with the build backend
create a environment variable, DS_CONFIG_SETTINGS, set value to path to a temp file
temp file is in
pyproject.toml
format/style.project.name
andproject.version
are required but not used. Contains a section, “config-settings”. That section, contains key/value pairs. Type are both str.Which key value pairs to pass in depends on what is required by build plugins. Current key pairs:
kind = "tag"
set-lock = "1"
Paths must be single quoted, not double quoted. Otherwise On Windows, TOML file considered invalid
- Variables:
SECTION_NAME (str) – .toml file tool section name
ENVIRON_KEY (str) – Environment variable which stores the path to the temporary .toml file containing command line options intended for the build plugins
FILE_NAME_DEFAULT (str) – config settings temporary file name, not path
file_name (str | None) – Actual config settings temporary file name. Overrides default
- property file_name¶
Get config settings file name. This is a temporary file.
- Returns:
config settings file name
- Return type:
- classmethod get_abs_path()¶
From os.environ get temporary absolute file path.
- Returns:
- Return type:
str | None
- classmethod get_section_dict(path_dir, toml_contents, file_name=None)¶
Set the config settings and returning the section mapping.
- Parameters:
path_dir¶ (pathlib.Path) – Will create a throw away file, so folder usually in /tmp or equivalent
In
pyproject.toml
style, so project.name and project.version are required, but not used. Has section,tool.config-settings
. With key/value pairs. Both key and value are str.Which key value pairs to pass in depends on what is required by build plugins. Current key pairs:
kind = "tag"
set-lock = "1"
file_name¶ (str | None) – Default “setuptools-build.toml”. File name of the temp .toml file
- Returns:
config settings dict. What normally would be supplied as
python -m build
config setting cli options- Return type:
- read()¶
Environment variable DS_CONFIG_SETTINGS contains an absolute path to a .toml file containing plugins’ key/value pairs
If
python -m build
config setting cli options would be passed thru, by setuptools, this function would be unnecessarysetuptools currently lacks this expected feature
- classmethod remove_abs_path()¶
Remove environment variable holding the config settings temp file path.
- classmethod set_abs_path(val)¶
Set absolute temporary file path to config settings .toml file.
- write(path_dir, toml_contents)¶
The temp file will contain key/value pairs used by the build plugins. setuptools does not currently pass config_settings, requires a PEP for all to agree on how to pass these config settings from build –> setuptools –> build front end –> build backend in a subprocess.
In the meantime, this is the work around for communication with the build backend
- Parameters:
path_dir¶ (pathlib.Path) – Will create a throw away file, so folder usually in /tmp or equivalent
In
pyproject.toml
style, so project.name and project.version are required, but not used. Has section,tool.config-settings
. With key/value pairs. Both key and value are str.Which key value pairs to pass in depends on what is required by build plugins. Current key pairs:
kind = "tag"
set-lock = "1"
file_name¶ (str | None) – Default “setuptools-build.toml”. File name of the temp .toml file