Skip to main content

Introduction

Nexus SDK Py is a Python development kit for Nexus client applications. It builds upon Golang Client via cgo. Python SDK does not use any Python-level HTTP middleware for Nexus interactions, but authentication might require it.

SDK is tested against a Nexus stack in a docker-compose deployment, backed by kind Kubernetes clusters.

Quickstart

Install CGO library from Go SDK by running:

chmod +x ./sdk-installer.sh
./sdk-installer.sh

Setting up the development environment

To set up the development environment, follow these steps:

Install the Python dependencies with:

just install

To start a local Nexus stack for testing, run:

just up

The command will start the Kind cluster and deploy Nexus stack on it. You can then run tests against this local deployment.

The Nexus Scheduler API will be available at http://localhost:5555/scheduler and the Nexus Receiver API will be available at http://localhost:8080/receiver. Note that the cluster's ingress configured to rewrite URL paths to reduce number of ports you need to interact with and reduce probability of errors related to ports collision. For example, when you send a request to http://localhost:5555/scheduler/api/something/something, it will be automatically rewritten to http://scheduler-pod:8080/api/something/something and forwarded to the Scheduler API.

The Scylla DB will be available at localhost:9042 and you can connect to it using any CQL client. The default credentials are cassandra/cassandra.

The MinIO s3 API will be available at localhost:9000 and you can connect to it using any S3 client. The default credentials are minioadmin/minioadmin. The minio console is not exposed, but you can use the mc client to interact with it.

In case you are testing changes for Go SDK, clone branch you are testing and compile the .so file from source:

go build -v -buildmode=c-shared -o nexus_sdk.so main.go

Afterwards, copy the nexus_sdk.so under src/nexus_client_sdk/.extensions/nexus_sdk.so.

Initialize a client and retrieve results for a tagged submission:

from nexus_client_sdk.models.access_token import AccessToken
from nexus_client_sdk.models.scheduler import SdkCustomRunConfiguration
from nexus_client_sdk.clients.nexus_scheduler_client import NexusSchedulerClient

token = "..."
client = NexusSchedulerClient.create("https://localhost:8080", lambda: AccessToken.empty())

alg_params = {"field1": {"field2": 1, "field3": "abc"}, "field4": "cde"}

# create a run
new_run = client.create_run(
    algorithm_parameters=alg_params,
    algorithm_name="test-algorithm",
    custom_configuration=SdkCustomRunConfiguration.create(version="v1.2.3"),
    tag="test-py-sdk",
)

print(f"Run id: {new_run}")

for result in client.get_run_results("abc"):
    print(result)

Nexus Development Framework

Apart from API clients for Nexus, SDK ships a development framework under nexus subpackage. It allows to create production-grade, asyncio-native ML/AI solutions that use a unified structure and are compose of objects and object relations, rather than methods. Nexus turns ML/AI apps into standard Python applications and removes the common noise found in notebook- type code, such as variable reassignment, frequent data copying due to lack of reusable code, copy-paste of code etc.

Nexus's design makes life even easier when using AI code generation, as it is essentially a framework an AI agent can follow to generate a working data science pipeline. Nexus takes care of result accounting, error handling, logging, metric reporting and, most importantly, execution flow. A key feature in Nexus is automatic resolution of execution graph via dependency injection. In essence, a developer just needs to specify which inputs are required for an algorithm to run, and provide class implementations for this, and Nexus will take care of the rest. This also implies that whether an IO operation happens, such as a database read or a file load, Nexus will utilize asyncio coroutines to run multiple IO ops in parallel, significantly increasing the execution speed, without any need for a developer to understand async programming.

For a example of how to use Nexus, take a look at a Sample Algorithm and a corresponding test configuration and a test itself.

Execution tree

Nexus provides a set of utilities that allow viewing and inspecting the execution tree:

from nexus_client_sdk.nexus.execution.trees import get_tree
from tests.algorithms.minimalistic.minimalistic_algorithm_sample import TestMinimalisticAlgorithm

print(get_tree(TestMinimalisticAlgorithm).serialize())

# graph TB
# TESTMINIMALISTICALGORITHM["TestMinimalisticAlgorithm"] --> XYPROCESSOR["XYProcessor"] --> XYREADER["XYReader"]
# TESTMINIMALISTICALGORITHM["TestMinimalisticAlgorithm"] --> ZPROCESSOR["ZProcessor"] --> ZREADER["ZReader"]

Handling Compressed Payloads

Nexus supports reading compressed payloads for efficient data transfer. When a payload is compressed, it must include both the compressed content and a reference to the decompression function.

Payload Structure

A compressed payload should be a json with the following keys:

  • content: The compressed data (as a base64-encoded string).
  • decompressor_import_path: The Python import path to the decompression function.

Example:

{
    "content": "SGVsbG8gd29ybGQ=",  # base64-encoded string of compressed bytes
    "decompressor_import_path": "my_module.my_decompress",
}

When Nexus receives such a payload, it will:

  1. Base64-decode the content field to obtain the compressed bytes.
  2. Dynamically import and call the function specified by decompressor_import_path to decompress the payload.
  3. Use the decompressed data as the actual payload for the algorithm.

This mechanism allows for flexible, pluggable decompression logic, as long as the function path is importable and callable in the runtime environment.

Automatic Payload Compression

Nexus can automatically compress and decompress payloads when using RemoteAlgorithm. To use this feature, you must first configure it with environment variables and then explicitly enable it in your RemoteAlgorithm implementation.

