A collection of useful constants and generic functions for Python
Project description
UtilsX
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...
- 📊 Visual utilities: how many bins to plot?
- 🗄️ Collections utils: get duplicates, check all elements are equal...
- ⛔ Common exceptions: raise if any negative values,
KeyErrorwith 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file utilsx-0.0.0a1.tar.gz.
File metadata
- Download URL: utilsx-0.0.0a1.tar.gz
- Upload date:
- Size: 51.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4ce1df3b633921a3bb8597c338f2194933a7824f1ac57603a508155a477bfbf
|
|
| MD5 |
8135654524d6878dbc67a6d4890daa11
|
|
| BLAKE2b-256 |
678e05f8f893d417d04ee8ff4ec18b7248559ce833801b4430430be897e2e41a
|
File details
Details for the file utilsx-0.0.0a1-py3-none-any.whl.
File metadata
- Download URL: utilsx-0.0.0a1-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
365e6e6f6822b8c2d9dcb445b78cf724d4d58e24ac9faadd10cb13528efe685a
|
|
| MD5 |
b4fd6a0dde5ef494c8ce29f145bdbf36
|
|
| BLAKE2b-256 |
6a2deee41a0af936f55aced934a003a28a189f5d773e36da618b2640817f0023
|