Configuration

Uranium provides infrastructure to pass in configuration variables.

Configuration variables are useful in a variety of situations, including:

  • choose whether to run in development mode
  • select the environment to run against
# config.set_defaults can be used to set some default values.
build.config.set_defaults({
    "development": "false"
})

def test(build):
    # one can set development mode by adding a -c development=true before the task:
    # ./uranium -c development=true test
    if build.config["development"].startswith("t"):
        build.packages.install(".", develop=True)

Full API Reference

class uranium.config.Config[source]

Config is a dictionary representing the configuration values passed into the Uranium build.

config acts as a dictionary, and should be accessed as such.

The current configuration is serialized to and from yaml, during the start and stop of uranium, respectively. As such, only primitive types such as arrays, dictionaries, strings, float, int, bool are supported.

The command line of uranium supports a dotted notation to modify nested values of the config object. To ensure that there is no ambiguity, it’s best to keep all key names without any periods.

set_defaults(default_dict)[source]

as a convenience for setting multiple defaults, set_defaults will set keys that are not yet set to the values from default_dict.

build.config.set_defaults({
    "environment": "develop"
})