skillfed

python-utils

Python Utils is a module with some convenient utilities not included with the standard Python install

python-utils v4.0.0 20.2M downloads/30d#1,042 on PyPI98
Permissive license BSD-3-Clause Active released

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-utils

uv

uv add python-utils

poetry

poetry add python-utils

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTyping :: Typed

Tags

stdlib helpers and utilitiestyped utility functionsasync itertools helpersnumber and string converterslazy-loading utilitiessmart containers and collectionstime formatting and retry logic
typed-utilitiesasync-helperslazy-loading

More Utilities packages