Skip to main content

An easy-to-use Python wrapper for the Vulkan API registry.

Project description

Vulkan Object Python Package

Parsing the vk.xml in Vulkan is easy, processing it is hard!

It is very easy for people to mess up trying to process the vk.xml file, so we created VulkanObject

VulkanObject is just a python dataclass that is defined in Vulkan-Headers/registry/vulkan_object.py. It uses the reg.py framework that the Vulkan Spec is generated with in order to populate the VulkanObject data structure.

This python package makes it super easy to get going.

pip install vulkan-object

and then it is as simple as

#!/usr/bin/env python3
from vulkan_object import get_vulkan_object

# This builds the VulkanObject that is populated and ready to be used
vk = get_vulkan_object()

print(f'There are now {len([x for x in vk.extensions.values()])} extensions in Vulkan')

print(f'Built with the {vk.headerVersion} headers')

longest_count = 0
for struct in vk.structs.values():
    if len(struct.name) > longest_count:
        longest_count = len(struct.name)
        longest_struct = struct
print(f'Longest Struct name is {longest_struct.name} at {longest_count} characters')

Quick query from the terminal

Just run the following and you can quickly use vk in your terminal for some quick query

python -i -c "from vulkan_object import get_vulkan_object;vk = get_vulkan_object()"

More example

example.py has more in depth ways to use this

What is this package/repo actually?

The Vulkan-Headers contain a bunch of scripts in the Vulkan-Headers/registry/ directory that repos can use to help generate code.

The main issue is the delivery mechanism for python projects. This package/repo just grabs the Vulkan-Headers scripts (not the C header files themselves!) and make it easier to integrate with projects.

Updating this repo

run python update.py /path/to/Vulkan-Headers and it will do everything to sync this package up with the new headers

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

vulkan_object-1.4.325.tar.gz (354.1 kB view details)

Uploaded Source

Built Distribution

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

vulkan_object-1.4.325-py3-none-any.whl (363.1 kB view details)

Uploaded Python 3

File details

Details for the file vulkan_object-1.4.325.tar.gz.

File metadata

  • Download URL: vulkan_object-1.4.325.tar.gz
  • Upload date:
  • Size: 354.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for vulkan_object-1.4.325.tar.gz
Algorithm Hash digest
SHA256 a25eebb37b22f4af715138d500b5c7b1235732b9459706e0c8b5840224103e43
MD5 4fcc0807f2f6bf2cf1ea2d4e43199985
BLAKE2b-256 1c4df83327dc76796a8fd8f236c39398f4d8e88ac40811f406287408032551f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for vulkan_object-1.4.325.tar.gz:

Publisher: publish.yml on KhronosGroup/vulkan-object

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vulkan_object-1.4.325-py3-none-any.whl.

File metadata

  • Download URL: vulkan_object-1.4.325-py3-none-any.whl
  • Upload date:
  • Size: 363.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for vulkan_object-1.4.325-py3-none-any.whl
Algorithm Hash digest
SHA256 2f1f869a6be9d8c12354cef2b7243ba4e460ec67aff3ec7099c4ef4208a60f88
MD5 ae993c15693cfdd5c65aa0a5b3e066d1
BLAKE2b-256 53e8862135a460951fc03a0163e533a2fd93003f516a70b58319e630fbc9af78

See more details on using hashes here.

Provenance

The following attestation bundles were made for vulkan_object-1.4.325-py3-none-any.whl:

Publisher: publish.yml on KhronosGroup/vulkan-object

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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