skillfed

humanreadable

humanreadable is a Python library to convert human-readable values to other units.

humanreadable v0.4.3 277.9K downloads/30d#8,141 on PyPI21
Permissive license MIT License Active released

What it is and what it does

humanreadable is a lightweight Python library that bridges the gap between human-friendly time and bitrate notation and numeric computation. It parses strings like '12 min 40 sec' or '1 Gbps' into Time and BitsPerSecond objects, then lets you access the value in any supported unit (seconds, milliseconds, Mbps, Kibps, etc.). It can also reverse the process: format a numeric duration back into a human-readable string like '6 minutes 40 seconds' or the compact form '6m 40s'.

The library depends only on typepy for runtime validation and is distributed as a pure Python wheel, making installation straightforward. It supports time units from days down to microseconds, and bitrate units from bps up to Tibps in both decimal (Mbps) and binary (Mibps) variants. The package is actively maintained, supports Python 3.10 through 3.14, and carries no known security vulnerabilities.

Use it for:

  • Parse timeout or duration strings from configuration files or CLI arguments into seconds for use in sleep() or timeout parameters.
  • Convert network bandwidth specifications (e.g. from API docs or user input) into bits per second for rate-limiting or capacity calculations.
  • Format elapsed time or performance metrics back into human-readable strings for logs, reports, or user-facing output.
  • Normalize time or bitrate values from different sources (some in seconds, some in minutes) into a common unit for comparison.
  • Build CLI tools or config parsers that accept flexible time/bitrate notation without requiring users to specify units numerically.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Parses human-readable time and bitrate strings (e.g. '120 sec', '1 Gbps') and converts them to numeric values in different units, or formats numeric values back to human-readable strings.

Yes. The package solves a real parsing problem with minimal overhead—a single lightweight dependency, no security issues, and active maintenance. Install it if you need to accept or format human-readable time or bitrate strings; skip it if your code works only with numeric values already in a fixed unit.

Install

humanreadable on PyPI

pip

pip install humanreadable

uv

uv add humanreadable

poetry

poetry add humanreadable

Installing humanreadable

Before you install

Low friction: pure Python wheel with a single runtime dependency (typepy). Actively maintained with a recent release (97 days ago) and last commit on 2026-07-20.

License in practice

MIT License (permissive) — you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

import humanreadable as hr

# Parse human-readable time
value = hr.Time("120 sec")
print(value.milliseconds)  # 120000.0
print(value.minutes)       # 2.0

# Parse bitrate
speed = hr.BitsPerSecond("1 Gbps")
print(speed.mega_bps)      # 1000.0

Requires Python 3.10 or later.

Verify before relying

  • Whether the package handles edge cases like malformed input or ambiguous unit strings gracefully.
  • Performance characteristics when parsing very large batches of values.
  • Exact behavior when both a numeric value and a unit specifier are provided.

Package facts

License MIT License (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — typepy
Maintenance actively maintained — 97 days since the last release
Last repo commit
First released
Downloads 277,909/month — #8,141 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: humanreadable-0.4.3-py3-none-any.whl

Keywords: human-readable, converter

Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: Information TechnologyLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text ProcessingTyping :: Typed

Tags

parse human readable timeconvert time unitsbitrate string parserhuman readable to secondstime duration converterbits per second converterformat duration human readable
unit-conversionparsing

More Libraries packages