Rust client and Python bindings for the NERSC IRI API
Project description
iri-client
Rust client + Python bindings for the NERSC IRI API OpenAPI 3.1
spec in openapi/openapi.json.
Python Bindings
Install from PyPI:
pip install iri-client
or build the extension module locally:
# Use maturin >= 1.9.4
maturin develop --features python
Python operation examples
import json
from iri_client import Client
client = Client(base_url="https://api.iri.nersc.gov")
# List operation ids
operations = Client.operations()
print(f"Loaded {len(operations)} operations from generated catalog")
print("First 10 operations:")
for operation in operations[:10]:
print(f" - {operation.operation_id} ({operation.method} {operation.path_template})")
# Public operation
print(client.call_operation("getFacility"))
# Path params
print(
client.call_operation(
"getSite",
path_params_json=json.dumps({"site_id": "dd7f822a-3ad2-54ae-bddb-796ee07bd206"}),
)
)
# Auth-required operation
# access_token = "<token from GlobusAuth>"
# auth_client = Client(base_url="https://api.iri.nersc.gov", access_token=access_token)
# print(auth_client.call_operation("getProjects"))
Full runnable Python operation script:
examples/python_module_example.pyexamples/python_async_module_example.py(async withAsyncClient)examples/submit_job.py(submit a job to IRI api and monitor status)
Authentication Model
This API uses header Authorization with the raw access token value:
Authorization: <access_token>
This client follows that behavior when you call with_authorization_token(...)
or pass access_token=... to the client's constructor in Python.
Runnable Cargo Examples
These are checked-in Rust examples you can run directly:
# Lists generated operation ids/methods/paths (no network calls)
cargo run --example blocking_list_operations
# Calls getResources with query parameters
cargo run --example blocking_get_resources
# Same example with custom base URL and limit
IRI_BASE_URL=https://api.iri.nersc.gov IRI_RESOURCE_LIMIT=10 \
cargo run --example blocking_get_resources
# Calls auth-required getProjects
IRI_ACCESS_TOKEN=<access-token> cargo run --example blocking_get_projects
# Async IriClient examples
cargo run --example async_get_resources
IRI_ACCESS_TOKEN=<access-token> cargo run --example async_get_projects
# Async ApiClient example (raw path + query)
cargo run --example async_api_client_sites
CLI Tool
A small CLI binary iri-cli is included. One can install it through cargo. It is
currently not distributed in the python package.
cargo install iri-client --features cli
Here are a few examples on how to use the cli client.
# Show generated operations
iri-cli operations
# Filter operation ids
iri-cli operations --filter Job
# Call by OpenAPI operation id with query params
iri-cli call getResources --query group=perlmutter --query resource_type=compute
# Call operation with path params
iri-cli call getSite --path-param site_id=<site-id>
# Raw method/path request
iri-cli request GET /api/v1/facility/sites --query limit=5
# Authenticated operation
IRI_ACCESS_TOKEN=<access-token> \
iri-cli call getProjects
Rust Examples (OpenAPI Operation Client)
Use IriClient when calling by OpenAPI operationId.
Public endpoint: getFacility
use iri_client::IriClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = IriClient::from_openapi_default_server()?;
let facility = client
.call_operation("getFacility", &[], &[], None)
.await?;
println!("{facility}");
Ok(())
}
Query parameters: getResources
use iri_client::IriClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = IriClient::new("https://api.iri.nersc.gov")?;
let resources = client
.call_operation(
"getResources",
&[],
&[("limit", "10"), ("offset", "0"), ("resource_type", "compute")],
None,
)
.await?;
println!("{resources}");
Ok(())
}
Path parameter: getSite
use iri_client::IriClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = IriClient::new("https://api.iri.nersc.gov")?;
let site = client
.call_operation("getSite", &[("site_id", "dd7f822a-3ad2-54ae-bddb-796ee07bd206")], &[], None)
.await?;
println!("{site}");
Ok(())
}
Auth-required endpoint: getProjects
use iri_client::IriClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let access_token = std::env::var("IRI_ACCESS_TOKEN")?;
let client = IriClient::new("https://api.iri.nersc.gov")?
.with_authorization_token(access_token);
let projects = client
.call_operation("getProjects", &[], &[], None)
.await?;
println!("{projects}");
Ok(())
}
Rust Examples (Generic REST Client)
Use ApiClient when you want direct method/path control.
use iri_client::ApiClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = ApiClient::new("https://api.iri.nersc.gov")?;
let sites = client
.get_json_with_query("/api/v1/facility/sites", &[("limit", "5"), ("offset", "0")])
.await?;
println!("{sites}");
Ok(())
}
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iri_client-0.1.2.tar.gz.
File metadata
- Download URL: iri_client-0.1.2.tar.gz
- Upload date:
- Size: 45.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c6bbf8bdc3bfa6e150b49bd0cc0767f93fd650b3cbd1f17fee52ab493f9e629
|
|
| MD5 |
d0bf885aee127c2442b401a9aca0de2e
|
|
| BLAKE2b-256 |
b340d61278eb680e1ec529ab90e48f754e648dd074ae1ecf53dd8424a5286cf8
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-win_arm64.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-win_arm64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.9+, Windows ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8715afdeae34b69572b5c1c3140d0a7b025b4d17578aaf34af52764a672a3ba6
|
|
| MD5 |
e81c7a13e353b21b0fab781426424b82
|
|
| BLAKE2b-256 |
9c5331681e7a3738a2b4595b9975de8e337bff7189c8c7ba546ef88444ab055f
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
126042d5b79998ccd9451d7b2fd084aec3a31b89dca51988f9b22df4124a853a
|
|
| MD5 |
20fea05584845584f2959092b3d6a3f6
|
|
| BLAKE2b-256 |
084a9fa62830961ee25ce452eb6f3b1129f29c3f0500a7b02a505b5661cb06a9
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-win32.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-win32.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.9+, Windows x86
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56c65f08a4eac57c62699d5843089c3a5c7cfdece003ec4245146a6753aed382
|
|
| MD5 |
02bb66ee9aa602a225931e31015a9903
|
|
| BLAKE2b-256 |
9b8d987ab3169698828f0f24e1ce7ea242d42db9c0f6c568a1b8b0a18ab5035e
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a7694597cc81570d6d06731bae65dbe393f8b39e678dd475d1f95ed1a43a8da
|
|
| MD5 |
6e458df21528616f0006a03736662cd7
|
|
| BLAKE2b-256 |
c63b629142639ef3e48f3462f5eb6d996b9ab501c132fd40f66a58ead4cc96dd
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-musllinux_1_2_i686.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-musllinux_1_2_i686.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ i686
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ecd2e7beab0715c1c353633acd05f3389ca4a25950ce3f253d3b8febee6eefd
|
|
| MD5 |
7eaa066cbf20a6fd836d8d66b4e55592
|
|
| BLAKE2b-256 |
510b4a39dfcbb083943263504bc564280a7864e47841f17908f60275d684d851
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-musllinux_1_2_armv7l.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-musllinux_1_2_armv7l.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ ARMv7l
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
882f0030e394a915ce1e381d5013c13cb5dd09a1a4424fc6985d64087b2ea1d1
|
|
| MD5 |
67e3d28b322bbe419b4cdfd6627ed178
|
|
| BLAKE2b-256 |
7aff40e4cc8d1c19c2ddf54fdce7e2c49f2e28bc085b52be08c273922d0270fb
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4a401874c99e559b44188292bb62c0e9103032e59cb3682420df868b2a56518
|
|
| MD5 |
a4469dff5e717eea1ff1ea09a6df45e2
|
|
| BLAKE2b-256 |
e73d3f1f5540a8f4d215dd947a6ba0cfae03da037f8bbbeee6cf1bfad90df230
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.9+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
133bcbb240b673b992460dbfacbd81475c80f756a5c0722b26dd3f4c121b27b9
|
|
| MD5 |
ecdf73d6f57a613067214409d3318706
|
|
| BLAKE2b-256 |
1c9162fda16d7c3f54d8ea26959c4b7019063417dfadc3dd15c22c9d1970f83b
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-manylinux_2_28_s390x.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-manylinux_2_28_s390x.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.9+, manylinux: glibc 2.28+ s390x
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
388c7baf7c8ad46888d0d1c78bf8aff584d8d0e38ba900d1f74af9804bd8be7e
|
|
| MD5 |
c80c2da0aa0a78d0ab504a5a873d600a
|
|
| BLAKE2b-256 |
0b53134dd86a66a8eb75231eb4ecd076c234d021952c3df9a041c387b0235901
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-manylinux_2_28_ppc64le.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-manylinux_2_28_ppc64le.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.9+, manylinux: glibc 2.28+ ppc64le
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
497950029749ebec5eebd59bf852db667ae6215a8cb18c361746b7dadc03aab6
|
|
| MD5 |
c3d6860e979b8f3ed6106b251a81b43f
|
|
| BLAKE2b-256 |
4c788a60203e1653ba7ea7c0196fad36b81faa721f4777214ec7486a302c7d18
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-manylinux_2_28_i686.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-manylinux_2_28_i686.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.9+, manylinux: glibc 2.28+ i686
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
363fdb61ab950621a092ad49e213ce1245ce7966a2a1d234f86e0e703941f5f5
|
|
| MD5 |
d1c2d0d41786c26d103cfb83a9486c81
|
|
| BLAKE2b-256 |
031df1ae6188afd268036554122304270371e11a09b750eef1cea3893f2ae24c
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-manylinux_2_28_armv7l.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-manylinux_2_28_armv7l.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.9+, manylinux: glibc 2.28+ ARMv7l
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11b5dfcf04cd147e5a0787b71e8ba8960ec2ace11f9769102632317dcb4a2a61
|
|
| MD5 |
a84434e3cd21dcd69b3b00e29d9b8596
|
|
| BLAKE2b-256 |
502ec61a2f3c45fd4001fcd875caef43ae5136038a93f17068d98ea37987231e
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.9+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e711dadfe0ef6f7388d4fe3f707dccc90a2b65944832704a527830217a073ec
|
|
| MD5 |
635cf1648da03ce530ead21f1301f96d
|
|
| BLAKE2b-256 |
c0185fba470d0486d641b843b3413d2a9ec5abeac8318d350116821be6b16903
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04e239eebcd2c14f47b3fd8b6a602129f1b925e575efb8482b121b94c5834e85
|
|
| MD5 |
648a0a03e44c091efde8e174cf86532c
|
|
| BLAKE2b-256 |
3632bf2ddf9883817b1dd3f05bf8746ee29c86a6e7cf03903a81a1dff5d68cb2
|
File details
Details for the file iri_client-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: iri_client-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cad95283926a6ebdf6ba122630be8edcb945883392ed9ff5dedbe73a217b65d
|
|
| MD5 |
ba8de1ff628980bbf4dbee35e3bd515e
|
|
| BLAKE2b-256 |
85e8e3f7552a1f484de88d2f5d4564c3178300032a75dc211da37bf4f590fedd
|