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.22-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.22-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.22-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.22-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.22-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.22-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.22-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pynari-1.0.22-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1d76592c502be7d1cb157ec42d19dd7d218b0aa599f33e8fa22d6c939f5c30c8
MD5 44fac967d45c1f93b0561acd1650c07c
BLAKE2b-256 2ba9a9798c255059c34890af5aef531db49dbc44ba5cfd2a1796c4e3c447cf1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pynari-1.0.22-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e5624a618e1177a8b4bc8ffaa6ced56d980141a69f47ed397ba4113fcc8a3ff1
MD5 032b0274381dadbca45855ad345eb54a
BLAKE2b-256 7b409a28849cb62febb5538c9d4bff7628d28bac93a724d8bc45883c2c20489a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pynari-1.0.22-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bb91e25bdfd1a219967b5989dcef3160949967fae2c05e2e5ceb265d61b3c8f6
MD5 08d2cb33d431aa274af52dcc1b956a71
BLAKE2b-256 a48e15077f5c2cd6c1bb2e2b2236f76eb905051b8c934982c98194f6cffdc93e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pynari-1.0.22-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7a7313a916bb83b3ecfc64839f2c1fd76cd173e0a8c731fdbfab964375105373
MD5 c4462c008c0025dd3fc04825ed69c617
BLAKE2b-256 a55d5928fc7e4fa046bf06fdb126d7e3f7a5c2b6ada30d8d123570799c027635

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pynari-1.0.22-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 dfc3162426cf81fd123ae38dd84472d24223afc50a0b3f3559ee15e8ed086e70
MD5 017ea79b55995bc5ed9a544126f9e095
BLAKE2b-256 c272696fd82e5b661349011a15fcd96ec4d7eb8983cccb4d40b8dae48bf326fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pynari-1.0.22-cp38-cp38-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 59a9ed0b719eba18f14c684749ec94834c959d5310a5c5a8668b38761126da9f
MD5 ef695dabc8084b99703a4517ad130114
BLAKE2b-256 7f939e0a346f94c143252d652d94161ee4e3d6b41f56daab1b9943f8d9f4fe9e

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