Config API

Warning

This feature is experimental and subject to breaking changes. See the Conan stability section for more information.

class ConfigAPI(conan_api, helpers)

This API provides methods to manage the Conan configuration in the Conan home folder. It allows installing configurations from various sources, retrieving global configuration values, and listing available configurations. It also provides methods to clean the Conan home folder, resetting it to a clean state.

home()

return the current Conan home folder containing the configuration files like remotes, settings, profiles, and the packages cache. It is provided for debugging purposes. Recall that it is not allowed to write, modify or remove packages in the packages cache, and that to automate tasks that uses packages from the cache Conan provides mechanisms like deployers or custom commands.

install(path_or_url, verify_ssl, config_type=None, args=None, source_folder=None, target_folder=None)

install Conan configuration from a git repo, from a zip file in an http server or a local folder

install_pkg(ref, lockfile=None, force=False, remotes=None, profile=None) PkgReference

install configuration stored inside a Conan package The installation of configuration will reinitialize the full ConanAPI

get(name, default=None, check_type=None)

get the value of a global.conf item

show(pattern) dict

get the values of global.conf for those configurations that matches the pattern

static conf_list()

list all the available built-in configurations

clean()

reset the Conan home folder to a clean state, removing all the user custom configuration, custom files, and resetting modified files

property settings_yml

Get the contents of the settings.yml and user_settings.yml files, which define the possible values for settings.

Note that this is different from the settings present in a conanfile, which represent the actual values for a specific package, while this property represents the possible values for each setting.

Returns:

A read-only object representing the settings scheme, with a possible_values() method that returns a dictionary with the possible values for each setting, and a fields property that returns an ordered list with the fields of each setting. Note that it’s possible to access nested settings using attribute access, such as settings_yml.compiler.possible_values().