Registry / serialization / humanreadable

humanreadable

JSON →
library0.4.3pypypi✓ verified 82d ago

humanreadable is a Python library to convert human-readable values for sizes, times, and bit rates into other units. It supports various formats like '1MB', '1 day', or '100Mbps'. The current version is 0.4.1. Releases occur irregularly, often tied to Python version support updates and essential bug fixes.

pip install humanreadable
INSTALL
IMPORT
SIG · HUMANREADABLE
H
humanreadable
serializationpythonv0.4.3
Install
2.6s avg
Import
Disk
34MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 34.6MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.6s · import 0.000s · 35MB
34MB installed
● package 34MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BitPerSecond
from humanreadable import BitPerSecond
from humanreadable import Size
Time
from humanreadable import Time
BitsPerSecond
from humanreadable import BitsPerSecond

Demonstrates how to import and use the `Size`, `Time`, and `BitsPerSecond` classes to parse human-readable strings and access their converted values, including basic arithmetic operations.

from humanreadable import Size, Time, BitsPerSecond # Convert human-readable size to bytes, kilobytes, etc. size_mb = Size("1.5 MB") print(f"1.5 MB is {size_mb.byte} bytes") print(f"1.5 MB is {size_mb.kbyte} KB") # Convert human-readable time to seconds, minutes, hours, etc. time_day = Time("2 days 3 hours") print(f"2 days 3 hours is {time_day.hours} hours") print(f"2 days 3 hours is {time_day.minutes} minutes") # Convert human-readable bit rate to bits per second, kilobits per second, etc. rate_gbps = BitsPerSecond("10 Gbps") print(f"10 Gbps is {rate_gbps.bps} bits/second") print(f"10 Gbps is {rate_gbps.giga_bps} Gbps") # Perform arithmetic operations (available from v0.3.0+) size_a = Size("10 MB") size_b = Size("2048 KB") # 2MB total_size = size_a + size_b print(f"10 MB + 2048 KB = {total_size.mbyte} MB")
Debug
Known issues
breakingPython version support has been dropped for older interpreters. Specifically, v0.4.1 dropped support for Python 3.8/3.9, v0.4.0 dropped 3.6, and v0.2.0 dropped 3.5.
fix
Ensure your Python environment is 3.10 or newer (3.12+ recommended for v0.4.1+). If you must use an older Python version, pin `humanreadable` to a compatible release (e.g., `pip install 'humanreadable<0.4.1'` for Python 3.8/3.9).
affects: <=0.4.0
breakingThe `BitPerSecond.bps` property type changed from `int` to `float`.
fix
If your code expects `BitPerSecond.bps` to return an integer, update it to handle `float` values. This change was introduced in v0.2.0, so older code might fail if not adapted.
affects: >=0.2.0
gotchaThe `to_humanreadable` method for the `Time` class could fail when the value represented more than one day.
fix
Upgrade to `humanreadable>=0.4.0` to ensure correct behavior of the `Time.to_humanreadable()` method for values exceeding one day.
affects: <0.4.0
Upgrade
Version history
0.4.3latest on PyPI · released May 9, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources