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, the entry point for Modular-CLI is set as modular-cli and this name will be used
in all next commands examples. However, you have the ability to customize this name using an
environment variable during installation:
- Set the
MODULAR_CLI_ENTRY_POINTenvironment variable to your desired command name - Install Modular-CLI with the custom entry point:
export MODULAR_CLI_ENTRY_POINT=your-custom-name
pip install .
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
--jsonflag was specified:
modular-cli $module_name $group_name $command_name --$parameter $parameter value --json
{
"Status": "SUCCESS",
"Code": 200,
"Message": "$Command execution result",
"Warnings": []
}
- If
--tableflag 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_autocompletecommand - 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file modular_cli-2.3.12.tar.gz.
File metadata
- Download URL: modular_cli-2.3.12.tar.gz
- Upload date:
- Size: 33.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a46f1a6b66b381ed8e6dce9da2da075edbdf064c5e2bb8363e7914d80fc7f87a
|
|
| MD5 |
cbd28985e14d7d23a57903dfa1dc3da2
|
|
| BLAKE2b-256 |
8a25324237d72af901ec49d007c9efe15e59d246a5208e2c8172cd81e3b65b2d
|
Provenance
The following attestation bundles were made for modular_cli-2.3.12.tar.gz:
Publisher:
pypi-package.yml on epam/modular-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modular_cli-2.3.12.tar.gz -
Subject digest:
a46f1a6b66b381ed8e6dce9da2da075edbdf064c5e2bb8363e7914d80fc7f87a - Sigstore transparency entry: 602126594
- Sigstore integration time:
-
Permalink:
epam/modular-cli@e062312a6a28ea7ce053b302cfb3b212979ea798 -
Branch / Tag:
refs/tags/2.3.12 - Owner: https://github.com/epam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-package.yml@e062312a6a28ea7ce053b302cfb3b212979ea798 -
Trigger Event:
release
-
Statement type:
File details
Details for the file modular_cli-2.3.12-py3-none-any.whl.
File metadata
- Download URL: modular_cli-2.3.12-py3-none-any.whl
- Upload date:
- Size: 37.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2963b9e50c6398fa977026e9a64968ea5804c3ae02714e438827a0930b47847e
|
|
| MD5 |
3b8521609b203cf93d1d0e4ae6b9fa30
|
|
| BLAKE2b-256 |
e40adf1eca9888ebf175b06c05810035815778f79cb92ad75a261194f6b097fb
|
Provenance
The following attestation bundles were made for modular_cli-2.3.12-py3-none-any.whl:
Publisher:
pypi-package.yml on epam/modular-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modular_cli-2.3.12-py3-none-any.whl -
Subject digest:
2963b9e50c6398fa977026e9a64968ea5804c3ae02714e438827a0930b47847e - Sigstore transparency entry: 602126597
- Sigstore integration time:
-
Permalink:
epam/modular-cli@e062312a6a28ea7ce053b302cfb3b212979ea798 -
Branch / Tag:
refs/tags/2.3.12 - Owner: https://github.com/epam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-package.yml@e062312a6a28ea7ce053b302cfb3b212979ea798 -
Trigger Event:
release
-
Statement type: