Registry / serialization / hurry-filesize

hurry-filesize

JSON →
library0.9pypypi✓ verified 22d ago

Hurry Filesize is a simple Python library, version 0.9, designed to convert a number of bytes into a human-readable string (e.g., '1K', '2M'). First released in 2009, it provides various systems for formatting, including traditional (1024 multipliers), SI (1000 multipliers), and verbose options. Due to its age, it maintains a very low release cadence, with its current version being its initial public release.

pip install hurry.filesize
INSTALL
IMPORT
SIG · HURRY-FILESIZE
H
hurry-filesize
serializationpythonv0.9
Install
2.6s avg
Import
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.6s · import 0.000s · 20MB
20MB installed
● package 20MB
Code
Verified usage

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

size
from hurry.filesize import size
This imports the primary function for human-readable sizing using the default 'traditional' system (1024 multipliers).
alternative
from hurry.filesize import alternative
Imports an alternative system constant for more verbose output (e.g., '1 KB', '1 byte').
si
from hurry.filesize import si
Imports the SI system constant for 1000 multipliers (e.g., '1K' for 1000 bytes).
verbose
from hurry.filesize import verbose
Imports a verbose system constant for full unit names (e.g., '1 kilobyte', '1 megabyte').

This quickstart demonstrates how to import and use the `size` function with its default 'traditional' system and alternative formatting systems (alternative, SI, verbose) to convert byte values into human-readable strings.

from hurry.filesize import size, alternative, si, verbose bytes_value = 1024 * 1024 * 3.5 # 3.5 MB print(f"Default: {size(bytes_value)}") print(f"Alternative: {size(bytes_value, system=alternative)}") print(f"SI: {size(bytes_value, system=si)}") print(f"Verbose: {size(bytes_value, system=verbose)}") # Example with smaller values print(f"10 bytes (default): {size(10)}") print(f"10 bytes (alternative): {size(10, system=alternative)}") print(f"10 bytes (verbose): {size(10, system=verbose)}")
Debug
Known issues
gotchaThe default `size` function and its alternative systems provide integer approximations, which may lead to a loss of precision. For example, `size(1031053)` might return '1M' or '2M' rather than '1.03M'.
fix
For higher precision or floating-point output, consider alternative libraries like `datasize` or custom formatting functions.
affects: 0.9
deprecatedThe library has not been updated since its initial release in 2009. While functional for its core purpose, it lacks modern maintenance and may not be actively supported for new Python features or complex edge cases.
fix
For new projects, evaluate more recently maintained alternatives that offer similar or extended functionality, such as `hfilesize` or `datasize`.
affects: 0.9
gotchaThe `hurry` package itself is a namespace package, which can sometimes lead to confusion regarding its internal structure or sub-package imports if users expect a traditional package with an `__init__.py` at its root.
fix
Always import specifically from `hurry.filesize` (e.g., `from hurry.filesize import size`) rather than attempting to import `hurry` directly for `filesize` functionality.
affects: 0.9
Errors
Common errors & fixes
ImportError: No module named hurry.filesize
This error occurs when the `hurry.filesize` library is not installed in the Python environment, or Python cannot locate it within its `sys.path`.
fix
Ensure the library is installed using pip: `pip install hurry.filesize`.
AttributeError: module 'hurry' has no attribute 'filesize'
This happens when a user attempts to import the top-level `hurry` package directly (e.g., `import hurry`) and then tries to access `hurry.filesize.size`. The `hurry` package is a namespace package, and `filesize` needs to be imported more specifically.
fix
Import the `filesize` module directly, for example: `from hurry.filesize import size` to use the `size` function directly, or `import hurry.filesize` and then use `hurry.filesize.size()` to access the function.
TypeError: 'module' object is not callable
This error arises when a user imports the `hurry.filesize` module itself (e.g., `import hurry.filesize`) and then attempts to call the module directly as if it were a function (e.g., `hurry.filesize(1024)`), instead of calling the `size` function within the module.
fix
After importing the module, explicitly call the `size` function: `import hurry.filesize; hurry.filesize.size(1024)`. Alternatively, import the `size` function directly: `from hurry.filesize import size; size(1024)`.
ERROR: Could not find a version that satisfies the requirement hurry-filesize (from versions: none)
This pip error indicates that the `pip` installer could not find the `hurry-filesize` package in the Python Package Index (PyPI) or any configured repositories. This is often due to a typo in the package name or network issues.
fix
Verify the package name is correctly spelled as `hurry-filesize` for installation: `pip install hurry-filesize`. Ensure an active internet connection and that pip is configured to access PyPI.
Upgrade
Version history
0.9latest on PyPI · released Mar 11, 2009
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
homepageUNKNOWN
hurry-filesize — pip install hurry-filesize · libregistry