API Docs

CLI

Invenio module to ease the creation and management of applications.

Commands

Invenio module to ease the creation and management of applications.

class invenio_cli.commands.AssetsCommands(cli_config)[source]

Local installation commands.

Constructor.

High-level command to install and build a JS module.

watch_assets()[source]

High-level command to watch assets for changes.

watch_js_module(path, link=True)[source]

High-level command to watch a JS module for changes.

class invenio_cli.commands.Commands(cli_config)[source]

Abstraction over CLI commands that are either local or containerized.

Constructor.

Parameters

cli_config – :class:CLIConfig instance

destroy()[source]

Destroys the instance’s virtualenv.

NOTE: This function has no knowledge of the existence of services.

Refer to services.py to destroy services’ containers.

classmethod pyshell(debug=False)[source]

Start a Python shell.

classmethod shell()[source]

Start a shell in the virtual environment.

class invenio_cli.commands.ContainersCommands(cli_config, docker_helper=None)[source]

Containerized environment CLI commands.

Constructor.

build(pull=True, cache=True)[source]

Return the steps to build images.

Parameters
  • pull – Attempt to pull newer versions of the images.

  • cache – Use cached images and layers.

declare_queues(project_shortname)[source]

Steps to declare the MQ queues required for statistics, etc.

demo(project_shortname)[source]

Steps to demo records into the instance.

fixtures(project_shortname)[source]

Steps to set up the required fixtures for the instance.

rdm_fixtures(project_shortname)[source]

Steps to set up the rdm fixtures for the instance.

setup(force, demo_data=True, stop=False, services=True)[source]

Return the steps to setup containerize services.

Parameters
  • force – Remove existing content (db, indices, etc.).

  • demo_data – Include demo records.

  • stop – Stop services after setup.

start(lock=False, build=False, setup=False, demo_data=True, services=True)[source]

Return the steps to start service and application containers.

Parameters
  • lock – Lock dependencies.

  • build – Build containers if not built.

  • setup – Setup services (db, indices, etc.).

  • demo_data – Include demo records.

  • services – Start services or only the application containers. This option is incompatible will all the other flags.

translations(project_shortname)[source]

Steps to compile translations for the instance.

class invenio_cli.commands.InstallCommands(cli_config)[source]

Local installation commands.

Constructor.

install(pre, dev=False, flask_env='production')[source]

Development installation steps.

install_py_dependencies(pre, dev=False)[source]

Install Python dependencies.

Create symlink in instance pointing to project file or folder.

update_instance_path()[source]

Update path to instance in config.

class invenio_cli.commands.LocalCommands(cli_config)[source]

Local CLI commands.

Constructor.

run(host, port, debug=True, services=True, celery_log_file=None)[source]

Run development server and celery queue.

update_statics_and_assets(force, flask_env='production', log_file=None)[source]

High-level command to update less/js/images/… files.

Needed here (parent) because is used by Assets and Install commands.

class invenio_cli.commands.PackagesCommands[source]

Local installation commands.

static install_locked_dependencies(pre, dev)[source]

Install dependencies from Pipfile.lock using sync.

static install_packages(packages, log_file=None)[source]

Steps to install Python packages.

It is a class method since it does not require any configuration.

static is_locked()[source]

Checks if the dependencies have been locked.

static lock(pre, dev)[source]

Steps to lock Python dependencies.

static outdated_packages()[source]

Steps to show outdated packages.

It is a class method since it does not require any configuration.

static update_package_new_version(package, version)[source]

Update invenio-app-rdm version.

It is a class method since it does not require any configuration.

static update_packages()[source]

Steps to update all Python packages.

It is a class method since it does not require any configuration.

class invenio_cli.commands.RequirementsCommands[source]

Pre-requirements check.

classmethod check(development=False)[source]

Steps to check the pre-requisites.

classmethod check_dev()[source]

Steps to check the development pre-requisites.

classmethod check_docker_compose_version(major, minor=-1, patch=-1, exact=False)[source]

Check the docker compose version.

classmethod check_docker_version(major, minor=-1, patch=-1, exact=False)[source]

Check the docker version.

classmethod check_git_version(major, minor=-1, patch=-1, exact=False)[source]

Check the git version.

classmethod check_imagemagick_version(major, minor=-1, patch=-1, exact=False)[source]

Check the ImageMagick version.

classmethod check_node_version(major, minor=-1, patch=-1, exact=False)[source]

Check the node version.

classmethod check_npm_version(major, minor=-1, patch=-1, exact=False)[source]

Check the npm version.

classmethod check_pipenv_installed()[source]

Check the pipenv version.

classmethod check_python_version(major, minor=-1, patch=-1, exact=False)[source]

Check the python version.

class invenio_cli.commands.ServicesCommands(cli_config, docker_helper=None)[source]

Service CLI commands.

Constructor.

declare_queues()[source]

Steps to declare the MQ queues required for statistics, etc.

demo()[source]

Steps to add demo records into the instance.

destroy()[source]

Steps to destroy the services’s containers.

ensure_containers_running()[source]

Ensures containers are running.

fixtures()[source]

Steps to set up the required fixtures for the instance.

rdm_fixtures()[source]

Steps to set up the rdm fixtures for the instance.

services_expected_status(expected)[source]

Checks if the services have the expected status.

setup(force, demo_data=True, stop=False, services=True)[source]

Steps to setup services’ containers.

A check in invenio-cli’s config file is done to see if one-time setup has been executed before.

start()[source]

Steps to start services’ containers.

status(services, verbose)[source]

Checks the status of the given service.

Returns

A list of the same length than services. Each item will be a code corresponding to: 0 success, 1 failure, 2 healthcheck not defined.

stop()[source]

Stops containers.

translations()[source]

Steps to compile translations.

class invenio_cli.commands.TranslationsCommands(project_path, instance_path)[source]

Translations CLI commands.

Constructor.

compile(directory=None, fuzzy=False, translation_folder='translations', symlink=True)[source]

Compile the message catalog.

classmethod extract(babel_file, output_file, input_dirs, msgid_bugs_address, copyright_holder, add_comments='NOTE')[source]

Extract messages from source code and templates.

classmethod init(output_dir, input_file, locale)[source]

Initialize a new language catalog.

classmethod update(output_dir, input_file)[source]

Update the message catalog.

class invenio_cli.commands.UpgradeCommands[source]

Local installation commands.

static upgrade(script_path)[source]

Steps to perform an upgrade of the invenio instance.

First, and alembic upgrade is launched to allow alembic to migrate the database using SQLAlchemy. Then, the custom script is executed. Last, the search indices are destroyed, initialized and rebuilt. It is a class method since it does not require any configuration.

Helpers

Invenio CLI helpers module.