Skip to main content

libb-util

Documentation

libb

Python utility library with Rust-accelerated functions for text processing, iteration, dictionary sorting, and number parsing.

pip install libb-util

Quick Reference

from libb import Setting, compose, attrdict, timeout
from libb import multikeysort, numify, parse

# Configuration with dot notation
config = Setting()
config.database.host = 'localhost'
config.lock()

# Function composition
add_then_multiply = compose(lambda x: x * 2, lambda x: x + 1)
result = add_then_multiply(5)  # (5 + 1) * 2 = 12

# Attribute dictionary
d = attrdict(x=10, y=20)
print(d.x)  # 10

# Timeout decorator
@timeout(5)
def slow_function():
    pass

Installation

pip install libb-util

# With extras
pip install "libb-util[pandas,text,web,math]"

Available Extras

Extra Description
pandas DataFrame utilities with pyarrow
text Text processing (ftfy, rapidfuzz, chardet)
web Web frameworks (Flask, Twisted, web.py)
math Matplotlib charting
ldapauth Active Directory LDAPS authentication (ldap3)
tokenauth DynamoDB-backed API token registry (boto3)
test Testing tools (pytest, asserts)
docs Sphinx documentation

Core Modules

Configuration

Function/Class Description
Setting() Hierarchical config with dot notation and locking
attrdict(**kw) Dict with attribute access
dictobj(**kw) Immutable dict with attribute access

Function Utilities

Function Description
compose(*funcs) Right-to-left function composition
timeout(seconds) Decorator to limit function execution time
retry(tries, delay) Decorator for retry with exponential backoff
memoize(func) Cache function results
once(func) Execute function only once

Dictionary Operations (Rust-accelerated)

Function Description
multikeysort(items, columns) Sort list of dicts by multiple keys
numify(val, to=int) Convert string to number with format handling
parse(s) Extract number from string
# Rust-accelerated sorting
data = [{'name': 'Alice', 'age': 30}, {'name': 'Bob', 'age': 25}]
multikeysort(data, ['age', '-name'])  # Sort by age asc, name desc

# Number parsing handles accounting formats
parse('1,200')      # 1200
parse('(500)')      # -500  (accounting negative)
parse('100.5%')     # 100.5

Iteration (Rust-accelerated)

Function Description
chunked(iterable, n) Split into chunks of size n
collapse(*args) Recursively flatten nested lists/tuples ⚡
backfill(values) Fill None values with last non-None ⚡
backfill_iterdict(iterdict) Back-fill dicts with latest values per key ⚡
same_order(ref, comp) Check if elements appear in same order ⚡
unique(iterable) Unique items preserving order

⚡ = Rust-accelerated

Text Processing (Rust-accelerated)

Function Description
sanitize_vulgar_string(s) Replace vulgar fractions with decimals ⚡
uncamel(camel) Convert CamelCase to snake_case ⚡
underscore_to_camelcase(s) Convert snake_case to camelCase ⚡
normalize(text) Unicode normalization
slugify(text) URL-safe slug
strip_html(text) Remove HTML tags
truncate(text, length) Truncate with ellipsis

⚡ = Rust-accelerated

I/O and Paths

Function Description
ensure_dir(path) Create directory if not exists
safe_filename(name) Sanitize filename
temp_file(**kw) Context manager for temp files
atomic_write(path) Atomic file write context

Concurrency

Function Description
threaded(func) Run function in thread
parallel_map(func, items) Parallel execution
Semaphore(n) Limit concurrent access

Process Management

Function Description
run_cmd(cmd) Execute shell command
is_running(pid) Check if process exists
kill_tree(pid) Kill process and children

Classes

OrderedSet

Set that maintains insertion order:

from libb import OrderedSet

s = OrderedSet([1, 2, 3, 2, 1])
list(s)  # [1, 2, 3]

Heap

Min/max heap implementations:

from libb import MinHeap, MaxHeap

h = MinHeap([3, 1, 4, 1, 5])
h.pop()  # 1

Documentation

Full documentation at bissli.github.io/libb-util:


Development

# Install dev dependencies
pip install -e ".[test,docs]"

# Build Rust extension
maturin develop

# Run tests
pytest

License

See LICENSE file.

Metadata

Release files for libb-util 0.0.54

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for libb-util 0.0.54
File
libb_util-0.0.54-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
libb_util-0.0.54-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ ARM64 Details
libb_util-0.0.54-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
libb_util-0.0.54-cp310-cp310-macosx_10_12_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.12+ x86-64 Details

Total release size: 3.5 MB

Release files / libb_util-0.0.54-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL libb_util-0.0.54-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 918.6 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
87b4df1909279a038c01f34b755ebb7fa6831ec440f5b6d86de961a92bcb1d93
BLAKE2b-256 checksum
How to use checksums
b02d0692c4d85ae9a81b627a192caab576f883aa89a7d53e1a479e6e3ed55ea1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Release files / libb_util-0.0.54-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL libb_util-0.0.54-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 874.0 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
273fb41e22084f1dc6b98cd474e070239d4c1113a95fd90342c5f7793af68cd9
BLAKE2b-256 checksum
How to use checksums
7ef7123bdf8f00b9a1d0a8b4a7b557d2a9fcf2fbe21f8b3a2aa87ebef4d12fa4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Release files / libb_util-0.0.54-cp310-cp310-macosx_11_0_arm64.whl

Download URL libb_util-0.0.54-cp310-cp310-macosx_11_0_arm64.whl
Size 830.0 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
148ce9339d312926067900230a87314fd81c435693a11a6deef68c5915eca95b
BLAKE2b-256 checksum
How to use checksums
757edd84e3d4b902ffa512aa07b3d80ac8953b4fb9c019e90bc1d2cd7965932f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Release files / libb_util-0.0.54-cp310-cp310-macosx_10_12_x86_64.whl

Download URL libb_util-0.0.54-cp310-cp310-macosx_10_12_x86_64.whl
Size 875.4 kB
Tags CPython 3.10 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
286cd95ed120c70cbfa89b7c5c44c5c35215efd0f381aaabbb7fd1c8af28e3c9
BLAKE2b-256 checksum
How to use checksums
10922dca20bc3daf6df3ff33e0367cb6e5694eb457d9da7ff8f723f169cde09e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.54 This release

4 release files

0.0.9

35 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page