--- id: expression version: "5.6.0" license: MIT license_treatment: permissive maintenance: aging --- # Expression — Practical functional programming for Python 3.10+ License: permissive · Maintenance: aging · Downloads: 5.7M/mo ## What it is and what it does Expression is a functional programming library for Python 3.10+ that brings F#-inspired abstractions to Python while staying pragmatic and Pythonic. It provides tools for pipelining (composing functions into workflows), error handling via Option and Result types (enabling railway-oriented programming), immutable collections (Seq, Block, Map), pattern matching, and computational expressions—all with full type hints for static type checking. The library aims to make functional programming accessible to Python developers without requiring purely functional style or heavy abstraction. It supports both fluent (dot-chaining) and functional (pipe) syntax, allowing developers to choose their preferred style. Core use cases include building composable data transformations, handling optional and error values safely, and structuring workflows with predictable error propagation. Use it for: - Build data transformation pipelines by chaining map, filter, and fold operations on sequences. - Handle optional values and errors safely using Option and Result types instead of None checks and exceptions. - Compose reusable functions into custom operators for complex workflows. - Use pattern matching as an alternative to if-elif-else for cleaner control flow. - Integrate functional types with Pydantic models for type-safe data serialization. - Implement actor-model concurrency using the Mailbox Processor for lock-free programming. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Expression provides functional programming abstractions for Python, including pipelines, composition, error handling types (Option, Result), immutable collections, and pattern matching support. Yes, with conditions. Expression is worth installing if you want to adopt functional programming patterns in Python and are willing to require Python 3.10+. The library is stable (Production/Stable status) and permissively licensed. However, the aging maintenance status (541 days since last release) means you should verify that the library's feature set and bug-fix pace meet your project's needs before committing to it as a core dependency. ## Install pip install expression uv add expression poetry add expression ## Installing Expression Before you install: Low install friction with a single lightweight dependency (typing-extensions). Maintenance status is aging—last release was 541 days ago, though the repository remains active with a recent commit on 2025-03-11 and 766 stars. License in practice: MIT license permits commercial and private use with minimal restrictions, making it suitable for most projects. Quickstart: pip install expression from expression import pipe, Some from expression.collections import Seq, seq v = Some(1) result = v.pipe(lambda x: x.map(lambda y: y + 1)) xs = Seq.of(1, 2, 3) ys = xs.pipe(seq.map(lambda x: x * 2)) Requires Python 3.10 or later; earlier Python versions are not supported. Verify before relying: - Whether the library's type inference works reliably with mypy or Pylance in practice for complex pipelines. - Performance characteristics compared to native Python iteration for large sequences. - Adoption and community support beyond the 766 GitHub stars. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 5.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags functional programming python, option result error handling, pipeline composition, immutable collections, railway oriented programming, f# inspired python, type-safe functional abstractions, functional-programming, type-safe, f-sharp-inspired [View on SkillFed](https://skillfed.io/packages/expression) · [View on PyPI](https://pypi.org/project/expression/)