Skip to main content

A small collection of utility functions

Project description

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.

Project details


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.1.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lillib-0.1.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file lillib-0.1.0.tar.gz.

File metadata

  • Download URL: lillib-0.1.0.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for lillib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c680a6e73d5951afed8eccbb54f6d77fb618f0e753b30a3bed1315ec16ecb81b
MD5 167d38ce859f6a3b5186b30fd638dfc1
BLAKE2b-256 5461f988abc40f2ed90dc8c49373cf30717bc2471547affc68b935eef323b8a2

See more details on using hashes here.

File details

Details for the file lillib-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lillib-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for lillib-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43298a7a14868c324dcc7235aed9d9e52500d3465be782a2db053a3896a9b19d
MD5 7750a91aaf77be30acde9dfa8bf404c7
BLAKE2b-256 4ccab1eb2e92eaa4e8f90698a28e20a19b6b06c1567da720827dae1d1c6b4bf8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page