{"id":33108114,"url":"https://github.com/realitix/vulkan","last_synced_at":"2025-12-14T16:44:06.635Z","repository":{"id":38184804,"uuid":"86040574","full_name":"realitix/vulkan","owner":"realitix","description":"The ultimate Python binding for Vulkan API","archived":false,"fork":false,"pushed_at":"2024-02-27T10:13:23.000Z","size":2954,"stargazers_count":553,"open_issues_count":16,"forks_count":51,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-11-19T18:03:52.191Z","etag":null,"topics":["python","vulkan"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/realitix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-24T07:40:36.000Z","updated_at":"2025-11-16T20:51:44.000Z","dependencies_parsed_at":"2024-01-03T06:42:36.813Z","dependency_job_id":"c97e7e51-30c6-4d02-9db4-fc6e36a58945","html_url":"https://github.com/realitix/vulkan","commit_stats":{"total_commits":129,"total_committers":12,"mean_commits":10.75,"dds":0.1472868217054264,"last_synced_commit":"a5549bccfcd009b62ea4a2143f31b49e011d761d"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/realitix/vulkan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realitix%2Fvulkan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realitix%2Fvulkan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realitix%2Fvulkan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realitix%2Fvulkan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/realitix","download_url":"https://codeload.github.com/realitix/vulkan/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realitix%2Fvulkan/sbom","scorecard":{"id":766555,"data":{"date":"2025-08-11","repo":{"name":"github.com/realitix/vulkan","commit":"3dff4903f98298d67c3b6659655a97bbd0231c64"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.1,"checks":[{"name":"Code-Review","score":2,"reason":"Found 6/28 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":1,"reason":"9 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2019-217 / GHSA-462w-v97r-4m45","Warn: Project is vulnerable to: PYSEC-2014-8 / GHSA-8r7q-cvjq-x353","Warn: Project is vulnerable to: GHSA-cpwx-vrp4-4pq7","Warn: Project is vulnerable to: PYSEC-2014-82 / GHSA-fqh9-2qgg-h84h","Warn: Project is vulnerable to: PYSEC-2021-66 / GHSA-g3rq-g295-4j3m","Warn: Project is vulnerable to: GHSA-h5c8-rqwp-cp95","Warn: Project is vulnerable to: GHSA-h75v-3vvj-5mfj","Warn: Project is vulnerable to: PYSEC-2019-220 / GHSA-hj2j-77xm-mc5v","Warn: Project is vulnerable to: GHSA-q2x7-8rv6-6q7h"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T01:00:26.638Z","repository_id":38184804,"created_at":"2025-08-23T01:00:26.638Z","updated_at":"2025-08-23T01:00:26.638Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27731504,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-14T02:00:11.348Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","vulkan"],"created_at":"2025-11-15T00:00:35.754Z","updated_at":"2025-12-14T16:44:06.613Z","avatar_url":"https://github.com/realitix.png","language":"C++","readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://cdn.rawgit.com/realitix/vulkan/182062bc/logo/cvulkan-180x180.png\" /\u003e\n\u003c/p\u003e\n\n\n\u003e *vulkan*, the ultimate Python binding for Vulkan API\n\n\n# Table of Contents\n\n  * [Presentation](#presentation)\n  * [How to install](#how-to-install)\n     * [Pip](#pip)\n     * [Manual install](#manual-install)\n  * [How to use](#how-to-use)\n     * [Getting started](#getting-started)\n     * [API](#api)\n     * [Code convention](#code-convention)\n        * [Structs](#structs)\n        * [Functions](#functions)\n        * [Exceptions](#exceptions)\n        * [Constants](#constants)\n     * [Resources](#resources)\n  * [How to contribute](#how-to-contribute)\n  * [Architecture](#architecture)\n  * [Community](#community)\n  * [Stay in touch](#stay-in-touch)\n  * [History](#history)\n  * [Supported By](#supported-by)\n\n## Presentation\n\n*vulkan* is a Python extension which supports the Vulkan API. It leverages power of Vulkan with simplicity of Python.\nIt's a complete Vulkan wrapper, it keeps the original Vulkan API and try to limit differences induced by Python.\n\n*vulkan* is compatible with Python 2 and Python 3.\n\n## How to install\n\n### Pip\n\nYou can install directly *vulkan* with pip:\n\n```\npip install vulkan\n```\n\n### Manual install\n\nYou can install it manually if you want the latest version:\n\n```\ngit clone https://github.com/realitix/vulkan\ncd vulkan\npython setup.py install\n```\n\n\n## How to use\n\n### Getting started\n\nTo try this wrapper, execute the following commands (on linux):\n\n```bash\ngit clone https://github.com/realitix/vulkan.git\ncd vulkan\npython setup.py install\npip install -r requirements.txt\npython example/example_sdl2.py\n```\n\nKnown errors :\n\n`OSError: cannot load library 'libvulkan.so'` means you didn't install the [Vulkan SDK](https://vulkan.lunarg.com/).\n\n`vulkan.VkErrorExtensionNotPresent` means your have installed the Vulkan SDK but your driver doesn't support it.\n\n`pip install vulkan` fails on Windows 10: Try `pip install --upgrade pip setuptools wheel` before installing `vulkan`.\n\n`Platform not supported` error: It's probably because your pysdl2 wrapper is using SDL3. To fix it, install `pysdl2-dll` in your venv.\n\n\n### API\n\nThe *vulkan* wrapper gives you complete access to the Vulkan API, including extension functions.\n\n\n### Code convention\n\nSimilar to Vulkan, structs are prefixed with Vk, enumeration values are prefixed with VK_\nand functions are prefixed with vk.\n\n\n#### Structs\n\nVulkan struct creation is achieved in *vulkan* wrapper using python functions.\nFor example, if you want to create the Vulkan struct `VkInstanceCreateInfo`,\nyou must initialize it with its keyword parameters. In *vulkan* wrapper, you will call\nthe Python function `VkInstanceCreateInfo` with named parameters as shown below.\n\nIn **C++** (Vulkan) we write:\n\n```C\nVkInstanceCreateInfo instance_create_info = {\n    VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, // sType\n    nullptr, // pNext\n    0, // flags\n    \u0026application_info, // *pApplicationInfo\n    3, // enabledLayerCount\n    \u0026layers, // *ppEnabledLayerNames\n    3, // enabledExtensionCount\n    \u0026extensions // *ppEnabledExtensionNames\n};\n```\n\nOur *vulkan* wrapper equivalent of the above **C++** code is :\n\n```python\nimport vulkan as vk\n\ninstance_create_info = vk.VkInstanceCreateInfo(\n    sType=vk.VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,\n    pNext=None,\n    flags=0,\n    pApplicationInfo=application_info,\n    enabledLayerCount=len(layers),\n    ppEnabledLayerNames=layers,\n    enabledExtensionCount=len(extensions),\n    ppEnabledExtensionNames=extensions,\n)\n```\n\nTo create the struct, you must remember to pass all parameters at creation time.\nThis includes the Vulkan layers and extensions denoted by `ppEnabledLayerNames`\nand `ppEnabledExtensionNames`, which *vulkan* wrapper is able to facilitate too.\n\nThis struct example demonstrates how *vulkan* wrapper conveniently converts your\nPython code into native C types.\n\n*Note:*\n\n- The default value for all parameters is `None` so you could have omitted `pNext` (because its value is `None`).\n- The default value for `sType` parameter is the good value so you could have omitted `sType`.\n- The default value for `enabledLayerCount` parameter is the length of `ppEnabledLayerNames` so you could have omitted `enabledLayerCount` and `enabledExtensionCount`.\n- Order of parameters doesn't matter since they are keyword parameters.\n- The **C++** syntax is more risky because you must pass all parameters in specific order.\n\n#### Functions\n\n*vulkan* greatly simplifies the calling of functions. In Vulkan API, you have to explicitly\nwrite three kinds of function:\n\n  - functions that create nothing\n  - functions that create one object\n  - functions that create several objects\n\nIn *vulkan* wrapper, all these troubles goes away.\n*vulkan* will takes care of you and knows when to return `None`, an object or a `list`.\nHere are three examples:\n\n```python\n# Create one object\ninstance = vk.vkCreateInstance(createInfo, None)\n\n# Create a list of object\nextensions = vk.vkEnumerateDeviceExtensionProperties(physical_device, None)\n\n# Return None\nvk.vkQueuePresentKHR(presentation_queue, present_create)\n```\n\nVulkan functions usually return a `VkResult`, which returns the success and\nerror codes/states of the function. *vulkan* is pythonic and converts `VkResult`\nto exception: if the result is not `VK_SUCCESS`, an exception is raised.\nMore elaboration is given in the next section.\n\n\n#### Exceptions\n\n- *vulkan* has two types of Exceptions, namely `VkError` or `VkException`.\nThe `VkError` exception handles all the error codes reported by Vulkan's `VkResult`.\nThe `VkException` exception handles all the success code reported by Vulkan's `VkResult`,\nexcept the `VK_SUCCESS` success code.\n\n- Exception names are *pythonized*: `VK_NOT_READY` -\u003e `VkNotReady`.\n\n#### Constants\n\nAll Vulkan constants are available in *vulkan* and it even provides some fancy\nconstants like `UINT64_MAX`.\n\n\n### Resources\n\nTo understand how to use this wrapper, you have to look for `example/exemple_*` files\nor refer to [Vulk](https://github.com/realitix/vulk) engine.\n\n\n## How to contribute\n\nTo contribute, you should first read the `Architecture` section.\nAny contribution is welcome and I answer quickly.\n\n\n## Architecture\n\n*vulkan* is a CFFI module generated by a Python script.\n\nWhen you install this module, you need two files:\n\n- `vulkan/vulkan.cdef.h` containing CFFI definitions\n- `vulkan/_vulkan.py` containing the actual executed Python script\n\nTheses two files are generated by the `generator/generate.py` script.\n\n`vulkan/vulkan.cdef.h` is generated with a `cpp` command call, it applies pre-processing to the Vulkan C header.\nIt can't work as is because of `pycparser` which cannot parse the output. That's the purpose of `fake_libc_include` folder.\n\n`vulkan/_vulkan.py` needs more work.\nTo proceed, the generator computes a model of Vulkan API based on `vk.xml`\n(the file from Kronos describing the API) and then uses a `jinja2` template\nto write the file.\n\nHere the basic steps:\n\n - Load vk.xml\n - Use `xmltodict` to parse the xml document\n - Generate a good data model from it\n - Pass the model to the `vulkan.template.py` file\n - The template engine generate the final Python file\n\n\n## How to update the package on PyPi (for maintainer only)\n\n- python setup.py sdist bdist_wheel\n- twine upload dist/* -u __token__ -p pypi-TOKENID\n\n## Community\n\nYou can checkout my blog, I speak about *vulkan*:\n[Blog](https://realitix.github.io)\n\n\n## History\n\nThis module comes from a long journey. I have first created [CVulkan](https://github.com/realitix/cvulkan).\n*CVulkan* is a wrapper created in plain C, plain C is hard to maintain... So I have decided to restart with\nCFFI which is from far the **best** way to do it. There was a module [pyVulkan](https://github.com/bglgwyng/pyVulkan)\nthat did what I wanted to do. But it was not working and the code was hard to maintain. I asked to the maintainer\nto let me [help him](https://github.com/bglgwyng/pyVulkan/issues/12) but I got no answer.\nI forked his project and I rewrote every single part to obtain a good module.\n\n## Supported By\n\n*vulkan* is supported by helpful 3rd parties via code contributions, test devices and so forth.\nMake our supporters happy and visit their sites!\n\n![linagora](https://www.linagora.com/sites/all/themes/tux/logo.png)\n","funding_links":[],"categories":["Bindings"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealitix%2Fvulkan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frealitix%2Fvulkan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealitix%2Fvulkan/lists"}