🦉 Stolas
The strict, multi-paradigm framework enabling pure functional patterns in Python.
Wisdom through pure functional patterns — Safe separation of data and behavior with monadic safety, immutability, and type-safe composition.
🦉 The S-T-O-L-A-S Framework
Struct
Fast, immutable data classes with @struct and polymorphic @trait for behavior dispatch.
Types
Safe monadic containers: Result, Option, Validated, Effect, Many
Operands
Powerful decorators: @ops, @cases, @binary, @as_result, concurrent()
Logic
Ergonomic functional combinators: get, at, where, apply, _ placeholder, and 20+ utilities
A-S
(Reserved for future expansion)
🦉 Key Features
- ✅ Strictness: Runtime type checking +
__slots__for memory efficiency - ✅ Sealed ADTs:
@casesdecorator with pattern matching and monadic compatibility - ✅ Functional Composition: Pipeline chaining with
>> - ✅ Async Concurrency: Parallel workflows with
concurrent() - ✅ Polymorphism: Trait-based dispatch for decoupled behavior
- ✅ Type Safety:
mypy --strict-clean core, plus a bundled mypy plugin for@struct/@cases(see Typing Model)
🦉 Installation
pip install stolas
🦉 Quick Example
from stolas.struct import struct
from stolas.types import Many
from stolas.operand import binary, as_result, ops
from stolas.logic import where, apply, _
# Immutable data
@struct
class User:
id: int
name: str
email: str
# Safe, curried operations
@ops(binary, as_result)
def divide(a: int, b: int) -> float:
return a / b
# Functional pipelines with placeholder
users = Many([
User(id=1, name="Alice", email="alice@example.com"),
User(id=2, name="Bob", email="bob@example.com"),
])
result = users >> where(_.id > 1) >> apply(_.name) # Many(["Bob"])
# Monadic safety
divide(10)(2) # Ok(5.0)
divide(10)(0) # Error(ZeroDivisionError(...))
🦉 Documentation
For detailed documentation, see the docs/ directory:
- Struct & Trait - Polymorphism (
@trait) and immutable data (@struct) - Monadic Types -
Result,Option,Validated,Effect,AsyncEffect,Many - Control - Effectful flow combinators:
bracket,RetryPolicy/retry, andtimeout - Operands - Decorators
@cases, theas_*safe combinators (as_result/as_option/as_validated/as_many/as_effect), and Concurrency - Logic Reference - Combinators and Placeholder (
_) - Validation - Generic field validators (
rule,matches,all_of, ...) and@struct __validators__ - Interop - Zero-dependency interop with pydantic / SQLAlchemy / msgspec via
stolas.serde,variant_from_dict, and@struct(open=True) - Typing Model - What is precisely typed, what is intentionally opaque, the bundled mypy plugin, and how to enable it in your own config
🦉 Testing
# Run tests
python -m pytest tests/
# Type checking
mypy src/stolas --strict
Status: 🦉 1113 tests passing • 100% coverage • mypy --strict-clean core + bundled plugin (the _ placeholder and dual-mode >> are intentionally opaque — see Typing Model)
🦉 License
MIT License
Metadata
Release files for stolas 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stolas-0.2.0.tar.gz | 41.6 kB | Without provenance | Details for stolas-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stolas-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for stolas-0.2.0-py3-none-any.whl |
Total release size: 97.7 kB
Release files / stolas-0.2.0.tar.gz
| Download URL | stolas-0.2.0.tar.gz |
|---|---|
| Size | 41.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d464ff4ca08b27922df671dafdaadb3598681afc546a26b2c5a065cacdc2190
|
|
BLAKE2b-256 checksum How to use checksums |
d7112cf7e0e6463043ffa7cf941b16dfd055ffa267fb53dacd30b2caa81924ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / stolas-0.2.0-py3-none-any.whl
| Download URL | stolas-0.2.0-py3-none-any.whl |
|---|---|
| Size | 56.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
700cdbf179dcd8aeaead73196953f2d17ce72a85875709cf6dcb76af2b1bd819
|
|
BLAKE2b-256 checksum How to use checksums |
2dd0ced5d424c8fe14ba31f104026db3b920fa46a02f08e95959fcb4ccad8f4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Security for stolas 0.2.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.