skillfed

Expression

Practical functional programming for Python 3.10+

expression v5.6.0 5.7M downloads/30d#2,062 on PyPI766
Permissive license MIT AGING released

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 on this page — 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

expression on PyPI

pip

pip install expression

uv

uv add expression

poetry

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 the current Python release (<4,>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — typing-extensions
Maintenance aging — 541 days since the last release
Last repo commit
First released
Downloads 5,652,649/month — #2,062 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: expression-5.6.0-py3-none-any.whl

Development Status :: 5 - Production/StableEnvironment :: Other EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Libraries :: Python Modules

Tags

functional programming pythonoption result error handlingpipeline compositionimmutable collectionsrailway oriented programmingf# inspired pythontype-safe functional abstractions
functional-programmingtype-safef-sharp-inspired

More Python Modules packages