Skip to main content

Omni Python SDK

Project description

omnicli-sdk (sdk-python)

Python SDK for building Omni commands.

Overview

omnicli-sdk is a Python package that provides functionality to help build commands that will be executed by Omni. It offers various utilities and helpers that make it easier to work with Omni's features from within Python.

Installation

pip install omnicli-sdk

Features

Argument Parsing

The SDK can read omni-parsed arguments from environment variables into a familiar Python format:

from omnicli import parse_args

try:
    args = parse_args()

    # Access your command's arguments as attributes
    if args.verbose:
        print("Verbose mode enabled")

    if args.input_file:
        print(f"Processing file: {args.input_file}")

except ArgListMissingError:
    print("No Omni CLI arguments found. Make sure 'argparser: true' is set for your command.")

The resulting arguments can be used the same as they would have been when coming from using 'argparse.ArgumentParser().parse_args()', as they will be returned as an 'argparse.Namespace' object, with their values in the expected types.

Integration with omni

The argument parser of omni needs to be enabled for your command. This can be done as part of the metadata of your command, which can either be provided as a separate file:

your-repo
└── commands
    ├── your-command.py
    └── your-command.metadata.yaml
# your-command.metadata.yaml
argparser: true

Or as part of your python command headers:

# your-command.py
#
# argparser: true

import os
...

Requirements

  • Python 3.8 or higher
  • No additional dependencies required

Development

To set up for development:

# Clone the repository
omni clone https://github.com/omnicli/sdk-python.git

# Install dependencies
omni up

# Run tests
omni test

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

omnicli_sdk-0.0.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

omnicli_sdk-0.0.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file omnicli_sdk-0.0.1.tar.gz.

File metadata

  • Download URL: omnicli_sdk-0.0.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for omnicli_sdk-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e4112fdbeec483083e5ad96ba2099b519828f8a24a2c4f674c009b592495f332
MD5 365ac829aa68f183e0bae4387198956f
BLAKE2b-256 e6418edc31a81cb051fd76d9b8faa6104ea1b14a398d5dc2ba6a1d455355d60a

See more details on using hashes here.

Provenance

The following attestation bundles were made for omnicli_sdk-0.0.1.tar.gz:

Publisher: build.yaml on omnicli/sdk-python

Attestations:

File details

Details for the file omnicli_sdk-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: omnicli_sdk-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for omnicli_sdk-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8025a6d30cfea0eaa083986dae001a480fda89f84a6f127956c42ecfdb104313
MD5 3413fce9dbd71ab87e7a61b2797f9fa9
BLAKE2b-256 acabbf7a45ca5f851940811777e4e8a3c9904959dc1b37a94091a9a48f59a00b

See more details on using hashes here.

Provenance

The following attestation bundles were made for omnicli_sdk-0.0.1-py3-none-any.whl:

Publisher: build.yaml on omnicli/sdk-python

Attestations:

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