openshell 0.1.10


pip install openshell

  Latest version

Released: Nov 24, 2026


Meta
Author: NVIDIA Inc.
Requires Python: >=3.11

Classifiers

Intended Audience
  • Developers
  • Science/Research
  • Information Technology

Programming Language
  • Python :: 3
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14

Topic
  • Security
  • Scientific/Engineering
  • Scientific/Engineering :: Artificial Intelligence

Operating System
  • POSIX :: Linux
  • MacOS :: MacOS X
OpenShell

Python SDK for OpenShell

License PyPI Security policy Documentation

Use the Python SDK to manage OpenShell sandboxes from applications, notebooks, and automation. Create sandboxes, run commands and Python functions, and manage templates, workspaces, and provider credentials through the gateway.

See the Python SDK documentation for connection options, authentication, and generated gRPC bindings.

Installation

The SDK requires Python 3.11 or later and a running OpenShell gateway. Installing the openshell package installs only the Python client.

With uv, add the SDK to your project:

uv add openshell

Or install it with pip:

pip install -U openshell

Quickstart

Before running this example, start a gateway or register an existing running gateway. Then select it with the CLI. The SDK reuses its endpoint, TLS configuration, and authentication state.

from openshell import Sandbox

with Sandbox(workspace="default") as sandbox:
    result = sandbox.exec(["echo", "Hello from OpenShell"])
    print(result.stdout, end="")
    if result.exit_code != 0:
        raise RuntimeError(result.stderr)

Sandbox creates a sandbox, waits for readiness, and deletes it when the context exits. This example uses the gateway's default workload image and the default workspace.

Usage examples

Check SDK and gateway versions

Connect to the active gateway and print both versions:

import openshell
from openshell import SandboxClient

print(f"SDK version: {openshell.__version__}")
with SandboxClient.from_active_cluster() as client:
    print(f"Gateway version: {client.health().version}")

Pass cluster="my-gateway" to select a registered gateway by name. For OIDC gateways, the client refreshes expiring tokens and saves the updated token bundle by default.

List sandboxes

Sandbox operations require an explicit workspace. List methods return a lazy Pager, which fetches one page at a time:

from openshell import SandboxClient

with SandboxClient.from_active_cluster() as client:
    for page in client.list(workspace="default", page_size=100):
        for sandbox in page.items:
            print(sandbox.name, sandbox.id)

Use client.list_all(workspace="default") to collect every page into a list.

Run commands in an existing sandbox

Use sandbox to attach by name. Set delete_on_exit=False to keep the sandbox after the context exits:

from openshell import Sandbox

with Sandbox(
    workspace="default",
    sandbox="my-sandbox",
    delete_on_exit=False,
) as sandbox:
    result = sandbox.exec(
        ["sh", "-c", "echo Starting; ls /tmp"],
        stream_output=True,
        timeout_seconds=30,
    )
    print(f"Exit code: {result.exit_code}")

exec() returns an ExecResult with stdout, stderr, and exit_code. With stream_output=True, it also prints output as it arrives.

Authenticate service automation

For an OIDC gateway that supports the OAuth client credentials flow, supply a renewable authentication provider:

import os

from openshell import ClientCredentialsAuth, SandboxClient

auth = ClientCredentialsAuth(
    issuer="https://idp.example.com/realms/openshell",
    client_id="openshell-service",
    client_secret=lambda: os.environ["OPENSHELL_OIDC_CLIENT_SECRET"],
    audience="openshell-gateway",
)

with SandboxClient.from_active_cluster(client_credentials=auth) as client:
    print(client.health().version)

Configure the issuer, client ID, and audience for your identity provider. Non-loopback gateway connections using client credentials require TLS. See gateway authentication for setup.

Documentation

  • Python SDK guide: connections, provider credentials, and generated RPCs.
  • Sandboxes: lifecycle, workload images, and templates.
  • API errors: structured gateway errors and error handling.

The package includes generated gRPC bindings under openshell._proto for access to the underlying gateway API. SandboxClient is synchronous; generated stubs support synchronous and asynchronous gRPC channels.

Supported core versions

Use SDK and gateway versions from the same OpenShell release when possible. SDK releases follow core releases: SDK X.Y.Z is built from core vX.Y.Z.

The generated bindings currently target core v0.1.7, pinned by OPENSHELL_CORE_REF in mise.toml.

Contributing

See CONTRIBUTING.md for development setup, checks, end-to-end tests, and release conventions. The project uses mise for tools and uv for Python dependencies.

Report vulnerabilities through the security policy.

Repository history

