skillfed

banal

Commons of banal micro-functions for Python.

banal v1.1.2 470.6K downloads/30d#6,483 on PyPI21
Permissive license MIT Active released

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 banal

uv

uv add banal

poetry

poetry add banal

Installing 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

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13

Tags

type checking utilities pythonlist dict type guardspython type uncertainty helpersclean null values dictensure list conversionhash data structures
type-checkingutilities

More Utilities packages