binapy
Binary Data manipulation, for humans.
What it is and what it does
BinaPy is a thin wrapper around Python's standard binary-handling modules (hashlib, base64, zlib, urllib.parse, json, pickle) that chains operations through a fluent interface. Instead of calling separate functions or methods in sequence, you chain `.to()` and `.decode_from()` calls on a BinaPy object (which is itself a bytes subclass), making code more readable when performing multiple encoding, compression, or hashing steps in sequence.
The package targets developers who work with binary data transformations—encoding to base64url, compressing with gzip or deflate, hashing with SHA256, URL-encoding, and similar tasks. It does not add new functionality beyond what the standard library offers; it reorganizes and chains existing operations. The single runtime dependency is typing-extensions, and it supports Python 3.8 through 3.12.
Use it for:
- Chain multiple encoding steps (e.g., compress then base64-encode) in a single readable expression.
- Simplify hash computation with optional salt by calling a single method instead of hashlib boilerplate.
- Decode layered data (e.g., base64url-wrapped deflate-compressed JSON) by chaining decode_from calls.
- Extend the library with custom formats by subclassing or registering new codecs.
- Reduce repetitive imports and function calls when working with standard compression and encoding formats.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
BinaPy wraps Python's binary-handling libraries (hashlib, base64, zlib, urllib.parse, json, pickle) into a fluent, chainable interface for encoding, decoding, compressing, and hashing data.
Yes, if you frequently chain multiple binary transformations and prefer a fluent API over repeated standard-library calls. No, if you only use one or two encoding/hashing operations per script—the standard library is already straightforward and requires no dependency. Caution: Pre-Alpha status and dormant maintenance (last release January 2024) mean the API may change and bugs may not be addressed quickly.
Install
binapy on PyPI
pip
pip install binapyuv
uv add binapypoetry
poetry add binapyInstalling binapy
Before you install
Low install friction; single pure-Python dependency (typing-extensions). Maintenance is dormant—last release January 2024, last commit August 2024, repository not archived but showing minimal activity. Pre-Alpha status (Development Status :: 2) suggests the API may still shift.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in your own projects.
Quickstart
from binapy import BinaPy
# Compress and encode
bp = BinaPy("Hello, World!").to("deflate").to("b64u")
print(bp) # b'80jNycnXUQjPL8pJUQQA'
# Decode and decompress
original = bp.decode_from("b64u").decode_from("deflate").ascii()
print(original) # "Hello, World!"
Verify before relying
- Whether the fluent interface and method-chaining design actually reduce boilerplate compared to standard library calls in realistic workflows.
- Performance characteristics relative to direct hashlib/base64/zlib calls, especially for large data.
- Stability of the API given Pre-Alpha classification and dormant maintenance status.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing-extensions |
| Maintenance | dormant — 938 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,006,264/month — #4,526 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: binapy-0.8.0-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
base2048Encodes and decodes binary data using Base2048,…
permissive · top 15,000 on PyPI
zipfile-deflate64Enables extraction of Deflate64-compressed ZIP…
permissive · top 5,000 on PyPI
cbor2Encodes and decodes CBOR (Concise Binary Object…
permissive · top 1,000 on PyPI
deflateThin Python wrapper around libdeflate for fast…
permissive · top 15,000 on PyPI
pybase64Fast base64 encoding and decoding via a C…
permissive · top 1,000 on PyPI
py-multibaseEncodes and decodes data using the Multibase…
permissive · top 15,000 on PyPI
morphysMorphys provides utility functions to convert…
permissive · top 15,000 on PyPI
PyByteBufferPyByteBuffer provides Java ByteBuffer-style…
copyleft · top 5,000 on PyPI
borsh-constructImplements the Borsh binary serialization…
permissive · top 15,000 on PyPI
hachoirHachoir parses and displays binary files as a…
copyleft · top 15,000 on PyPI