pampy
The Pattern Matching for Python you always dreamed of
Decision gist · record as of 2026-08-14
Yes, if you need pattern matching and are comfortable with a dormant library. The package is tiny, has no dependencies, carries no known vulnerabilities, and works well for the specific task it solves. Install it for algorithmic code, DSL parsing, or data destructuring where it genuinely improves readability. Avoid it if you require active maintenance or have not tested it with your target Python version.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >3.6; dict-based patterns with `_` as keys rely on insertion-order guarantees.
- Installation is frictionless—a pure-Python wheel with no runtime dependencies.
- The package is dormant (last release November 2019, last commit January 2025), so it receives no active maintenance, but the small codebase (150 lines) and lack of external dependencies mean there is little surface for breakage.
License · maintenance · safety
permissive license (permissive) — Licensed under MIT (permissive), so you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
last release 2019-11-07 (2472 days) · last repo commit 2025-01-16 · 3,526 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 85,253 downloads/mo, #13,937 on PyPI
Alternatives
Verify before relying
from pampy import match, _
def fibonacci(n):
return match(n,
1, 1,
2, 1,
_, lambda x: fibonacci(x-1) + fibonacci(x-2)
)
fibonacci(5) # => 5- Whether the dormant status and 2019 release date pose compatibility risks with recent Python versions.
- Performance characteristics compared to native match statements or other pattern-matching libraries.
- Actual minimum Python version needed for all features to work correctly.
What it is and what it does
Pampy is a lightweight pattern-matching library that lets you write declarative match expressions instead of nested conditionals. It supports matching literals, types, tuples, lists, dicts, dataclasses, and typing annotations, with the special operator `_` capturing values to pass into handler functions. Patterns are evaluated in order, and you can nest structures arbitrarily—matching a tuple of integers, a dict with specific keys, or a dataclass field all work the same way.
The library is pure Python with no dependencies, making it trivial to install and use. It's useful for simplifying control flow in recursive algorithms, AST walkers, or any code that needs to branch on the shape of data. However, since the last release was in 2019 and the repository shows no active maintenance, you should verify compatibility with your target Python version before adopting it in new projects.
Use it for
- Simplify recursive algorithms like Fibonacci or tree traversal by matching on input structure instead of writing nested conditionals.
- Parse and evaluate Lisp-like expressions or simple DSLs by matching on callable, tuple, and type patterns.
- Destructure nested dicts and lists to extract values without repeated indexing or get() calls.
- Dispatch on class hierarchies (e.g., different Pet subclasses) without isinstance chains.
- Validate and extract fields from dataclasses or typed tuples in a single match expression.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need pattern matching and are comfortable with a dormant library.
The package is tiny, has no dependencies, carries no known vulnerabilities, and works well for the specific task it solves. Install it for algorithmic code, DSL parsing, or data destructuring where it genuinely improves readability. Avoid it if you require active maintenance or have not tested it with your target Python version.
Install
pampy on PyPI
Before you install
Installation is frictionless—a pure-Python wheel with no runtime dependencies. The package is dormant (last release November 2019, last commit January 2025), so it receives no active maintenance, but the small codebase (150 lines) and lack of external dependencies mean there is little surface for breakage.
Requires Python >3.6; dict-based patterns with `_` as keys rely on insertion-order guarantees.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
Quickstart
from pampy import match, _
def fibonacci(n):
return match(n,
1, 1,
2, 1,
_, lambda x: fibonacci(x-1) + fibonacci(x-2)
)
fibonacci(5) # => 5
Verify before relying
- Whether the dormant status and 2019 release date pose compatibility risks with recent Python versions.
- Performance characteristics compared to native match statements or other pattern-matching libraries.
- Actual minimum Python version needed for all features to work correctly.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >3.6 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 2,472 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 85,253 / month, #13,937 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 |
Evidence: pampy-0.3.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “match expression destructuring”
- pampyPampy provides pattern matching for Python, letting you write match…
- mo-kwargsProvides an `@override` decorator that lets you pass function…
- cronsimParses and evaluates cron expressions to find matching execution…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also pygrok · snuggs · Expression · anys · rebulk · schema · cons · overloading · methoddispatch · typing-inspect