Skip to main content

dtypes

Yo yo what's this?

Well it's ✨dtypes✨ which is extra stuff to make ctypes usable. Or as the my future kids like to say, "dtypes is on ctypes like butter is on toast".

Who wants to do

class Yolo(ctypes.structure):
    _fields_ = [
        ("a", ctypes.c_int),
        ("b", ctypes.c_float),
        ("c", ctypes.c_double),
    ]

when you can do

from dtypes.structify import structify

@structify
class Yolo(ctypes.structure):
    a : ctypes.c_int
    b : ctypes.c_float
    c : ctypes.c_double

And then, who wants to deal with the messy and incomplete way of working with forward declarations in pure ctypes?

class Yeet(ctypes.structure):
    pass

class Chonko(ctypes.structure):
    _fields_ = [
        ("yeet", ctypes.POINTER(Yeet)),
    ]

Yeet._fields_ =[
    ("chonker", Chonko),
    ("this", ctypes.POINTER(Yeet),
]

when you can do

from dtypes.structify import structify
from dtypes.fwd import fwd, ThisPtr, Pointer

Yeet = fwd()

@structify
class Chonko(ctypes.structure):
    yeet : Pointer(Yeet)

@structify
class Yeet(ctypes.structure, Yeet):
    chonker : Chonko
    this    : ThisPtr
]

Release files for dtypes 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dtypes 0.0.1
File Size Uploaded
dtypes-0.0.1.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dtypes 0.0.1
File Interpreter ABI Platform
dtypes-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / dtypes-0.0.1.tar.gz

Download URL dtypes-0.0.1.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8f437ffb69605301a68adec6327e165e8c53892bfb13734b4a5f5b123bdab391
BLAKE2b-256 checksum
How to use checksums
a15449fffeed2831b2c78cad1efd6abf4e06e0af85ffb365bb6e0bc380e2db73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release files / dtypes-0.0.1-py3-none-any.whl

Download URL dtypes-0.0.1-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
469d6f7a9fbaf733adae589142e2311077dc870687867f72b1d36d11d718d649
BLAKE2b-256 checksum
How to use checksums
09a6397d3b1e0e4ece7e614f7dacbed33b6dd2afc4c06554954d42b60b08d262
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page