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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibcpy 3.10–3.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)}")
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`.
fixEnsure 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.
fixImport 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.
fixAfter 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.
fixVerify 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.