Step 1: Configuration (Environment Variables)

First, you need to provide the Python import paths for your compression and decompression logic. Setting these environment variables allows Nexus to create an injectable Compressor service.

  • NEXUS__REMOTE_ALGORITHM__COMPRESSION_IMPORT_PATH: The import path to your compression function (e.g., my_module.my_compress).
  • NEXUS__REMOTE_ALGORITHM__DECOMPRESSION_IMPORT_PATH: The import path to your decompression function (e.g., my_module.my_decompress).

Step 2: Enabling Compression in Your Algorithm

Once the environment variables are set, you can activate compression on a RemoteAlgorithm instance by providing two arguments during its initialization:

  1. compress_payload=True: This boolean flag signals your intent to use compression for this remote algorithm.
  2. compressor=<injected_compressor_instance>: You must inject the Compressor service that Nexus creates from your environment variables.

Important Requirement

For compression to work, both conditions must be met. The application will raise an error if compress_payload is set to True but a valid Compressor instance is not injected. Ensure that the required environment variables are set so the Compressor service can be created and injected successfully.

Providing Custom Client Factories

Nexus ships built-in factories for common clients (TrinoClientFactory, MlflowClientFactory, ...), each turning NexusConfigurationModel settings into a client instance bound into the DI container. You can register your own factories the same way, without writing a full DI Module.

Step 1: Implement a factory

Extend ClientFactory, parameterized with the client type and the payload type, and implement get_client:

from nexus_client_sdk.nexus.abstractions.client_factory import ClientFactory
from nexus_client_sdk.nexus.configurations.configuration_model import NexusConfigurationModel


class MyClient:
    def __init__(self, host: str):
        self.host = host


class MyClientFactory(ClientFactory[MyClient, MyPayload]):
    @classmethod
    def get_client(cls, model: NexusConfigurationModel, payload: MyPayload) -> MyClient:
        return MyClient(host=payload.host)

Step 2: Register the factory in configuration

Add an entry to [[runtime.additional_factories]], providing import paths for both the factory and the client type it returns. The client type is used as the DI binding key, so algorithm classes can request MyClient via constructor injection.

[[runtime.additional_factories]]
factory_class = "my_module.MyClientFactory"
client_class = "my_module.MyClient"

Factories are activated only after the algorithm class and the payload are fully resolved. This includes payload types coming from [runtime.payload], from a bootstrap payload (bootstrap_type_name) that is morphed into the runtime payload, and from an algorithm resolver. get_client therefore receives the final payload instance. The configuration model it receives is the bare NexusConfigurationModel, the same one used by the other built-in factories, and not a custom model set via set_configuration_model. Factories that do not need the payload can ignore it.

Metadata

Release files for nexus-client-sdk 1.10.0

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

Built distributions (wheels)

Table of built distributions (wheels) for nexus-client-sdk 1.10.0
File Interpreter ABI Platform Actions
nexus_client_sdk-1.10.0-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details for nexus_client_sdk-1.10.0-cp311-cp311-manylinux_2_28_x86_64.whl
nexus_client_sdk-1.10.0-cp311-cp311-manylinux_2_28_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ ARM64 Details for nexus_client_sdk-1.10.0-cp311-cp311-manylinux_2_28_aarch64.whl
nexus_client_sdk-1.10.0-cp311-cp311-macosx_13_0_arm64.whl CPython 3.11 CPython 3.11 macOS 13.0+ ARM64 Details for nexus_client_sdk-1.10.0-cp311-cp311-macosx_13_0_arm64.whl

Total release size: 44.0 MB

Release files / nexus_client_sdk-1.10.0-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL nexus_client_sdk-1.10.0-cp311-cp311-manylinux_2_28_x86_64.whl
Size 18.9 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
2b700fed3b54e3dab2fef527ebf49a82ed6179d437d56aa72539e11c799ece71
BLAKE2b-256 checksum
How to use checksums
e48e78f76b9d2b8c8e31ba9a0a15915e0a8e09003ec010fbce357301f9fc94de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 Nov 10, 2026.

Transparency log

Release files / nexus_client_sdk-1.10.0-cp311-cp311-manylinux_2_28_aarch64.whl

Download URL nexus_client_sdk-1.10.0-cp311-cp311-manylinux_2_28_aarch64.whl
Size 16.9 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
1113f7db366d50f4ff988809e204edeb7ddc76eef447703d1ea884645f4d628c
BLAKE2b-256 checksum
How to use checksums
07afe9fc3303b3eda075469be8267798f85466229471089e7a84f26693e4fbba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 Nov 10, 2026.

Transparency log

Release files / nexus_client_sdk-1.10.0-cp311-cp311-macosx_13_0_arm64.whl

Download URL nexus_client_sdk-1.10.0-cp311-cp311-macosx_13_0_arm64.whl
Size 8.2 MB
Tags CPython 3.11 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
ac540af4a00e0b491698d9cb97d1ab010005ddf2a9323e7ad3068cd8fd6351e6
BLAKE2b-256 checksum
How to use checksums
c0aaeff797ac293f6285fc8e5f04c958c96152308e709b22dd15f87e66ecd0b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 Nov 10, 2026.

Transparency log

Security for nexus-client-sdk 1.10.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.

Full provenance

All 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for nexus_client_sdk-1.10.0-cp311-cp311-manylinux_2_28_x86_64.whl

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 Nov 10, 2026.

Transparency log

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

1.10.0 This release

3 release files Full 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