lillib
A small collection of utility functions for Python.
Installation
You can install the package via pip:
pip install lillib
Usage
Human-readable byte sizes
Convert byte sizes into human-readable strings:
from lillib import humanbytes
# Basic usage (uses binary 1024-based units with IEC prefixes by default)
print(humanbytes(1024)) # "1.00 KiB"
print(humanbytes(1500000)) # "1.43 MiB"
# Using decimal (1000-based) units
print(humanbytes(1000, decimal=True)) # "1.00 KB"
# Control decimal places
print(humanbytes(1024, sigfig=0)) # "1 KiB"
print(humanbytes(1024, sigfig=3)) # "1.000 KiB"
# Control IEC strictness for binary units
print(humanbytes(1024, strict_iec=False)) # "1.00 KB" (non-strict)
Features
humanbytes(): Convert byte sizes into human-readable strings with appropriate unit prefixes- Support for both decimal (1000-based) and binary (1024-based) units
- Support for IEC standard binary prefixes (KiB, MiB, GiB) or traditional prefixes
License
This project is licensed under the GNU Affero General Public License v3 - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lillib-0.2.0.tar.gz
(15.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
lillib-0.2.0-py3-none-any.whl
(16.1 kB
view details)
File details
Details for the file lillib-0.2.0.tar.gz.
File metadata
- Download URL: lillib-0.2.0.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f6a69be283eb84b0e7c8c92d314244b4421545267e0091f1a8b305357517f26
|
|
| MD5 |
a86805c158d92e93f1223f4afc8cb4ef
|
|
| BLAKE2b-256 |
cf6a69b7984ea353ed3e8c0c8c8e93c20d8f4a9d4214f96caa8089b9c91c1847
|
File details
Details for the file lillib-0.2.0-py3-none-any.whl.
File metadata
- Download URL: lillib-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ad561280d8a9f177b5e18eb5b457dcc3af6c8e31fa80cdcecc84ee0cc07ab4e
|
|
| MD5 |
7352942db691ee20566d81ac5b2f39b9
|
|
| BLAKE2b-256 |
9092d36431783996c2cb04c0d66ee4586574591fef4f1d696db32232a5fb816e
|