4.6.2. pde.tools.config module

Handles configuration variables of the package

Config

class handling the package configuration

get_package_versions

tries to load certain python packages and returns their version

parse_version_str

helper function converting a version string into a list of integers

check_package_version

checks whether a package has a sufficient version

environment

obtain information about the compute environment

class Config(items: dict = None, mode: str = 'update')[source]

Bases: collections.UserDict

class handling the package configuration

Parameters
  • items (dict, optional) – Configuration values that should be added or overwritten to initialize the configuration.

  • mode (str) –

    Defines the mode in which the configuration is used. Possible values are

    • insert: any new configuration key can be inserted

    • update: only the values of pre-existing items can be updated

    • locked: no values can be changed

    Note that the items specified by items will always be inserted, independent of the mode.

to_dict() dict[source]

convert the configuration to a simple dictionary

Returns

A representation of the configuration in a normal dict.

Return type

dict

check_package_version(package_name: str, min_version: str)[source]

checks whether a package has a sufficient version

environment() dict[source]

obtain information about the compute environment

Returns

information about the python installation and packages

Return type

dict

get_package_versions(packages: List[str], *, na_str='not available') Dict[str, str][source]

tries to load certain python packages and returns their version

Parameters
  • packages (list) – The names of all packages

  • na_str (str) – Text to return if package is not available

Returns

Dictionary with version for each package name

Return type

dict

parse_version_str(ver_str: str) List[int][source]

helper function converting a version string into a list of integers