Configuration¶
Data:
|
str(object=’‘) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str |
|
str(object=’‘) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str |
Classes:
|
Configuration settings for the descarteslabs client. |
Functions:
|
Retrieve the current |
|
Configure the descarteslabs client. |
-
class
Settings
(**kwargs)[source]¶ Configuration settings for the descarteslabs client.
Based on the
dynaconf
package. This settings class supports configuration from named “environments” in asettings.toml
file as well as environment variables with names that are prefixed withDESCARTESLABS_
(or whatever was specified in the envvar_prefix).For the full capabilities of
dynaconf
please consult https://www.dynaconf.com/.Note that normally
Settings
functions entirely automatically within the client. However, it is possible to perform custom initialization programmatically. In order to do this, the beginning of the client program must execute code like this:` from descarteslabs.config import Settings Settings.select_env(...) `
before importing or otherwise accessing anything else within the descarteslabs package.handle initialization for the customization cases
- Parameters
kwargs – values that overrides default_settings
Methods:
get_settings
()Retrieve the current
Settings
for the client.select_env
([env, settings_file, …])Configure the descarteslabs client.
-
classmethod
select_env
(env=None, settings_file=None, envvar_prefix='DESCARTESLABS', auth=None)[source]¶ Configure the descarteslabs client.
- Parameters
env (str, optional) – Name of the environment to configure. Must appear in
descarteslabs/config/settings.toml
If not supplied will be determined from the DESCARTESLABS_ENV environment variable (or whatever was specified in the `envvar_prefix`_ENV), if set, otherwise from the user’s authenticated permissions.settings_file (str, optional) – If supplied, will be consulted for additional configuration overrides. These are applied over those in the
descarteslabs/config/settings.toml
file, but are themselves overwritten by any environment variable settings matching the envvar_prefix.envvar_prefix (str, optional) – Prefix for environment variable names to consult for configuration overrides. Environment variables with a leading prefix of
"<envvar_prefix>_"
will override the settings in the resulting configuration after the settings file(s) have been consulted.auth (Auth, optional) – If env is not supplied, then consult the user’s authenticated permissions using this
Auth
instance. If not supplied, then a defaultAuth
instance is constructed.
- Returns
Returns a
Settings
object, essentially a glorified dict-like objectcontaining the configured settings for the client.
-
get_settings
()¶ Retrieve the current
Settings
for the client.
-
select_env
(env=None, settings_file=None, envvar_prefix='DESCARTESLABS', auth=None)¶ Configure the descarteslabs client.
- Parameters
env (str, optional) – Name of the environment to configure. Must appear in
descarteslabs/config/settings.toml
If not supplied will be determined from the DESCARTESLABS_ENV environment variable (or whatever was specified in the `envvar_prefix`_ENV), if set, otherwise from the user’s authenticated permissions.settings_file (str, optional) – If supplied, will be consulted for additional configuration overrides. These are applied over those in the
descarteslabs/config/settings.toml
file, but are themselves overwritten by any environment variable settings matching the envvar_prefix.envvar_prefix (str, optional) – Prefix for environment variable names to consult for configuration overrides. Environment variables with a leading prefix of
"<envvar_prefix>_"
will override the settings in the resulting configuration after the settings file(s) have been consulted.auth (Auth, optional) – If env is not supplied, then consult the user’s authenticated permissions using this
Auth
instance. If not supplied, then a defaultAuth
instance is constructed.
- Returns
Returns a
Settings
object, essentially a glorified dict-like objectcontaining the configured settings for the client.
-
AWS_ENVIRONMENT
= 'aws-production'¶ Standard AWS environment
-
GCP_ENVIRONMENT
= 'gcp-production'¶ Standard GCP environment