The SDK moved from NVIDIA/OpenShell to this repository. The PyPI package name, import paths, and API are unchanged, including openshell._proto. Earlier releases remain available on PyPI.

History through core v0.1.7 was imported from NVIDIA/OpenShell. The extraction and verification scripts are preserved under hack/migration at the migration/v0.1.7 tag.

License

Apache-2.0.

0.1.10 Nov 24, 2026
0.1.9 Nov 17, 2026
0.1.8 Nov 10, 2026
0.1.7 Nov 03, 2026
0.1.6 Oct 28, 2026
0.1.5 Oct 20, 2026
0.1.4 Oct 13, 2026
0.1.3 Oct 09, 2026
0.1.2 Sep 28, 2026
0.1.1 Sep 26, 2026
0.1.0 Sep 25, 2026
0.0.116 Aug 28, 2026
0.0.115 Aug 27, 2026
0.0.113 Aug 25, 2026
0.0.111 Aug 21, 2026
0.0.110 Aug 20, 2026
0.0.109 Aug 19, 2026
0.0.106 Aug 14, 2026
0.0.105 Aug 13, 2026
0.0.104 Aug 12, 2026
0.0.103 Aug 11, 2026
0.0.102 Aug 10, 2026
0.0.101 Aug 07, 2026
0.0.99 Aug 05, 2026
0.0.98 Aug 04, 2026
0.0.97 Aug 03, 2026
0.0.96 Jul 31, 2026
0.0.92 Jul 27, 2026
0.0.91 Jul 24, 2026
0.0.90 Jul 23, 2026
0.0.89 Jul 22, 2026
0.0.88 Jul 21, 2026
0.0.86 Jul 17, 2026
0.0.85 Jul 16, 2026
0.0.83 Jul 14, 2026
0.0.82 Jul 13, 2026
0.0.80 Jul 09, 2026
0.0.79 Jul 08, 2026
0.0.78 Jul 07, 2026
0.0.77 Jul 06, 2026
0.0.76 Jul 03, 2026
0.0.75 Jul 02, 2026
0.0.74 Jul 01, 2026
0.0.73 Jun 30, 2026
0.0.72 Jun 29, 2026
0.0.71 Jun 26, 2026
0.0.70 Jun 25, 2026
0.0.69 Jun 24, 2026
0.0.68 Jun 23, 2026
0.0.67 Jun 22, 2026
0.0.66 Jun 18, 2026
0.0.65 Jun 17, 2026
0.0.63 Jun 15, 2026
0.0.62 Jun 12, 2026
0.0.59 Jun 09, 2026
0.0.58 Jun 08, 2026
0.0.57 Jun 05, 2026
0.0.56 Jun 04, 2026
0.0.55 Jun 03, 2026
0.0.54 Jun 02, 2026
0.0.53 Jun 01, 2026
0.0.52 May 29, 2026
0.0.51 May 28, 2026
0.0.50 May 27, 2026
0.0.47 May 22, 2026
0.0.46 May 21, 2026
0.0.45 May 20, 2026
0.0.44 May 19, 2026
0.0.42 May 15, 2026
0.0.41 May 14, 2026
0.0.40 May 13, 2026
0.0.39 May 12, 2026
0.0.38 May 11, 2026
0.0.37 May 08, 2026
0.0.36 Apr 23, 2026
0.0.35 Apr 22, 2026
0.0.34 Apr 21, 2026
0.0.33 Apr 20, 2026
0.0.32 Apr 17, 2026
0.0.31 Apr 16, 2026
0.0.30 Apr 15, 2026
0.0.29 Apr 14, 2026
0.0.28 Apr 13, 2026
0.0.26 Apr 09, 2026
0.0.25 Apr 08, 2026
0.0.24 Apr 07, 2026
0.0.23 Apr 06, 2026
0.0.22 Apr 03, 2026
0.0.21 Apr 02, 2026
0.0.20 Apr 01, 2026
0.0.19 Mar 31, 2026
0.0.16 Mar 25, 2026
0.0.15 Mar 24, 2026
0.0.14 Mar 23, 2026
0.0.13 Mar 21, 2026
0.0.12 Mar 20, 2026
0.0.11 Mar 19, 2026
0.0.10 Mar 18, 2026
0.0.9 Mar 17, 2026
0.0.7 Mar 17, 2026
0.0.6 Mar 16, 2026
0.0.0a0 Mar 10, 2026

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras: None
Dependencies:
cloudpickle (>=3.0)
grpcio (>=1.78.2)
googleapis-common-protos (>=1.63)
httpx (>=0.27)
protobuf (>=6.31.1)