Skip to main content

tritony - Tiny configuration for Triton Inference Server

Pypi CI Coverage Status

What is this?

If you see the official example, it is really confusing to use where to start.

Use tritony! You will get really short lines of code like example below.

import argparse
import os
from glob import glob
import numpy as np
from PIL import Image

from tritony import InferenceClient


def preprocess(img, dtype=np.float32, h=224, w=224, scaling="INCEPTION"):
    sample_img = img.convert("RGB")

    resized_img = sample_img.resize((w, h), Image.Resampling.BILINEAR)
    resized = np.array(resized_img)
    if resized.ndim == 2:
        resized = resized[:, :, np.newaxis]

    scaled = (resized / 127.5) - 1
    ordered = np.transpose(scaled, (2, 0, 1))
    
    return ordered.astype(dtype)


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--image_folder", type=str, help="Input folder.")
    FLAGS = parser.parse_args()

    client = InferenceClient.create_with("densenet_onnx", "0.0.0.0:8001", input_dims=3, protocol="grpc")
    client.output_kwargs = {"class_count": 1}

    image_data = []
    for filename in glob(os.path.join(FLAGS.image_folder, "*")):
        image_data.append(preprocess(Image.open(filename)))

    result = client(np.asarray(image_data))

    for output in result:
        max_value, arg_max, class_name = output[0].decode("utf-8").split(":")
        print(f"{max_value} ({arg_max}) = {class_name}")

Release Notes

  • 26.10.01 v0.0.21: Clean up async tasks on cancellation; prefer TRITON_ASYNC_TASKS over ASYNC_TASKS.
  • 24.07.11 Upgrade minimum tritonclient version to 2.34.0
  • 23.08.30 Support optional with model input, parameters on config.pbtxt
  • 23.06.16 Support tritonclient>=2.34.0
  • Loosely modified the requirements related to tritonclient

Key Features

  • Simple configuration. Only $host:$port and $model_name are required.
  • Generating asynchronous requests with asyncio.Queue
  • Simple Model switching
  • Support async tritonclient

Requirements

$ pip install tritonclient[all]

Install

$ pip install tritony

Configuration

The default async task count uses TRITON_ASYNC_TASKS, then the legacy ASYNC_TASKS, then 4.

Test

With Triton

./bin/run_triton_tritony_sample.sh
pytest -s --cov-report term-missing --cov=tritony tests/

Example with image_client.py

# Download Images from https://github.com/triton-inference-server/server.git
python ./example/image_client.py --image_folder "./server/qa/images"

Metadata

Release files for tritony 0.0.23

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

Source distribution (sdist)

Source distribution for tritony 0.0.23
File Size Uploaded
tritony-0.0.23.tar.gz 15.4 kB Details

Built distribution (wheel)

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

Total release size: 27.0 kB

Release files / tritony-0.0.23.tar.gz

Download URL tritony-0.0.23.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6ecfc3b6482b40f9be93bf5223f5035373be93c32faf91c60d9ffe48e3fa335c
BLAKE2b-256 checksum
How to use checksums
fabb63b4c7651736ee822ce30c57453e001b4c0215e4afdb7aad8aba1ba04b60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / tritony-0.0.23-py3-none-any.whl

Download URL tritony-0.0.23-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e0fc5c18b5cd65bf3eefa0ece2710d4ec6c4654fc0723ce100e0b95b4e35f9d
BLAKE2b-256 checksum
How to use checksums
6af2ace4bee05fd61b0c6bfbc41a45f77ca4671d26a663c7d0530019f753c4cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.23 This release

2 release files

0.0.20

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.9

2 release files

0.0.8

2 release files

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