Skip to main content

A collection of useful constants and generic functions for Python

Project description

UtilsX

uv Ruff mypy pre-commit Python 3.12

A collection of useful constants and generic functions for Python.

Available utilities:

  • 🪨 Constants: MINUTES_IN_HOUR, GRAMS_IN_LBS...
  • 📋 Dictionary operations: filtering, sorting, summation...
  • 🧮 Math operations: safe division, scaling, normalization...
  • 🗄️ Collections utils: get duplicates, check all elements are equal...
  • Common exceptions: raise if any negative values, KeyError with fix suggestions...
  • 📝 Text: add suffix with a delimiter...
  • 🇹 Type variables for you to use in custom generic functions.

Great developer experience:

  • 🐍 Installable via pip
  • 🤝 Supports all Python versions >= 3.10
  • ⛓️ Compatible with type checkers (mypy, ...)
  • 🪶 Lightweight: has no dependencies

UtilsX aims to provide convenient machinery for generic operations, so you can focus on the domain logic of your projects.

Getting started

Installation

UtilsX is available as utilsx on PyPI:

# With uv's pip interface
uv pip install utilsx

# With uv's project management interface
uv add utilsx

# With plain pip
pip install utilsx

Usage

Import components of UtilsX into your Python files and use just like any other library:

from utilsx import safe_divide

profit = 12
capital = 0

roe = safe_divide(profit, capital)
print(f"Return on equity: {roe:.0%}")
# Output: Return on equity: 0%

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

utilsx-0.0.0a3.tar.gz (59.7 kB view details)

Uploaded Source

Built Distribution

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

utilsx-0.0.0a3-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file utilsx-0.0.0a3.tar.gz.

File metadata

  • Download URL: utilsx-0.0.0a3.tar.gz
  • Upload date:
  • Size: 59.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for utilsx-0.0.0a3.tar.gz
Algorithm Hash digest
SHA256 87b5c6112254a58724e7c526419044f87f65b1410680016184f5686a9fef5054
MD5 dda5d1dba506864cfc7e0915223bb080
BLAKE2b-256 325677da64d5b75f4bf368a9df117b9d04c2c21df517143ffdcf2c283916c958

See more details on using hashes here.

File details

Details for the file utilsx-0.0.0a3-py3-none-any.whl.

File metadata

  • Download URL: utilsx-0.0.0a3-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for utilsx-0.0.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 d837a3f1a657028c9c41403acc0083f19f182df8b82f270401b9a1d1cc0962e6
MD5 d2dba6ba131ddb51edfed85b5f1351e5
BLAKE2b-256 9c61cfaec315c1103bc267389d5191fc9615cee0f36167478cf1ba8e3d51f619

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