{"id":8219,"library":"human-readable","title":"Human Readable","description":"The `human-readable` library provides a collection of utilities to convert various data types, such as numbers, dates, times, file sizes, and lists, into a more human-friendly and readable format. It aims to enhance user experience by presenting machine-generated data in an intuitive way. The current version is 2.0.2 and it is actively maintained, with the latest release on March 26, 2026.","status":"active","version":"2.0.2","language":"en","source_language":"en","source_url":"https://github.com/staticdev/human-readable","tags":["humanization","formatting","time","date","filesize","numbers","i18n"],"install":[{"cmd":"pip install human-readable","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Requires Python 3.9 or newer.","package":"Python","optional":false}],"imports":[{"note":"The correct import for this library uses an underscore (`human_readable`), not `humanreadable` (which is a different library) or `humanize` (another similar library).","wrong":"import humanreadable","symbol":"human_readable","correct":"import human_readable"}],"quickstart":{"code":"import human_readable\nimport datetime as dt\n\n# Date and time humanization\nprint(human_readable.time_of_day(17))\nprint(human_readable.time_delta(dt.timedelta(seconds=3665)))\n\n# File size humanization\nprint(human_readable.file_size(2900000))\n\n# List humanization\nprint(human_readable.listing(['apple', 'banana', 'orange']))\n\n# Numbers humanization\nprint(human_readable.int_comma(123456789))\nprint(human_readable.int_word(123456789))\n","lang":"python","description":"This quickstart demonstrates common humanization tasks for time, file sizes, lists, and numbers using the `human_readable` library's core functions."},"warnings":[{"fix":"Review the official changelog (if available) or the project's GitHub releases for specific migration instructions before upgrading in production environments. Test thoroughly.","message":"Upgrading from `human-readable` 1.x to 2.x may introduce breaking changes. While not explicitly detailed in the public release notes, major version increments (e.g., 1.x to 2.x) typically indicate backward-incompatible API changes following Semantic Versioning principles.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Always use `import human_readable` and refer to functions with the `human_readable.` prefix. Double-check documentation for the specific library you intend to use.","message":"There are several Python libraries with similar names or functionalities (e.g., `humanize`, `humanreadable`, `humanfriendly`). Ensure you are importing and using functions from the correct `human_readable` package to avoid unexpected behavior or `AttributeError`s.","severity":"gotcha","affected_versions":"All"},{"fix":"Activate the desired locale using `human_readable.i18n.activate('your_locale_code')`. For example, `human_readable.i18n.activate('es_ES')`. Ensure the locale data is available if specifying a custom path.","message":"Localization (i18n) requires explicit activation. If humanization functions return English strings despite your environment being set to another locale, the library's locale might not be activated correctly.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"If you intended to use `human-readable`, use `import human_readable`. If you intended `humanize`, ensure it's installed via `pip install humanize` and import it correctly.","cause":"Attempting to import `humanize` when `human-readable` is installed, or vice-versa. These are distinct libraries.","error":"ModuleNotFoundError: No module named 'humanize'"},{"fix":"Consult the `human-readable` documentation (or the specific version's docs) for the correct function names and their usage. For example, `humanize.naturaltime` is `human_readable.time_delta` or `human_readable.date_time` in this library. `humanize.filesize` is `human_readable.file_size`.","cause":"Trying to use a function (e.g., `naturaltime`, `filesize`) that exists in a different humanization library (like `humanize` or `humanreadable`) but not in `human-readable`, or a function that has been renamed or removed in a newer version.","error":"AttributeError: module 'human_readable' has no attribute 'some_function'"},{"fix":"Ensure the input data type matches the function's expected arguments. Convert floats to integers if appropriate, or use functions designed for floats (e.g., `human_readable.scientific`, `human_readable.fractional`) if that's the desired outcome.","cause":"Passing a float to a function that strictly expects an integer, such as `human_readable.time_of_day`, or an incorrect type to other humanization functions.","error":"TypeError: 'float' object cannot be interpreted as an integer"}]}