ctypes-dlpack
The DLPack standard allows to share
arrays/tensors data between different frameworks. It is defined as a C API, and
the standard way to use it from Python is the __dlpack__ protocol defined in
the array
api,
which relies on PyCapsule to pass the pointer around through Python code.
However, there might be times where one does not have a PyCapsule but just a
raw pointer to the DLPack C struct. In particular, this might be the case when
adding bindings to a C library through ctypes instead of going through a
CPython extension module. This library is here to bridge this gap, creating
ctypes pointers from the __dlpack__ protocol, and making existing pointers
compatible with this protocol.
This library exposes both the C structs/enums/constants from the DLPack C header
as ctypes types (containing among other the version of the DLPack library
that was used to generate the ctypes declarations), and a Python API to convert
between DLPack pointers and Python objects. See the documentation for more details.
You can install the code with pip install ctypes-dlpack.
License and contributions
This project is distributed under the terms of the BSD license, and maintained by @Luthaf, who will reply to issues and pull requests opened on this repository as soon as possible. You can mention them directly if you did not receive an answer after a couple of days.
Release files for ctypes-dlpack 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ctypes_dlpack-0.1.0.tar.gz | 12.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ctypes_dlpack-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.3 kB
Release files / ctypes_dlpack-0.1.0.tar.gz
| Download URL | ctypes_dlpack-0.1.0.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a1f8811e761f05bc28aa60cab2674afe4f6c7242255987214776cfc04c605132
|
|
BLAKE2b-256 checksum How to use checksums |
3dedb6e68eba9f6df3df1c3bbd93ef5af2cd7156c9ef1e35abf0d7c06b923e0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / ctypes_dlpack-0.1.0-py3-none-any.whl
| Download URL | ctypes_dlpack-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
32c16522868e978bbbf1de3010e57960a810f0ba1628cfcf8bcb5b2e25fd14db
|
|
BLAKE2b-256 checksum How to use checksums |
9db80719443f8b63536ba4dcb315864082f89a5e789089db941897232ad6b14e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|