Skip to main content

Python bindings for ANARI

Project description

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 to select between different back-ends, but is currently ignored)

You can then create various ANARI 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.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pynari-1.0.21-cp313-cp313-manylinux_2_34_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

pynari-1.0.21-cp312-cp312-manylinux_2_34_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

pynari-1.0.21-cp311-cp311-manylinux_2_34_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

pynari-1.0.21-cp310-cp310-manylinux_2_34_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

pynari-1.0.21-cp39-cp39-manylinux_2_34_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

pynari-1.0.21-cp38-cp38-manylinux_2_34_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.34+ x86-64

File details

Details for the file pynari-1.0.21-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pynari-1.0.21-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4af40181ec0e4c61656a95e089da5d15ba7aa0865486f34b6391d43ea7e373d8
MD5 734b39350816047719253dfa4dc3faba
BLAKE2b-256 0977ab6718ad28bcb5ea7deed37ce2dce03b550261f4c2ebb142eca9e1724186

See more details on using hashes here.

File details

Details for the file pynari-1.0.21-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pynari-1.0.21-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8245d03682dec940529ea83b02fe02d9eeaeebb8eec47e274e4f1a0de6a7e81f
MD5 0469c9dad166dc49bc294da532bdc02e
BLAKE2b-256 47f5b659cff4427541e21b9e64ed560fe36a29451be4d2798482167894f444cb

See more details on using hashes here.

File details

Details for the file pynari-1.0.21-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pynari-1.0.21-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 67bb6ca29498c107ef659017442cae4c8069b981a9ef16bf59736c692054eb50
MD5 9a6a57203f775e727613d0a911a1f4df
BLAKE2b-256 36be938db01d26459350b7a6dff14d163b8dd965309295241fe82e3e643b3e24

See more details on using hashes here.

File details

Details for the file pynari-1.0.21-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pynari-1.0.21-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3ad06e08c1edb64e7b5c6f251da64f2fb3875830e969681d055a450707ea2000
MD5 0e575cb1f965f2b68ed76ace1af0e6c8
BLAKE2b-256 7c0befeac8c0a6b19a2f4c4d95eccbe96f2cbf04a173553e107d0b30bd7cb414

See more details on using hashes here.

File details

Details for the file pynari-1.0.21-cp39-cp39-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pynari-1.0.21-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c62c5b069ca91e5fb7ed33259c1d64b828823cb44b398c6820e4df9979e0c865
MD5 ec9aceab97ec5ad2935e1cd3e5447ca8
BLAKE2b-256 18c1f7351a63ee820f2fff511deb7774e10abdf45d7f81b367b4feb05bd63f5f

See more details on using hashes here.

File details

Details for the file pynari-1.0.21-cp38-cp38-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pynari-1.0.21-cp38-cp38-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5c28f3e2d0f8a586d1e4ef8967d1c47c4c2a24d9baa9dd0be2de38890ca70696
MD5 42966f4bfc6c8c98af871d60a19e7571
BLAKE2b-256 17cc737823250bcec3ac998324378aa0d70543e1766fef297cc13348aaaaf68a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page