fastiot.cli.model.project module

data model for project configuration

class fastiot.cli.model.project.CompileSettingsEnum(value)[source]

Different settings to define how to compile the library.

only_compiled = 'only_compiled'
only_source = 'only_source'
all_variants = 'all_variants'
pydantic model fastiot.cli.model.project.ProjectContext[source]

This class holds all variables reade from configure.py in the project root directory. Use this as for hints to do custom adjustments to your configure.py. We try to set sensible defaults so that changes should only be needed in rare cases.

Validators:
field project_namespace: str = ''

Namespace of the project used e.g. on the docker registry. This should be your project name.

field project_root_dir: str = '.'

Project root directory. As the cli is intended to be run from the project root directory the default using the current working directory should be fine.

Validated by:
field library_package: str = ''

Define a python package within your src directory containing library methods to be shared between your services. If not specified no library will be built.

field library_setup_py_dir: str = '.'

Path where to find the setup.py to build your library for exporting. The default with the current working directory should be fine, if you put your setup.py at the toplevel of your project (common).

Validated by:
field services: List[Service] = []

Define a list of fastiot.cli.model.service.ServiceConfig. If not defined the cli will look for python packages containing a manifest.yaml and a run.py with the pattern src/*/*/manifest.yaml and call this package a FastIoT Service. Be aware of this when creating a manifest.yaml somewhere, e.g. in your tests.

Hint: If you want to override this configuration you may use fastiot.cli.helper_fn.find_services() to create a list of services to build by package.

field deployments: Dict[str, DeploymentConfig] = {}

Manually define a list of deployments as fastiot.cli.model.DeploymentConfig to actually build using the command fastiot.cli.commands.config.config(). If left empty all deployment configurations in the path deployments will be used.

Hint: You may use fastiot.cli.helper_fn.find_deployments() to create a list of deployments according to your special needs.

field integration_test_deployment: str = ''

If you need any services to be started for automatic testing your project you may define the name of this special deployment found within the fastiot.cli.model.project.ProjectContext.deployments.

field test_package: str = ''

Name of the package in the src directory where automated tests are stored. Common is to use something like myproject_tests.

field npm_test_dir: str = ''
field build_dir: str = 'build'

The dir where generated build files (Dockerfiles, Docker-compose files, etc.) are stored. This dir is relative to your project_root_dir.

field extensions: List[str] = []

Use to add own extensions to the FastIoT CLI. The CLI will try to import your custom infrastructure services as described in Adding custom infrastructure services to your project.

Make sure importing this service will import further commands and fastiot.cli.model.infrastructure_service.InfrastructureService. Most of the times this is done filling the __init__.py correspondingly.

field lib_compilation_mode: CompileSettingsEnum = CompileSettingsEnum.only_compiled

Set to false if you do not want your library to be compiled (and obfuscated), use options from fastiot.cli.model.project.CompileSettingsEnum

class property default: ProjectContext[source]

Use this method to retrieve the singleton fastiot.cli.model.project.ProjectContext

validator default_to_abspath  »  library_setup_py_dir, project_root_dir[source]
property deployment_names: List[str]

Returns a list of all deployment names configured by configuration (fastiot.cli.model.project.ProjectContext.deployments) or by convention in deployments dir.

deployment_by_name(name)[source]

Returns a specific deployment by its name.

Return type:

DeploymentConfig

deployment_dir(name)[source]

Returns the deployment build dir for specific deployment

Return type:

str

deployment_build_dir(name)[source]

Returns the deployment build dir for specific deployment

Return type:

str

env_file_for_deployment(name)[source]
Return type:

str

env_for_deployment(name)[source]
Return type:

Dict[str, str]

build_env_file_for_deployment(name)[source]
Return type:

str

build_env_for_deployment(name)[source]
Return type:

Dict[str, str]

build_env_for_internal_services_deployment(name)[source]
Return type:

Dict[str, str]

get_service_by_name(name)[source]

Get a configured service from the project by name

Return type:

Service

get_all_service_names()[source]

Returns a list of all configured services

Return type:

List[str]

fastiot.cli.model.project.parse_env_file(env_filename)[source]
Return type:

Dict[str, str]