fastiot.cli package

Base of the Command Line Interface (CLI) for FastIoT

Methods and classes within this directory are mainly for setting up new projects and building existing ones locally or with a CI runner like Jenkins

Subpackages

Submodules

fastiot.cli.cli_logging module

fastiot.cli.cli_logging.get_cli_logger()[source]

fastiot.cli.constants module

fastiot.cli.env module

class fastiot.cli.env.CLIConstants[source]

Some environment variables for the CI runner used internally and not available as command line option.

property is_ci_runner: bool
FASTIOT_IS_CI_RUNNER

Set to true to enable some CI-runner specific features like keeping the buildkit container running.

property within_container: bool
FASTIOT_WITHIN_CONTAINER

Set to true to enable some CI-runner specific features like keeping the buildkit container running.

property use_local_deployment: str
FASTIOT_USE_DEPLOYMENT

Set this variable in your IDE when running services locally to overwrite the integration test deployment used per default.

fastiot.cli.fiot module

Basic script to start the fiot command line program

fastiot.cli.fiot.main()[source]

fastiot.cli.helper_fn module

fastiot.cli.helper_fn.get_jinja_env(template_dir='/home/docs/checkouts/readthedocs.org/user_builds/fastiot/checkouts/latest/src/fastiot/cli/templates')[source]
fastiot.cli.helper_fn.find_services(package=None, path=None, services=None)[source]

Find services in a package

Parameters:
  • package (Optional[str]) – The package name within your src. If not defined the whole src will be searched for suitable services containing a manifest.yaml and a run.py

  • path (Optional[str]) – Optional, specify a search path, uses os.getcwd() as default

  • services (Optional[List[str]]) – Optional; if specified it will only include the listed services

Return type:

List[Service]

fastiot.cli.helper_fn.find_deployments(deployments=None, path='')[source]

Creates a dict of all deployments found the projects deployments path.

Parameters:
  • deployments (Optional[List[str]]) – Optional, specify a list of deployments to be exclusively included

  • path (str) – Optional, specify a search path, uses os.getcwd() as default

Return type:

Dict[str, DeploymentConfig]

fastiot.cli.import_configure module

fastiot.cli.import_configure.import_configure(project_context, file_name='')[source]

Imports the configure.py in the project root (if not specified otherwise) and sets project config accordingly.

fastiot.cli.import_configure.configure_py_to_dict(file_name='')[source]

Reads the configure.py in the project root dir (if not specified otherwise) and returns its values as a dictionary. Use this method if you want to use config options not available in the default context (fastiot.cli.model.project.ProjectContext) in your own commands.

Return type:

dict

fastiot.cli.infrastructure_service_fn module

Some helpers to work with external services: importing, port handling, …

fastiot.cli.infrastructure_service_fn.get_infrastructure_service_ports_randomly()[source]

Get random environment variables for all ports.

On very busy machines this may to reuse of ports, if another service takes the port between determining its free status and actually starting the service.

Return type:

Dict[str, int]

Returns:

dict with the environment variables and the corresponding port numbers

fastiot.cli.infrastructure_service_fn.get_infrastructure_service_ports_monotonically_increasing(offset)[source]

Get environment variables for all ports in a monotonically increasing order with an offset.

Parameters:

offset (int) – Port number for the first service, will be monotonically increasing for all further services.

Return type:

Dict[str, int]

Returns:

dict with the environment variables and the corresponding port numbers

fastiot.cli.typer_app module

Base of typer app

Here the typer app is initialized. If you want to add own commands you may consult the Typer documentation. Basically your commands will be decorated with an @app.command(). Replace app with create_cmd, run_cmd, or stop_cmd if you want to create subcommands of create, run or stop.

fastiot.cli.version module

fastiot.cli.version.create_version_file(destination)[source]

Creates a file with __version__=…

Parameters:

destination (Optional[str]) – Destination path (full filename) to put the generated file.

fastiot.cli.version.get_version(complete=False, only_major=False, minor=False)[source]

Returns the current version depending on the git commits and tags or version file

Parameters:
  • complete – Set to true to get the full version including dev, e.g. 1.4+dev10

  • only_major – Set to true to get only the major version, e.g. 1.x

  • minor – Set to true to only get the minor version, e.g. .4

Return type:

str

Returns:

String with version