easybuild.framework.easyconfig.types module

Support for checking types of easyconfig parameter values.

author:Caroline De Brouwer (Ghent University)
author:Kenneth Hoste (Ghent University)

Helper function, convert dict value to hashable equivalent via tuples.

easybuild.framework.easyconfig.types.check_element_types(elems, allowed_types)

Check whether types of elements of specified (iterable) value are as expected.

  • elems – iterable value (list or dict) of elements
  • allowed_types – allowed types per element; either a simple list, or a dict of allowed_types by element name
easybuild.framework.easyconfig.types.check_key_types(val, allowed_types)

Check whether type of keys for specific dict value are as expected.

easybuild.framework.easyconfig.types.check_known_keys(val, allowed_keys)

Check whether all keys for specified dict value are known keys.

easybuild.framework.easyconfig.types.check_required_keys(val, required_keys)

Check whether all required keys are present in the specified dict value.

easybuild.framework.easyconfig.types.check_type_of_param_value(key, val, auto_convert=False)

Check value type of specified easyconfig parameter.

  • key – name of easyconfig parameter
  • val – easyconfig parameter value, of which type should be checked
  • auto_convert – try to automatically convert to expected value type if required
easybuild.framework.easyconfig.types.convert_value_type(val, typ)

Try to convert type of provided value to specific type.

  • val – value to convert type of
  • typ – target type

Ensures that the provided license file/server specifications are of correct type and converts them to a list. The input can either be None, a string, or a list/tuple of strings.

Parameters:specs – License file/server specifications as provided via license_file easyconfig parameter
easybuild.framework.easyconfig.types.is_value_of_type(value, expected_type)

Check whether specified value matches a particular very specific (non-trivial) type, which is specified by means of a 2-tuple: (parent type, tuple with additional type requirements).

  • value – value to check the type of
  • expected_type – type of value to check against

Ensure correct element types for list of checksums: convert list elements to tuples.


Convert a list of dependencies obtained from parsing a .yeb easyconfig to a list of dependencies in the correct format


Convert a dependency specification to a dependency dict with name/version/versionsuffix/toolchain keys.

{‘foo’: ‘1.2.3’, ‘toolchain’: ‘GCC, 4.8.2’} to {‘name’: ‘foo’, ‘version’: ‘1.2.3’, ‘toolchain’: {‘name’: ‘GCC’, ‘version’: ‘4.8.2’}}
{‘name’: ‘fftw/’, ‘external_module’: True} to {‘name’: ‘fftw/’, ‘external_module’: True, ‘version’: None}

Convert a ‘list of lists and strings’ to a ‘list of tuples and strings’

[‘foo’, [‘bar’, ‘baz’]] to [‘foo’, (‘bar’, ‘baz’)]

No longer supported, replaced by to_toolchain_dict.


Convert a sanity_check_paths dict as received by yaml (a dict with list values that contain either lists or strings)

{‘files’: [‘file1’, [‘file2a’, ‘file2b]], ‘dirs’: [‘foo/bar’]} to {‘files’: [‘file1’, (‘file2a’, ‘file2b’)], ‘dirs’: [‘foo/bar’]}

Convert a comma-separated string or 2/3-element list of strings to a dictionary with name/version keys, and optionally a hidden key. If the specified value is a dict already, the keys are checked to be only name/version/hidden.

For example: “intel, 2015a” => {‘name’: ‘intel’, ‘version’: ‘2015a’}
“foss, 2016a, True” => {‘name’: ‘foss’, ‘version’: ‘2016a’, ‘hidden’: True}
Parameters:spec – a comma-separated string with two or three values, or a 2/3-element list of strings, or a dict