Skip to main content

Python bindings to the katsuba Rust libraries

Project description

Katsuba

Python bindings to the Katsuba libraries.

Error handling

Most errors are represented either as native Python exceptions where it makes sense, or as a katsuba.KatsubaError for custom errors from the Rust side.

Bindings

katsuba.op

Bindings to core functionality from the katsuba-object-property crate.

from katsuba.op import *
from katsuba.utils import string_id

# Open a type list from file system
type_list = TypeList.open("types.json")

# Configure serializer options
opts = SerializerOptions()
opts.flags |= STATEFUL_FLAGS
opts.shallow = False

# Construct the serializer
ser = Serializer(opts, type_list)

# Deserialize a file
with open("TemplateManifest.xml", "rb") as f:
    manifest = f.read()
    assert manifest[:4] == b"BINd"

manifest = ser.deserialize(manifest[4:])

# Make sure we deserialized the right object:
assert manifest.type_hash == string_id("class TemplateManifest")

# Iterate the templates in the resulting object:
for location in manifest["m_serializedTemplates"]:
    print(f"Template {location['m_id']} at {location['m_filename']}")

katsuba.wad

Bindings to core functionality from the katsuba-wad crate.

from katsuba.op import Serializer
from katsuba.wad import Archive

# See `katsuba.op` above.
s = Serializer(...)

# Open an archive memory-mapped:
a = Archive.mmap("/path/to/Root.wad")

print(f"{len(a)} files in archive!")

# Deserialize a file out of the given archive:
if "TemplateManifest.xml" in a:
    a.deserialize("TemplateManifest.xml", s)

# Iterate over files in the archive and get their contents:
for path in a:
    data = a[path]

# With a glob pattern for filtering files:
for path in a.iter_glob("ObjectData/**/*.xml"):
    data = a[path]

katsuba.utils

Bindings to useful components from the katsuba-utils crate.

For the time being, this features the hash functions djb2 and string_id.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

katsuba-0.4.0.tar.gz (57.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

katsuba-0.4.0-cp311-abi3-win_amd64.whl (696.5 kB view details)

Uploaded CPython 3.11+Windows x86-64

katsuba-0.4.0-cp311-abi3-win32.whl (601.4 kB view details)

Uploaded CPython 3.11+Windows x86

katsuba-0.4.0-cp311-abi3-manylinux_2_28_x86_64.whl (778.5 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ x86-64

katsuba-0.4.0-cp311-abi3-manylinux_2_28_i686.whl (783.6 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ i686

katsuba-0.4.0-cp311-abi3-manylinux_2_28_aarch64.whl (704.8 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

katsuba-0.4.0-cp311-abi3-macosx_11_0_arm64.whl (639.1 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

katsuba-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl (731.1 kB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file katsuba-0.4.0.tar.gz.

File metadata

  • Download URL: katsuba-0.4.0.tar.gz
  • Upload date:
  • Size: 57.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.12.0

File hashes

Hashes for katsuba-0.4.0.tar.gz
Algorithm Hash digest
SHA256 5458d70c74b99b156d88cfb8f798c389485a1998bd7e60a1c7aa0f2addb9ddee
MD5 70674d0b6c41839ad1b1e3ee71b83cd9
BLAKE2b-256 28321fb6a8fee0b5b78ad3d1ee8f5447410026fcffec25f0d7e8ce144815f223

See more details on using hashes here.

File details

Details for the file katsuba-0.4.0-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: katsuba-0.4.0-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 696.5 kB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.12.0

File hashes

Hashes for katsuba-0.4.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0d8d5d8401e5871fd74aaed082b72fe76b25058b5034b7d75bd292a71fd0aeb7
MD5 218d1d4b2983c1afe3f77bd7413d3753
BLAKE2b-256 fca71079f2013ca8f1847df86308ee26cbde91fd804574bf597fca8417d41716

See more details on using hashes here.

File details

Details for the file katsuba-0.4.0-cp311-abi3-win32.whl.

File metadata

  • Download URL: katsuba-0.4.0-cp311-abi3-win32.whl
  • Upload date:
  • Size: 601.4 kB
  • Tags: CPython 3.11+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.12.0

File hashes

Hashes for katsuba-0.4.0-cp311-abi3-win32.whl
Algorithm Hash digest
SHA256 6cada8364c458723d4cde988cb756cbb24dca8780d786122bd48250d48d5640f
MD5 851cf86cde8ef4eae68edc80b2b0afb1
BLAKE2b-256 a20d942287a084a4860b03a616e06b4db9a18bd2c3b7d249926ea38415cc79c5

See more details on using hashes here.

File details

Details for the file katsuba-0.4.0-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for katsuba-0.4.0-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 594ae3a5519c4a2c64205176ecff6f60f07bab3cb80b5b231b100e7cd3245984
MD5 db704546713d81b98783296786b33548
BLAKE2b-256 58b6ccfe9bb18711b2314ec5b03a69768a39bf6544d7bdc7ad980c818b3bda54

See more details on using hashes here.

File details

Details for the file katsuba-0.4.0-cp311-abi3-manylinux_2_28_i686.whl.

File metadata

File hashes

Hashes for katsuba-0.4.0-cp311-abi3-manylinux_2_28_i686.whl
Algorithm Hash digest
SHA256 015fd18b8e2de2cdd45e7434551a7c187a5dd1141e7c1036826693c22ace8ea2
MD5 f0fdf68fabf9f736cdd8482ae113e16e
BLAKE2b-256 245258609fc68db4b829f78db87a07f1563733271037f0777301af2ab7dcf9c3

See more details on using hashes here.

File details

Details for the file katsuba-0.4.0-cp311-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for katsuba-0.4.0-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bc615d672aed2d2c14f1a20389295b03d297084fc0e82c309bd1b61eb26f88a3
MD5 5c7df91fa1e74bb27db785c40a846352
BLAKE2b-256 51815a55e69426988c2c89dbe2254d06d877f2565ff997ac03555aa516fe0048

See more details on using hashes here.

File details

Details for the file katsuba-0.4.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for katsuba-0.4.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 720b781a9c90468f23d369cca51549d11a6d367cf4ee33e71a11c74bf07b5c82
MD5 7f8c397b4e3d5f579706551e6d49669f
BLAKE2b-256 0627def1b834a29fc8b8f8fe9c05cf8369dfbd94f1cd04108f1ed37236aa0b17

See more details on using hashes here.

File details

Details for the file katsuba-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for katsuba-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0ba4af76d16f73010ba0bfe5f9431a6e84e043b697716f411662eacfb555a40d
MD5 141e8b60222e875c24b0b00a9cea6165
BLAKE2b-256 4227a065194c621ca5f011a7f8ac15c44aec1cf929f8875ecd4dbdd203e5dfb2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page