Skip to main content

Idem-ai extends idem with pop-ml plugin, enabling multilingual infrastructure management through the translation of logs, state comments, and rend output.

Project description

Made with pop, a Python implementation of Plugin Oriented Programming Made with idem, a Python implementation of Plugin Oriented Programming Documentation is published with Sphinx on docs.idemproject.io Made with Python

idem-ai extends idem with translation capabilities from the pop-ml plugin, enabling multilingual support in infrastructure management workflows.

About

idem-ai extends idem, a powerful infrastructure and configuration management tool, by adding translation capabilities from the pop-ml plugin. With idem-ai, you can enable multilingual support in your infrastructure management workflows.

By integrating idem-ai into your idem environment, you gain access to additional contracts and features that enable translation in various aspects of idem. The added contracts from idem-ai provide translation capabilities for logs, state comments, and rend output. This means you can translate log messages, comments within your states, and the rendered output of commands to facilitate communication in multiple languages.

idem-ai also introduces an ml.translate exec module, which allows you to perform on-the-fly translations using pop-ml. This module can be used within Jinja in SLS or invoked directly on the command line, giving you flexibility in translating text in your idem environment.

With idem-ai, you can effortlessly manage multilingual environments, ensuring clear and consistent communication across language barriers in your infrastructure management workflows.

What is POP?

This project is built with pop, a Python-based implementation of Plugin Oriented Programming (POP). POP seeks to bring together concepts and wisdom from the history of computing in new ways to solve modern computing problems.

For more information:

Getting Started

Prerequisites

  • Python 3.8+

  • git (if installing from source, or contributing to the project)

Installation

If wanting to use idem-ai, you can do so by either installing from PyPI or from source.

Install from PyPI

pip install idem-ai

Install from source

# clone repo
git clone git@gitlab.com/vmware/idem/idem-ai.git
cd idem-ai

# Setup venv
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Usage

To use idem-ai, you need to create a YAML configuration file that defines the behavior of the translation.

Here’s an example YAML configuration file:

idem:
  translate_output: False
  translate_comments: False
  translate_docs: False
  translate_logs: False
pop_ml:
  source_lang: en
  dest_lang: es

This configuration file contains various options that control the translation behavior:

  • translate_output: If set to True, the output of the execution will be translated. Default is False.

  • translate_comments: If set to True, the comments of states and exec moduleswill be translated. Default is False.

  • translate_logs: If set to True, the log messages will be translated. Default is False.

  • dest_lang: The destination language for translation. Default is “es”.

  • source_lang: The source language for translation. Default is “en”.

The dest_lang parameter is required for the translation to work. It should be a two-letter language code.

You can modify these options based on your requirements.

Examples

Here are some example commands that demonstrate the usage of idem-ai:

Translate a text using the ml.translate exec module:

idem exec ml.translate "Hello World!" dest_lang=es

Translate logs using the –translate-logs option:

idem -c my_config.cfg exec test.ping --translate-logs --log-level=debug

In this example, the –translate-logs option enables the translation of logs with pop-ml. This will translate the log messages into the specified destination language.

Translate state comments using the –translate-state-comments option:

idem -c my_config.cfg state my_state.sls --translate-state-comments

In this example, the –translate-state-comments option enables the translation of state comments. This will translate the comments from state output from the run into the specified destination language.

Translate rend output using the –translate-output option:

idem -c my_config.cfg exec test.ping --translate-output

In this example, the –translate-output option enables the translation of rend output for a doc subcommand. However, please note that enabling this option may cause unpredictable behavior for CLI programs. It is recommended to use it with caution.

Translate docstrings from idem doc using the –translate-docs option:

idem -c my_config.cfg doc exec.test.ping --translate-docs

In this example, the –translate-docs option enables the translation of docs for the exec.test.ping command. This will translate the documentation associated with the specified command into the specified destination language without translating keys, paths, refs, and other values unrelated to docs.

Roadmap

Reference the open issues for a list of proposed features (and known issues).

Acknowledgements

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

idem-ai-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

idem_ai-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file idem-ai-0.1.0.tar.gz.

File metadata

  • Download URL: idem-ai-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.30.0 requests-toolbelt/1.0.0 urllib3/2.0.2 tqdm/4.65.0 importlib-metadata/6.6.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.16

File hashes

Hashes for idem-ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ef7d0bf63d9d6aa3da4d4c9628f24541abae57f7e1802e3898d36ad81191a3f9
MD5 2ba8cd16bcb7f7c0e9a736219ca0f8f9
BLAKE2b-256 3d41653e291619423fc40457b299b9de7951eeaf8566fd2fab1c08c7600474cf

See more details on using hashes here.

File details

Details for the file idem_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: idem_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.30.0 requests-toolbelt/1.0.0 urllib3/2.0.2 tqdm/4.65.0 importlib-metadata/6.6.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.16

File hashes

Hashes for idem_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43f17d399dda80e400a71ede585587e18798451c9697324e686c33a458132b09
MD5 25ade703a6f2799f4082f4ddc103b48d
BLAKE2b-256 d9703905615a73c2ecf9113a8c80c68e8df7c46a55230b144d54bd79d8ea53ea

See more details on using hashes here.

Supported by

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