python-utils
Python Utils is a module with some convenient utilities not included with the standard Python install
What it is and what it does
Python Utils is a collection of small, production-tested utility functions and classes that package common Python patterns you'd otherwise rewrite repeatedly. It covers converters (extracting numbers and floats from strings, scaling bytes, remapping values), smart containers (self-casting dicts, duplicate-proof lists, sliceable deques), async helpers (acount, abatcher for async iteration), time utilities (formatting durations, timeout generators), and decorators (listify, sample). The package is fully typed, passes strict mypy and basedpyright checks, and ships with 100% test coverage.
Designed for minimal overhead, it uses lazy imports so importing the package itself pulls in nothing until you actually call a helper. Its single runtime dependency is typing-extensions, and it requires Python 3.10 or later. The package has powered production code for years and is used by libraries like Django Utils and progressbar2.
Use it for:
- Extract integers or floats from messy, unstructured strings without manual regex work.
- Batch async streams by size or time interval without stalling slow producers.
- Remap numeric values between ranges with optional Decimal precision for audio/video workflows.
- Format human-readable time deltas and timestamps uniformly across different input types.
- Build self-casting dicts or duplicate-proof lists to reduce validation boilerplate in data pipelines.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A collection of fully-typed utility functions and classes for common Python patterns—converters, containers, async helpers, formatters, and decorators—designed to reduce boilerplate across projects.
Yes. Low install friction, no heavy dependencies, active maintenance, permissive license, and zero known vulnerabilities make it a safe choice. The lazy-loading design and strict typing add real value for codebases that care about both performance and correctness. Install it if you find yourself repeatedly writing converters, time formatters, or async batching logic.
Install
python-utils on PyPI
pip
pip install python-utilsuv
uv add python-utilspoetry
poetry add python-utilsInstalling python-utils
Before you install
Low friction: single runtime dependency (typing-extensions, lazily imported), pure Python wheel, and active maintenance with a recent release 43 days ago.
License in practice
BSD-3-Clause permissive license allows use in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install python-utils
import python_utils
# Extract a number from a messy string
port = python_utils.to_int('listening on port=8080', regexp=True) # 8080
# Remap a value between ranges
db_level = python_utils.remap(46.0, 0.0, 100.0, -80.0, 10.0) # -38.6
Requires Python 3.10 or later.
Verify before relying
- Whether lazy loading via PEP 562 truly avoids importing typing_extensions until first use of affected helpers.
- Performance characteristics compared to hand-written equivalents or other utility libraries.
- Stability guarantees and backward-compatibility policy across major versions.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing-extensions |
| Maintenance | actively maintained — 43 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 20,241,585/month — #1,042 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_utils-4.0.0-py3-none-any.whl
Keywords: utils, utilities, helpers, typing, typed, async, lazy-imports
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
asyncstdlibProvides async-compatible versions of Python…
permissive · top 5,000 on PyPI
banalProvides type-checking and data-cleaning…
permissive · top 15,000 on PyPI
parameter-decoratorsProvides decorators that automatically convert…
copyleft · top 15,000 on PyPI
asyncstdlib-fwProvides async-compatible versions of Python…
permissive · top 15,000 on PyPI
lamin_utilsProvides utility functions and helpers for…
permissive · top 15,000 on PyPI
essentialsEssentials provides reusable core classes and…
permissive · top 15,000 on PyPI
bigA collection of small utility functions and…
permissive · top 15,000 on PyPI
sensai-utilsProvides general-purpose utility classes…
permissive · top 15,000 on PyPI
utilsProvides a collection of utility functions and…
copyleft · top 15,000 on PyPI
etilsA modular collection of utility submodules for…
permissive · top 5,000 on PyPI