Getting Started¶
stdlibx is a collection of Python utilities that make common patterns easier to work with. You’ve probably dealt with a lot of None checks, exception handling that’s hard to understand, and deeply nested conditionals. stdlibx helps you write cleaner code for these situations.
Philosophy¶
Solve the actual problem: Don’t push any ideology. We just make code better.
Fit into Python: Use what Python already offers. Nothing weird or foreign.
One thing per package: Pick what you need. You’re not locked in.
Keep it light: Minimal dependencies means you stay in control.
Work together: Use one package or combine them. Your choice.
Installation¶
stdlibx packages are available on PyPI. Install individually or all at once:
pip install stdlibx-result stdlibx-option stdlibx-compose
uv add stdlibx-result stdlibx-option stdlibx-compose
poetry add stdlibx-result stdlibx-option stdlibx-compose
pipenv install stdlibx-result stdlibx-option stdlibx-compose
Packages¶
Package |
What It Does |
|---|---|
Cancel long-running operations in a controlled way. Manage lifecycle, timeouts, and cleanup with explicit cancellation tokens. |
|
Compose functions into clear, left-to-right pipelines. Build readable and reusable transformations. |
|
Load and combine configuration from multiple sources. Unify environment variables, files, and defaults in one place. |
|
Work with iterables in a functional style. Map, filter, reduce, and transform data without imperative loops. |
|
Express branching logic declaratively. Replace nested if/elif chains with structured, ordered matching. |
|
Represent optional values explicitly. Avoid None checks by modeling presence and absence as a type. |
|
Model success and failure explicitly. Handle errors as values instead of relying on exceptions. |
|
Build reactive and event-driven flows. Work with data that changes over time using composable streams. |