Skip to main content

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: @cases decorator 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 --strict compatibility

🦉 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:

🦉 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stolas-0.1.2.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stolas-0.1.2-py3-none-any.whl (37.6 kB view details)

Uploaded Python 3

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

Hashes for stolas-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5a9464d930930197c1f889b7ae395424c4d5c73f76e1fa4db0c8f49dadd310fd
MD5 939c55b3b5305ac3e1d0090de7c0a7f1
BLAKE2b-256 b2732f2786d9aeeb73aa0b6e2fd8799fd52b8466602520f1f4b2490f9d11fb35

See more details on using hashes here.

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

Hashes for stolas-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6a1c6584ce2e16f5a571d14651fdc7d37e4fc1d87171dd05fc0516142c5fdf9d
MD5 baadcc9bf5b218e23a6936dfe9c2d18a
BLAKE2b-256 4fe5b617a946d7b77199b3dc0f827d5cb0b845b057478d94f402bbb1c10bfa66

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page