Dynamic CLI for modular-api
Project description
Modular-CLI
Content
- General information
- Installation
- Configuration
- First run
- Autocomplete
- Modular CLI schema
- Project information
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.
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.
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 .
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 linemodular-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.
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>
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:
- Activate virtual environment by command
source <path_to_venv>/bin/activate
- Create SYMLINK to virtual environment
sudo ln -s <your_path_to_venv>/bin/modular-cli /usr/local/bin/modular-cli
- Start a new terminal session
- Execute command
sudo modular-cli enable_autocomplete
- Restart terminal session
To deactivate:
- Execute the
sudo modular-cli disable_autocomplete
command - Restart terminal session
6. Modular CLI schema
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file modular_cli-2.3.0.tar.gz
.
File metadata
- Download URL: modular_cli-2.3.0.tar.gz
- Upload date:
- Size: 31.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee97b97cc1d1c68b976ac8de7600c79cc44e91254cd00782ecdb27026db09641 |
|
MD5 | c0790ea0f5cf6d4f016fa5abca87c465 |
|
BLAKE2b-256 | e5b25e4ce3cc036f175090d6986e6f5a90d92ce1540e2a72acfa271bcb8baa5e |
Provenance
The following attestation bundles were made for modular_cli-2.3.0.tar.gz
:
Publisher:
pypi-package.yml
on epam/modular-cli
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
modular_cli-2.3.0.tar.gz
- Subject digest:
ee97b97cc1d1c68b976ac8de7600c79cc44e91254cd00782ecdb27026db09641
- Sigstore transparency entry: 150450076
- Sigstore integration time:
- Predicate type:
File details
Details for the file modular_cli-2.3.0-py3-none-any.whl
.
File metadata
- Download URL: modular_cli-2.3.0-py3-none-any.whl
- Upload date:
- Size: 34.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 790d855da1da7ac44a6a9322995c6778cfad1006207d600b97e55b0a616e1bef |
|
MD5 | 2b719efa7bddb37aafefe57311b993d4 |
|
BLAKE2b-256 | 216b9cd0afb2d51d74125316af09f5973b40322de255f73e519c7154147e9196 |
Provenance
The following attestation bundles were made for modular_cli-2.3.0-py3-none-any.whl
:
Publisher:
pypi-package.yml
on epam/modular-cli
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
modular_cli-2.3.0-py3-none-any.whl
- Subject digest:
790d855da1da7ac44a6a9322995c6778cfad1006207d600b97e55b0a616e1bef
- Sigstore transparency entry: 150450078
- Sigstore integration time:
- Predicate type: