$npx skillfedfor your agent

sumtypes

Algebraic types for Python (notably providing Sum Types, aka Tagged Unions)

SkipPyPI Software DevelopmentReleased Nov 2021187.0K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — sumtypes-0.1a6-py2.py3-none-any.whl
v0.1a6 · released 2021-11-30 · 1 runtime deps: attrs

No. The package is abandoned (last commit 2021-11-30, no activity for 1718 days), and maintenance compatibility with current Python versions is unverified. For new projects, consider whether native language features or actively maintained alternatives better serve your needs.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low install friction with a single runtime dependency on attrs.
  • However, the package is abandoned as of 2021-11-30 with no commits since then, so maintenance and compatibility with modern Python versions are concerns.

License · maintenance · safety

MIT (permissive) — MIT license is permissive, allowing commercial and private use with minimal restrictions.

last release 2021-11-30 (1718 days) · last repo commit 2021-11-30 · 44 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 187,040 downloads/mo, #9,972 on PyPI

Verify before relying

pip install sumtypes

from sumtypes import sumtype, constructor, match

@sumtype
class Color(object):
    Red = constructor()
    Green = constructor()
    Blue = constructor('intensity')

red = Color.Red()
blue = Color.Blue(42)

@match(Color)
class describe(object):
    def Red(): return 'red'
    def Green(): return 'green'
    def Blue(intensity): return 'blue'
  • Whether the package works reliably with modern Python versions given its abandoned status since 2021-11-30
  • Whether attrs version compatibility has drifted and could cause runtime issues
  • Whether pattern matching remains the recommended approach or if newer Python versions offer better alternatives
Same gist for agents: .md · .json

What it is and what it does

sumtypes brings algebraic data types to Python by implementing sum types (also called tagged unions), which let you define a type with multiple named constructor variants. Each variant can carry its own set of attributes. The package builds on attrs to provide attribute validation, defaults, and other features. You decorate a class with @sumtype, define constructors as class attributes, and then instantiate them by calling those constructors; the resulting objects track which constructor was used and can be pattern-matched over all cases.

The main use case is writing code that handles multiple distinct cases of a logical type in a type-safe, exhaustive way. Instead of using strings or integers to tag variants, sum types make the structure explicit and let the match decorator verify that all cases are handled. This is particularly useful in functional programming styles or when modeling domain logic with multiple states or alternatives.

Use it for

  • Model domain types with multiple variants such as Result as Success or Failure, or AST nodes with different expression types
  • Write exhaustive pattern-matching functions over all constructor cases without risk of missing a case
  • Define state machines or state enums where each state can carry different associated data
  • Implement functional-style error handling with explicit Success and Error constructors
  • Build parsers or interpreters that need to represent different kinds of syntax tree nodes

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Skip

No.

The package is abandoned (last commit 2021-11-30, no activity for 1718 days), and maintenance compatibility with current Python versions is unverified. For new projects, consider whether native language features or actively maintained alternatives better serve your needs.

Install

sumtypes on PyPI

Before you install

Low install friction with a single runtime dependency on attrs. However, the package is abandoned as of 2021-11-30 with no commits since then, so maintenance and compatibility with modern Python versions are concerns.

License in practice

MIT license is permissive, allowing commercial and private use with minimal restrictions.

Quickstart

pip install sumtypes

from sumtypes import sumtype, constructor, match

@sumtype
class Color(object):
    Red = constructor()
    Green = constructor()
    Blue = constructor('intensity')

red = Color.Red()
blue = Color.Blue(42)

@match(Color)
class describe(object):
    def Red(): return 'red'
    def Green(): return 'green'
    def Blue(intensity): return 'blue'

Verify before relying

  • Whether the package works reliably with modern Python versions given its abandoned status since 2021-11-30
  • Whether attrs version compatibility has drifted and could cause runtime issues
  • Whether pattern matching remains the recommended approach or if newer Python versions offer better alternatives

Package facts

LicenseMIT permissive
Python supportNot specified
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
attrs
MaintenanceAbandoned 1,718 days since the last release
Last repo commit
First released
Downloads187,040 / month, #9,972 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 3

Evidence: sumtypes-0.1a6-py2.py3-none-any.whl

Tags

Capabilities
algebraic data types pythonsum types tagged unionspattern matching pythontagged union implementationconstructor variants pythonfunctional programming typesenum-like discriminated unions
Topics
algebraic-typespattern-matchingfunctional-programming

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 › “algebraic data types python”

  • sumtypesProvides algebraic data types for Python, specifically sum types…
  • ripserRipser computes persistent homology and persistence diagrams for…
  • gekkoGEKKO is a Python package for optimization and machine learning that…

Give your agent the search over MCP, or paste the wish link into any chat.

More Software Development packages

typing-extensions Worth it
PyPI · Software Development · released Jul 2026

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.

PSF-2.0pure Python · 3.9+
1.9Bdownloads / mo
numpy Worth it
PyPI · Software Development · released Aug 2026

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.

BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0compiled wheel · 3.12+
1.1Bdownloads / mo
fastapi Worth it
PyPI · Software Development · released Jul 2026

FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.

MITpure Python · 3.10+
568.6Mdownloads / mo
annotated-doc With conditions
PyPI · Software Development · released Jul 2026

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.

MITpure Python · 3.9+
456.2Mdownloads / mo
typer Worth it
PyPI · Software Development · released Aug 2026

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.

MITpure Python · 3.10+
369.3Mdownloads / mo
distlib With conditions
PyPI · Software Development · released Jun 2026

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.

permissive licensepure Python
323.3Mdownloads / mo

See also oslash · runtype · numerary · Expression · itypes · amplpy · typing-inspect · pampy · jsons · symengine