Skip to main content

ArmoniK.Api Python package

This folder contains the necessary scripts to generate the ArmoniK.Api Python package. Please note that while the package generation is platform dependent, the generated package should be compatible with Linux and Windows.

Install the Python Package from PyPI

At each release, we provide a prepackaged version of ArmoniK.Api available on PyPI here : https://pypi.org/project/armonik. To install the package to your current Python environment, you can use pip :

pip install armonik

Linux / WSL

How to generate

Requirements :

  • Python >= 3.7
  • Python3-venv
  • Pip3
  • Bash

If the python command doesn't link to python3 on your system, you may be able to install the package python-is-python3, which links python to python3.

To generate the package from sources, run the proto2python.sh script from its folder. You need to specify a directory where the virtual environment used for the build will be located. For example the following command will generate the packages and will create the build environment "pyvenv" in the current user's home directory:

./proto2python.sh ~/pyvenv

3 folders will be created :

  • generated : contains the source files used to create the package
  • build : contains the source files used to create the wheel package
  • pkg : contains the sdist and wheel packages

Instead of running the script you can install the armonik package in "editable" mode, allowing you to make changes to the source code, and the changes will be reflected immediately without reinstalling the package.

pip install -e ./packages/python

How to install the generated package

From this directory, use the following command:

pip install pkg/armonik*.whl

The generated package will be installed to your current python environment

Windows

Coming soon

Tests

Test Environment Setup

Before running tests, ensure the following setup steps are completed:

  1. Install Dependencies:
sudo apt install dotnet-sdk-6.0 jq
  1. Launch the Mock Server:

Verify that port 5000 is available (Armonik and the mock server communicate on the same port, uninstall armonik if necessary):

lsof -i :5000
  1. Launch the server from the project's root directory in a separate terminal:
cd packages/csharp/ArmoniK.Api.Mock
dotnet run

Test Environment Summary

The test environment utilizes a mock endpoint to assert if the ArmoniK service has been triggered. It leverages the requests library to query the /calls.json endpoint, examining the JSON response to validate the count of remote procedure calls made to specific services and methods

curl localhost:5000/calls.json | jq

In prevision of the API test, run the following command:

curl localhost:5000/calls.json | jq '.Tasks'

You should have as output:

{
  "GetTask": 0,
  "ListTasks": 0,
  "GetResultIds": 0,
  "CancelTasks": 0,
  "CountTasksByStatus": 0,
  "ListTasksDetailed": 0,
  "SubmitTasks": 0
}

Configure gRPC channel and test API calls

Once the endpoint runs, you can initiate a gRPC channel to it with a Python client.

Below is an example using a Tasks client and calling the list_tasks method:

import grpc
import armonik.client
with grpc.insecure_channel("localhost:5001") as channel:
    tasks_client = ArmoniKTasks(channel)
    tasks.client.list_tasks()

Port 5001 is actually ArmoniK's control-plane endpoint.

For the sake of simplicity, the example gRPC channel here is an insecure one. You should never do that in production environment.

Check if API call was successful

Execute the Python code snippet above and re-run command:

curl localhost:5000/calls.json | jq '.Tasks'

You should have as output:

{
  "GetTask": 0,
  "ListTasks": 0,
  "GetResultIds": 0,
  "CancelTasks": 0,
  "CountTasksByStatus": 0,
  "ListTasksDetailed": 1,
  "SubmitTasks": 0
}

You can see that attribute ListTasksDetailed was incremented, meaning that the API effectively handled your call !

WARNING

Note for Users

Starting from gRPC version 1.57 and onward, it is necessary to explicitly specify the default authority when creating the gRPC channel. more details

Metadata

Release files for armonik 3.30.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for armonik 3.30.0
File Size Uploaded Provenance Actions
armonik-3.30.0.tar.gz 91.1 kB Without provenance Details for armonik-3.30.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for armonik 3.30.0
File Interpreter ABI Platform Actions
armonik-3.30.0-py3-none-any.whl Python 3 none any Details for armonik-3.30.0-py3-none-any.whl

Total release size: 240.3 kB

Release files / armonik-3.30.0.tar.gz

Download URL armonik-3.30.0.tar.gz
Size 91.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cb9189a26758e4f4ceeca14b13eb5e1b169d7e26cc19ba89bb447f2f676c0d94
BLAKE2b-256 checksum
How to use checksums
47a9d23e983decfea3eaf2041a9aef16e1dbfd3276cf3c8351d1ebabfe889041
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / armonik-3.30.0-py3-none-any.whl

Download URL armonik-3.30.0-py3-none-any.whl
Size 149.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
325b93ff23d2f85ad40ba305fb04b29e837034da1e41681e8c90af236fd4acbc
BLAKE2b-256 checksum
How to use checksums
18c27e5125902be8ce8291bcb70b7226f6298cbe4c15a54d29d2d970a6f1388d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for armonik 3.30.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.30.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page