Skip to main content

Dynamic CLI for modular-api

Project description

Modular-CLI

Content

  1. General information
  2. Installation
  3. Configuration
  4. First run
  5. Autocomplete
  6. Modular CLI schema
  7. Project information

Content ↑

1. General information

Modular-CLI is the specialized tool for interacting with the Modular-API. Automatically generate auth token, request body based on received meta from Modular-API and send it via HTTP requests.

Content ↑

2. Installation

The installation of Modular-CLI assumed that you have Python3.10 and pip installed. Use the following links to install the tools in case they are not installed.

Python download page

Pip installation page

NOTE: Due to the best Python practices, it is highly recommended to use virtual environment to protect project against dependency breakage.

Creating Virtual Environments Guide

  • Create: python -m venv modular_cli_venv
  • Activate (Linux): source modular_cli_venv/bin/activate
    Activate (Windows): source modular_cli_venv/Scripts/activate
  • Installation: pip install .

Content ↑

3. Configuration

By default - entry point for Modular-CLI set as modular-cli and this name will be used in all next commands examples. However, you have ability to customize this name in setup.py file before Modular-CLI installation:

  • open setup.py file in any convenient editor
  • find property entry_points and line modular-cli=modular_cli.modular_cli:modular_cli in it
  • replace modular-cli keyword with desired name

Before first run Modular-CLI should be properly configured. Please create the user in Modular-API by yourself or ask for support your system administrator. For using Modular-CLI you need to know your username, password and link to Modular-API.
After that use the next command:
modular-cli setup --username $USER --password $PASSWORD --api_path $LINK_TO_MODULAR_API
Please NOTE: Modular-API server should be in running state when setup command will be executed

If you would like update access credentials just execute modular-cli setup command again.
To delete credentials run modular-cli cleanup command

Optional configuration

The following environment variables could be used:

  • LOG_PATH: in case you need to store the Modular-cli log file by the custom path.

Content ↑

4. First run

First step you should do after configuration it is retrieving jwt token for authorization and available for your user commands meta.

Execute modular-cli login - to get fresh jwt token and available commands

Response:
Login successful

Execute modular-cli - to see available for your user commands

Available modules:
        module_1
        module_2
        ...
        module_N
Available groups:
        group_1
        group_2
        ...
        group_N
Available commands:
        cleanup
        login
        setup
        version

Try to execute any available by Modular-API policy command

modular-cli $module_name $group_name $command_name --$parameter $parameter value
Response:
$Command execution result

In every command you can add --json or --table flag and change output mode.

  • If --json flag was specified:
modular-cli $module_name $group_name $command_name --$parameter $parameter value --json
{
    "Status": "SUCCESS",
    "Code": 200,
    "Message": "$Command execution result",
    "Warnings": []
}
  • If --table flag was specified:
modular-cli $module_name $group_name $command_name --$parameter $parameter value --table
+---------+------+----------------------------------------------------+
|  Status | Code |                      Response                      |
+---------+------+----------------------------------------------------+
| SUCCESS | 200  |             $Command execution result              |
+---------+------+----------------------------------------------------+

If you want to extend list of available commands/modules please contact to your system administrator with request about adding desired resources.

Commands syntax:
modular-cli <available commands> <parameters>
modular-cli <available modules> <group or command> <parameters>
modular-cli <available groups> <subgroup or command> <parameters>

Content ↑

5. Autocomplete

The user has ability to enable autocompletion feature for Modular-CLI tool. Autocomplete option available only on Unix-based platforms (bash&zsh interpreters).

To activate it do a few steps:

  1. Activate virtual environment by command source <path_to_venv>/bin/activate
  2. Create SYMLINK to virtual environment sudo ln -s <your_path_to_venv>/bin/modular-cli /usr/local/bin/modular-cli
  3. Start a new terminal session
  4. Execute command sudo modular-cli enable_autocomplete
  5. Restart terminal session

To deactivate:

  1. Execute the sudo modular-cli disable_autocompletecommand
  2. Restart terminal session

Content ↑

6. Modular CLI schema

Schema

Content ↑

6. Project information

Source Code: https://github.com/epam/modular-cli
Documentation: https://github.com/epam/modular-cli/blob/main/README.md
Changelog: https://github.com/epam/modular-cli/blob/main/CHANGELOG.md
Supported Python Version: 3.10

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modular_cli-2.3.9.tar.gz (32.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modular_cli-2.3.9-py3-none-any.whl (36.2 kB view details)

Uploaded Python 3

File details

Details for the file modular_cli-2.3.9.tar.gz.

File metadata

  • Download URL: modular_cli-2.3.9.tar.gz
  • Upload date:
  • Size: 32.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for modular_cli-2.3.9.tar.gz
Algorithm Hash digest
SHA256 309ec7df67251c319dd4acca46b4073fc5f105d75adc3a1aeeb383ac3032efd4
MD5 24fcd0f174d23bd65eeb375a0831b7d5
BLAKE2b-256 debbaa7d2ab85e657ea5150a7f852fbe7c96d39ae7e1a8e4c9da6e45090c3f6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for modular_cli-2.3.9.tar.gz:

Publisher: pypi-package.yml on epam/modular-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modular_cli-2.3.9-py3-none-any.whl.

File metadata

  • Download URL: modular_cli-2.3.9-py3-none-any.whl
  • Upload date:
  • Size: 36.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for modular_cli-2.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 322c99b52e9ef83e216bc5584be15f61adef389db68286a299a42eea2106c695
MD5 47cdf2a6815428b73fef889db10906e3
BLAKE2b-256 d9e887757b4be2de3b398f2fd40fc5b68281268dd491333fd6031d0a985872cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for modular_cli-2.3.9-py3-none-any.whl:

Publisher: pypi-package.yml on epam/modular-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page