Skip to main content

Set of handy python utilities

Project description

python-utilz

Set of handy python utilities.

Installation

pip install python-utilz

Contents

Get size of an object

Returns total size in bytes (when you do not want full-fledged library for this).

import python_utilz as pu

print(pu.get_size([1, 2, 3]))
# 172

Convert exception to string

Show more info than just str(exc).

import python_utilz as pu

print(repr(pu.exc_to_str(TimeoutError('test'))))
# 'TimeoutError: test'

Check UUID corrects without casting

When you want to check UUID, but do not want try-except on UUID(value).

import python_utilz as pu

print(pu.is_valid_uuid('lol-kek'))
# False

Human-readable time

Created to display difference between two timestamps.

import python_utilz as pu

print(repr(pu.human_readable_time(9999999)))
# '16w 3d 17h 46m 39s'

print(repr(pu.htime(1742579085.0 - 1741924401.0)))
# '1w 13h 51m 24s'

Human-readable size

Created to display total amount of bytes in something.

import python_utilz as pu

print(repr(pu.human_readable_size(999999999)))
# '953.7 MiB'

print(repr(pu.hsize(10000000000)))
# '9.3 GiB'

Separate digits

When you want number to be more readable.

import python_utilz as pu

print(repr(pu.sep_digits(123456789)))
# '123 456 789'

Now

Returns current datetime in UTC timezone.

import python_utilz as pu

print(pu.now())
# 2025-03-21 18:13:34.954740+00:00

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

python_utilz-0.1.1.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

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

python_utilz-0.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file python_utilz-0.1.1.tar.gz.

File metadata

  • Download URL: python_utilz-0.1.1.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for python_utilz-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a6b841f2651fb62d817c805ba8609c8b6c4ef5e0042fc9567426e45af0c60da1
MD5 e0a2793e14fc694cbcfa3eaec80c3333
BLAKE2b-256 844dc382a3ff64141f5d68d00381dba7b8bf9f1edbe3a2b4523ab0c00739b025

See more details on using hashes here.

File details

Details for the file python_utilz-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for python_utilz-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d0ea52560ca7800ce9e5eb60a7251695442a00a7b9ad46cb7bc70084b9e9039a
MD5 a16f44b6fb7ad6d6a2f09f7a2149b10a
BLAKE2b-256 f519e6265b09d27246cc9295c46035f39108165dc2069c3c6635fad9eb356182

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