CModel
Model C structs with Pydantic
cmodel lets you describe C-compatible binary layouts with normal Pydantic models.
You keep Pydantic's validation and nested models, and gain a simple way to pack and
unpack structs from binary buffers.
Quick start
from io import BytesIO
from cmodel import CModel
from cmodel.types import Int
class Point(CModel):
x: Int
y: Int
buf = BytesIO()
Point(x=3, y=7).c_pack(buf)
buf.seek(0)
point = Point.c_unpack(buf)
assert point == Point(x=3, y=7)
assert buf.getvalue() == b"\x03\x00\x00\x00\x07\x00\x00\x00"
Metadata
Release files for cmodel 0.7.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 | |
|---|---|---|---|
| cmodel-0.7.0.tar.gz | 14.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cmodel-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.4 kB
Release files / cmodel-0.7.0.tar.gz
| Download URL | cmodel-0.7.0.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1bcb17a4d2e40a48889dd5f7506c919a4a8d0ad899c2b6546a2a2429030d9e44
|
|
BLAKE2b-256 checksum How to use checksums |
c3d9e9a2f1ea7c9613a5e299c8466a4dcd15ac8354b14b4151b64c8088c7c232
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / cmodel-0.7.0-py3-none-any.whl
| Download URL | cmodel-0.7.0-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1037d01595db9c9bcd2db4aa7bb9971249f9b7625201e0779537be0426d166f
|
|
BLAKE2b-256 checksum How to use checksums |
23184e45057d5aca861d00ed12843d38e06d9cf500e404fa94a5f9967bc70261
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|