Install & Compatibility
Where this runs
tested against v10.0.1.20250319 · 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
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 66.2MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
65MB installed
● package 65MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
format_size
✓ from humanfriendly_stubs import format_size
✗ from humanfriendly-stubs import format_size
Install `humanfriendly` and `types-humanfriendly`. Then, import and use functions from `humanfriendly` with type annotations. Your type checker will leverage the stubs provided by `types-humanfriendly`.
import os
from humanfriendly import format_size, parse_size
def process_size(size_str: str) -> str:
try:
num_bytes = parse_size(size_str)
return f"You entered: {format_size(num_bytes)}"
except Exception as e:
return f"Error parsing size: {e}"
# Example usage (usually from user input or a configuration)
user_input = os.environ.get('EXAMPLE_FILE_SIZE', '10GB') # Simulate input
print(process_size(user_input))
Debug
Known issues
deprecatedThe `types-humanfriendly` package is officially unmaintained on PyPI, and the `humanfriendly` stubs were removed from the upstream Typeshed project in March 2025. This means no further updates or fixes will be provided.fixConsider vendoring the stubs if critical, or migrating away from `humanfriendly` if type-checking is a strict requirement for newer Python versions or accurate types. Alternatively, disable type checking for this library.
affects: 10.0.1.20250319 and later (effectively frozen)
gotchaStub versions can introduce breaking changes for type checkers even if the runtime library does not. Due to the unmaintained status, future `humanfriendly` versions may not be accurately stubbed, leading to type-checking errors.fixPin `types-humanfriendly` to a specific version (e.g., `types-humanfriendly==10.0.1.20250319`) to prevent unexpected type-checking failures if newer versions of `humanfriendly` are installed and their APIs diverge from the stubbed `10.0.*` version. Always ensure the stub version aligns with your `humanfriendly` runtime version.
affects: All versions, especially when paired with `humanfriendly` versions > 10.0
gotchaThe underlying `humanfriendly` library itself has not been updated since September 2021 (version 10.0) and was noted as not working with Python 3.13 during the Typeshed removal discussion, which implies potential runtime issues with newer Python versions, separate from the stubs.fixTest `humanfriendly` thoroughly with your target Python version. If you encounter runtime issues, consider alternative libraries with active maintenance.
affects: humanfriendly==10.0 with Python 3.13+
Upgrade
Version history
10.0.1.20250319latest on PyPI · released Mar 19, 2025
Audit
Dependencies
humanfriendlyrequiredProvides type stubs for this runtime library; required for the stubs to be effective.