ersilia.cli package

Subpackages

Submodules

ersilia.cli.cmd module

class ersilia.cli.cmd.Command[source]

Bases: object

Command class to dynamically import and execute CLI commands.

catalog()[source]

Display the catalog.

close()[source]

Close the application.

delete()[source]

Delete the application.

example()[source]

Show an example.

fetch()[source]

Fetch data.

info()[source]

Display information.

publish()[source]

Publish data.

restart()[source]

Restart the command.

run()[source]

Execute the command.

serve()[source]

Serve the application.

setup()[source]

Set up the application.

stop()[source]

Stop the command.

test()[source]

Test the application.

uninstall()[source]

Uninstall the application.

ersilia.cli.create_cli module

ersilia.cli.create_cli.create_ersilia_cli()[source]

Creates and configures the Ersilia CLI.

This function initializes the Command class, checks if the user is a contributor, and dynamically imports and executes various CLI commands based on the user’s role.

Returns:

ersilia_cli – The configured Ersilia CLI module.

Return type:

module

ersilia.cli.echo module

ersilia.cli.messages module

class ersilia.cli.messages.ModelNotFound(model)[source]

Bases: object

A class to handle the scenario when a model is not found.

model

The model object that was not found.

Type:

object

echo()[source]

Prints an error message and exits the program.

echo()[source]

Prints an error message indicating the model was not found and exits the program.

class ersilia.cli.messages.ModelNotInLocal(model_id)[source]

Bases: object

A class to handle the scenario when a model is not found locally.

model_id

The identifier of the model that was not found locally.

Type:

str

echo()[source]

Prints an error message and exits the program.

echo()[source]

Prints an error message indicating the model was not found locally and exits the program.

ersilia.cli.messages.no_model_served(fg='red', hint=None)[source]

Tell the user that no model is served in this terminal.

Parameters:
  • fg (str, optional) – “red” when the command cannot continue, “yellow” when nothing needed to be done (e.g. ersilia close).

  • hint (str, optional) – What to do instead of serving a model, shown after the usual hint.

ersilia.cli.messages.report_error(error)[source]

Print an error the standard way (message, then hint) and exit with code 1.

Parameters:

error (Exception) – The error, typically an ErsiliaError.

ersilia.cli.messages.served_elsewhere_hint()[source]

Point to ERSILIA_SESSION when the model may be in another session.

Commands started through wrappers such as conda run, make or CI steps each get a new session: a model served by one such command is stopped by the next (its session’s process has ended), or runs in a session that this command cannot see. Nothing is printed otherwise.

ersilia.cli.messages.wrong_extension(allowed, err=False)[source]

Tell the user that an output file has an unsupported extension.

Parameters:
  • allowed (list of str) – The accepted extensions, e.g. [“.csv”, “.h5”].

  • err (bool, optional) – Print to stderr.

Module contents