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.
Metadata
Release files for ctypes-dlpack 0.1.1
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.1.tar.gz | 14.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ctypes_dlpack-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.2 kB
Release files / ctypes_dlpack-0.1.1.tar.gz
| Download URL | ctypes_dlpack-0.1.1.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0fd91cf7eb69a40a4ebabfd2000cc8c100dbde574273f35a841c3446cd6dbe07
|
|
BLAKE2b-256 checksum How to use checksums |
8fec969dca23af118e888035ebd1e1aaa062d72576d116631b1c0592d79ffd01
|
| 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.1-py3-none-any.whl
| Download URL | ctypes_dlpack-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
14618b7340b6dd2c431280511258ec0ad24eeace31881abbc7af0e9c1cbc2433
|
|
BLAKE2b-256 checksum How to use checksums |
54ab400b43f21ab083f586e834266132bd7f2004d88968d8e9bdda1a10df959c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|