--- id: python-utils version: "4.0.0" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # python-utils — Python Utils is a module with some convenient utilities not included with the standard Python install License: permissive · Maintenance: active · Downloads: 20.2M/mo ## 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 above — 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 pip install python-utils uv add python-utils 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_current - Install friction: low - Maintenance: active - Downloads: 20.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags stdlib helpers and utilities, typed utility functions, async itertools helpers, number and string converters, lazy-loading utilities, smart containers and collections, time formatting and retry logic, typed-utilities, async-helpers, lazy-loading [View on SkillFed](https://skillfed.io/packages/python-utils) · [View on PyPI](https://pypi.org/project/python-utils/)