Skip to main content

pynari - Python Bindings for ANARI

This project provides a python interface for the Khronos ANARI rendering API. This implementation currently requires a CUDA capable GPU (support for other backends will be added at a later time).

Usage - Quickstart

Assuming you already know how the ANARI API works (and that you have pip-installed this package) you can use ANARI in python as follows: First, import this package

import pynari as anari

(for all the steps below we assume you imported pynari as anari; this is not required, but please take this in mind for the examples below).

Once the package has been imported you can then create a ANARI "device" using

device = anari.newDevice('default')

(the 'default' will later allow for selecting between different back-ends, but this current implementation is hard-coded to the 'barney' backend, see https://github.com/ingowald/barney).

You can then create various ANARI actor objects through creator-methods on that device, such as, for example

world = device.newWorld()
mesh  = device.newGeometry('triangle')
array = device.newArray(anari.FLOAT32_VEC3,vertex)

etc.

Large arrays (such as vertex or index arrays for a triangle mesh) are expected to be populated using numpy, and wrapped in the ANARI 'array' type:

import numpy as np
...
vertex = np.array(...,dtype=np.float32)
mesh.setParameter('vertex.position',anari.ARRAY,
                  device.newArray(anari.FLOAT32_VEC3,vertex));
index  = np.array(...,dtype=np.uint32)
mesh.setParameter('primitive.index',anari.ARRAY,
                  device.newArray(anari.UINT32_VEC3,index));

The ANARI API, and how it is exposed in pynari

For a full description of what ANARI Objects are, what kind of objects exist, and how they work, please refer to the ANARI API Spec at https://registry.khronos.org/ANARI/specs/1.0/ANARI-1.0.html .

Since the official ANARI API is a plain C API we could not implement this literally, but had to make certain changes to make ti more "pythonic". Basically, these rules were applied (we will assume that the pynari module was imported under the alias as anari):

  • If there is a C constant/enum of name ANARI_XYZ, it is exposed as anari.XYZ. Example: the C enum of ANARI_FLOAT32 is anari.FLOAT32 in pynari.

  • If there is a C API function of anariFunctionXyz(ANARIDevice device, ...) it will be exposed as device.functionXyz(...). Note that in order to remain as close to the C-style API as possible we use CAML-case for function names, not python-casing. I.e., pynari uses device.functionXyz(...), not device.function_xyz(...).

Examples

For a list of several samples, please visit the pynari github repo https://github.com/ingowald/pynari

For any issues, please use the github pynari issue tracker.

Release files for pynari 1.4.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 pynari 1.4.0
File
pynari-1.4.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
pynari-1.4.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
pynari-1.4.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
pynari-1.4.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
pynari-1.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
pynari-1.4.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
pynari-1.4.0-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
pynari-1.4.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details

Total release size: 84.4 MB

Release files / pynari-1.4.0-cp313-cp313-win_amd64.whl

Download URL pynari-1.4.0-cp313-cp313-win_amd64.whl
Size 16.8 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
84f46491033884902d3d261357fd6fda1cae2634b21e97bacf666366f1bf53b6
BLAKE2b-256 checksum
How to use checksums
f8028e6c5df40be383242a1b49dd5b221f4b1a88545b14cd780e13dca6879294
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pynari-1.4.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pynari-1.4.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.8 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
02f29f5b35aeb6f1cff60338ac044bde911e251471d8aafa6d7fc0005a75f432
BLAKE2b-256 checksum
How to use checksums
079870668d656e49b355cd177d78133eb6bdfc6789220b9fd20c373186a43bae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / pynari-1.4.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL pynari-1.4.0-cp313-cp313-macosx_11_0_arm64.whl
Size 8.3 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
97dc9a34897819971e68b59c340e4284b8ebac8fa55d47adf384cf6552daf6dc
BLAKE2b-256 checksum
How to use checksums
95d1477ae4ade03d69077364ba0986c130f7dcd60bec4ced5868ad96260aa95b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / pynari-1.4.0-cp312-cp312-win_amd64.whl

Download URL pynari-1.4.0-cp312-cp312-win_amd64.whl
Size 16.8 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
78ffe5e68782e91b9f68e2e92cd884f9b355eff354727cac1d5e49a02717ed20
BLAKE2b-256 checksum
How to use checksums
c2f7c800e101ea885306b9cc5b8d38a283c7ea8e3d5e502a85cfe406708837d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pynari-1.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pynari-1.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.8 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
fda768739d8fca7726dd55991cc36f03788892d8c5c8f28f73e8d14f8cd14ff6
BLAKE2b-256 checksum
How to use checksums
715f64c366b5df50fcf464ef26d1bfd4b3b87abefa4c0c2cb10e7a17f609b741
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / pynari-1.4.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL pynari-1.4.0-cp312-cp312-macosx_11_0_arm64.whl
Size 8.3 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4235590306a39d7db42836212876ea69efa296b2da9821dcddbda07a92993b69
BLAKE2b-256 checksum
How to use checksums
4b2581daacab5eabdfee628753b4fc14181da0dc01ade801b0585ce35406fd5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / pynari-1.4.0-cp39-cp39-win_amd64.whl

Download URL pynari-1.4.0-cp39-cp39-win_amd64.whl
Size 16.8 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
956118e7eec02c87014c34a26516609b0ba3229d7404481945ba975bb9a29a9d
BLAKE2b-256 checksum
How to use checksums
6af31349e86e268833251740cb385756e9c1ad76eb0d3abb72ca716ecef4c8fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pynari-1.4.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pynari-1.4.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.8 MB
Tags CPython 3.9 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ea1b477e771b56a23cb0257e8cd9c09d7ad83688080a4c2b6f19293e6814df16
BLAKE2b-256 checksum
How to use checksums
506ecba596b85ac66172334a1f429d222e43728d9438eea32671da83cf025d36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

1.4.0 This release

8 release files

1.3.2

2 release files

1.3.1

3 release files

1.3.0

3 release files

1.2.9

7 release files

1.2.8

5 release files

1.2.6

11 release files

1.2.4

10 release files

1.2.2

3 release files

1.1.3

2 release files

1.1.2

12 release files

1.0.39

6 release files

1.0.36

8 release files

1.0.13

1 release file

1.0.7

1 release file

1.0.2

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