gaeconf package

Submodules

gaeconf.cli module

Console script for gaeconf.

gaeconf.gaeconf module

class gaeconf.gaeconf.AppEngineBaseConfig(exposed_env_vars=None)[source]

Bases: object

This base class is implements a to_yaml() method which dumps a YAML file compatible with GAE.

  • Constructor receives an optional exposed_env_vars parameter to define the host environment variables which will be passed to the resulting GAE app.yaml file.
  • The attributes of the class will be exported to the final yaml.
  • An attribute starting with __ENV__ will be considered an environment variable and it will be included to env_variables in the yaml.
  • Some of the class attributes can be ignored by overriding get_ignore_attrs method.
clean_config(config: dict) → dict[source]

Config post-processing

Parameters:config (dict) – App engine configuration vars
Returns:dict
get_ignore_attrs(data: list) → list[source]

Exclude class attrbutes from the yaml export

Parameters:data (list) – List of class attributes
Returns:list
runtime = None
service = None
to_yaml() → str[source]

Dumps the current configuration as yaml

Returns:str
class gaeconf.gaeconf.AppEngineFlexibleConfig(exposed_env_vars=None)[source]

Bases: gaeconf.gaeconf.AppEngineBaseConfig

Defines a suitable configuration for Google App Engine flexible runtime.

Default configuration can be overriden with environment variables:

  • GAECONF_FLEXIBLE_RUNTIME: python
  • GAECONF_FLEXIBLE_RUNTIME_PYTHON_VERSION: 3.7
  • GAECONF_AUTOSCALING_MAX_INSTANCES: 2
  • GAECONF_AUTOSCALING_MIN_INSTANCES: 1
  • GAECONF_FLEXIBLE_NUM_CPU: 2
  • GAECONF_FLEXIBLE_MEMORY_GB: 3
  • GAECONF_FLEXIBLE_DISK_SIZE_GB: 20
automatic_scaling = {'max_num_instances': 2, 'min_num_instances': 1}
clean_config(config: dict) → dict[source]

Config post-processing

Parameters:config (dict) – App engine configuration vars
Returns:dict
env = 'flex'
get_ignore_attrs(data: list) → list[source]

Exclude class attrbutes from the yaml export

Parameters:data (list) – List of class attributes
Returns:list
instance_tag = None
resources = {'cpu': 2, 'disk_size_gb': 20, 'memory_gb': 3}
runtime = 'python'
runtime_config = {'python_version': '3.7'}
service = None
subnetwork_name = None
class gaeconf.gaeconf.AppEngineStandardConfig(exposed_env_vars=None)[source]

Bases: gaeconf.gaeconf.AppEngineBaseConfig

Defines a suitable configuration for Google App Engine standard runtime.

By default the runtime is python37 and the instance class is F4_HIGHMEM but these defaults can be overriden with the following environment variables:

  • GAECONF_STANDARD_RUNTIME
  • GAECONF_STANDARD_INSTANCE_CLASS
instance_class = 'F4_HIGHMEM'
runtime = 'python37'
gaeconf.gaeconf.load_yaml_classes(filename: str) → dict[source]

Parses a YAML file and builds Python classes defining the GAE services.

Parameters:filename (str) – path to a yaml configuration file
Returns:{<service-name>: <service-class>}

Module contents

Top-level package for Gaeconf.