The strict, multi-paradigm framework enabling pure functional patterns in Python.
Project description
🦉 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: Full
mypy --strictcompatibility
🦉 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(1, "Alice", "alice@example.com"),
User(2, "Bob", "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,Many - Operands - Decorators
@cases,@safe, and Concurrency - Logic Reference - Combinators and Placeholder (
_)
🦉 Testing
# Run tests
python -m pytest tests/
# Type checking
mypy src/stolas --strict
Status: 🦉 739 tests passing • 100% coverage • 100% mypy strict compliance
🦉 License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stolas-0.1.2.tar.gz.
File metadata
- Download URL: stolas-0.1.2.tar.gz
- Upload date:
- Size: 25.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a9464d930930197c1f889b7ae395424c4d5c73f76e1fa4db0c8f49dadd310fd
|
|
| MD5 |
939c55b3b5305ac3e1d0090de7c0a7f1
|
|
| BLAKE2b-256 |
b2732f2786d9aeeb73aa0b6e2fd8799fd52b8466602520f1f4b2490f9d11fb35
|
File details
Details for the file stolas-0.1.2-py3-none-any.whl.
File metadata
- Download URL: stolas-0.1.2-py3-none-any.whl
- Upload date:
- Size: 37.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a1c6584ce2e16f5a571d14651fdc7d37e4fc1d87171dd05fc0516142c5fdf9d
|
|
| MD5 |
baadcc9bf5b218e23a6936dfe9c2d18a
|
|
| BLAKE2b-256 |
4fe5b617a946d7b77199b3dc0f827d5cb0b845b057478d94f402bbb1c10bfa66
|