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.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

omnicli_sdk-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: omnicli_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 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.1.0.tar.gz
Algorithm Hash digest
SHA256 fab44333cf0589191a6d4d4b14d34ab155937ae32ad0af1dbc8a6b7ceaf5f6e8
MD5 f5754c7321ed62d5b34e588d770ac876
BLAKE2b-256 191e0ea09cb0fe35e67b4f03dc11259cfdee18a79f01a1f5c03f8120e8431d9e

See more details on using hashes here.

Provenance

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

Publisher: build.yaml on omnicli/sdk-python

Attestations:

File details

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

File metadata

  • Download URL: omnicli_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35f115ea3d17e4e792fd781aada1c1d0f37752603baa9d10581127326a26d4dd
MD5 08cd694aeadcc9a08dda2692cf8151f7
BLAKE2b-256 22d8124cca3eeae8205c7ff2b00f509958d3dd0976c8cf7c3a9050b8788c50ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for omnicli_sdk-0.1.0-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