--- id: binary version: "1.0.2" license: MIT OR Apache-2.0 license_treatment: permissive maintenance: aging --- # binary License: permissive · Maintenance: aging · Downloads: 241.4K/mo ## What it is and what it does binary is a lightweight unit-conversion library that translates between binary (IEC-standard: KiB, MiB, GiB, etc.) and decimal (SI-standard: KB, MB, GB, etc.) storage units. It solves the common problem of converting between what manufacturers advertise (decimal terabytes) and what operating systems report (binary tebibytes), and vice versa. The package exposes a single function, convert_units(), which accepts a number, an input unit, and optionally a target unit, and returns both the converted value and a human-readable unit string. The library supports automatic scaling to the highest appropriate unit, optional exact arithmetic via Python's decimal.Decimal module, and negative values. It conforms to IEC 80000-13 and SI standards, making it suitable for storage calculations, system monitoring, and any context where precise unit conversion matters. With no external dependencies and support for Python 3.9 through 3.13, it installs cleanly and runs on both CPython and PyPy. Use it for: - Display hard drive capacity in human-readable form, converting manufacturer specs (decimal TB) to actual storage (binary TiB). - Format network traffic or throughput metrics for logs or dashboards with automatic unit selection. - Calculate storage requirements in infrastructure-as-code or Kubernetes manifests, ensuring unit consistency. - Convert between binary and decimal units in scientific or engineering calculations where precision matters. - Validate or normalize storage quantities in APIs or configuration files. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts between binary (IEC) and decimal (SI) units for storage sizes, with support for exact decimal arithmetic and automatic unit scaling. Yes, if you need reliable unit conversion between binary and decimal storage units. The package is simple, dependency-free, and permissively licensed. The aging maintenance status (last release 429 days ago) is a minor concern for a stable, narrow-scope library with no known vulnerabilities, but check whether active development matters for your use case. Suitable for production use in storage, monitoring, or infrastructure contexts. ## Install pip install binary uv add binary poetry add binary ## Installing binary Before you install: Low friction installation with no runtime dependencies. Maintenance is aging—last release was 429 days ago, though the repository remains active and supports current Python versions (3.9–3.13). License in practice: Dual-licensed under MIT or Apache-2.0 at your option, both permissive. No restrictions on commercial or private use. Quickstart: pip install binary from binary import BinaryUnits, DecimalUnits, convert_units # Convert 1536 KB to MB in binary units amount, unit = convert_units(1536, BinaryUnits.KB, BinaryUnits.MB) print(f"{amount} {unit}") # Output: 1.5 MiB Requires Python 3.9 or later. Verify before relying: - Whether the package handles edge cases like very large numbers or unusual unit combinations reliably. - Performance characteristics when exact=True (using decimal.Decimal) on large datasets. ## Package facts - License: MIT OR Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 241.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags binary decimal unit conversion, storage size conversion, IEC SI units, bytes to megabytes, human readable file sizes, unit conversion library, binary prefix conversion, unit-conversion, storage-metrics [View on SkillFed](https://skillfed.io/packages/binary) · [View on PyPI](https://pypi.org/project/binary/)