banal
Commons of banal micro-functions for Python.
What it is and what it does
banal is a lightweight utility library that exports a handful of type-checking and data-manipulation functions designed to reduce boilerplate when working with uncertain types in Python. It solves the common problem of needing to check whether a value is list-like or dict-like, ensure a value is wrapped in a list, recursively remove null values from nested dictionaries, and generate SHA1 hashes from structured data. The library has no external dependencies—it uses only the Python standard library—and is fully type-annotated to pass mypy. It's intended as a shared commons module that projects can import to avoid duplicating these small but frequently needed utilities.
The package is actively maintained, supports Python 3.10 through 3.13, and carries no known security vulnerabilities. It is small and focused, with no complex dependency tree, making it a low-risk addition to any project that needs these specific helper functions.
Use it for:
- Normalize function arguments that might be a single item or a list using ensure_list to standardize handling
- Validate or guard against type mismatches in data processing by checking is_listish or is_mapping
- Clean API responses or configuration dictionaries by recursively removing null values with clean_dict
- Generate consistent hashes of structured data for caching or deduplication using hash_data
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides type-checking and data-cleaning utility functions for Python, focused on handling type uncertainties like checking if something is list-like or dict-like, and cleaning null values from nested structures.
Yes. banal is a low-friction, zero-dependency utility library with active maintenance, no known vulnerabilities, and permissive MIT licensing. Install it if your project needs these specific type-checking or data-cleaning helpers and wants to avoid writing them yourself. The small scope and lack of external dependencies make it a safe, lightweight addition.
Install
banal on PyPI
pip
pip install banaluv
uv add banalpoetry
poetry add banalInstalling banal
Before you install
Low install friction with no runtime dependencies beyond the standard library. Repository is active with recent commits. Supports Python 3.10, 3.11, 3.12, 3.13.
License in practice
MIT license permits use in commercial and private projects with minimal restrictions; you must include the license text in distributions.
Quickstart
pip install banal
from banal import ensure_list, is_listish, clean_dict
result = ensure_list('item')
if is_listish(result):
cleaned = clean_dict({'key': None, 'nested': {'val': 1, 'null': None}})
Requires Python 3.10 or later.
Verify before relying
- Whether the type-checking functions handle all edge cases developers encounter in practice
- Performance characteristics when cleaning deeply nested dictionaries
- Adoption rate or usage patterns among projects that depend on it
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 122 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 470,604/month — #6,483 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: banal-1.1.2-py3-none-any.whl
Keywords: commons, functions, utilities
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
python-utilsA collection of fully-typed utility functions…
permissive · top 5,000 on PyPI
vonage-utilsProvides utility functions and error types for…
permissive · top 15,000 on PyPI
dm-treeProvides utilities for working with nested data…
permissive · top 5,000 on PyPI
wimpyWimpy provides a collection of commonly reused…
permissive · top 15,000 on PyPI
SQLAlchemy-UtilsProvides utility functions, custom data types,…
permissive · top 1,000 on PyPI
pyjanitorExtends pandas DataFrames with method-chainable…
permissive · top 15,000 on PyPI
commoncodeCommonCode provides utility functions for…
unclear · top 15,000 on PyPI
kitchenKitchen provides a collection of small utility…
copyleft · top 15,000 on PyPI
lamin_utilsProvides utility functions and helpers for…
permissive · top 15,000 on PyPI
resultProvides a Rust-inspired Result type for Python…
permissive · top 5,000 on PyPI