{"id":22420,"library":"sumtypes","title":"sumtypes","description":"Provides algebraic data types (sum types / tagged unions) for Python, with pattern matching support, inspired by Rust and Haskell. Current version is 0.1a6 (alpha); no release cadence established.","status":"deprecated","version":"0.1a6","language":"python","source_language":"en","source_url":"https://github.com/radix/sumtypes","tags":["algebraic types","sum types","tagged unions","pattern matching","type safety"],"install":[{"cmd":"pip install sumtypes","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"wrong":"from sumtypes import SumType","symbol":"sumtype","correct":"from sumtypes import sumtype"},{"symbol":"match","correct":"from sumtypes import match"},{"symbol":"constructor","correct":"from sumtypes import constructor"}],"quickstart":{"code":"from sumtypes import SumType, Case, Enum\n\nclass Status(SumType):\n    Active = Case()\n    Inactive = Case()\n    Pending = Case(str)\n\nstatuses = [Status.Active(), Status.Inactive(), Status.Pending(\"waiting\")]\nfor s in statuses:\n    if isinstance(s, Status.Active):\n        print(\"active\")\n    elif isinstance(s, Status.Inactive):\n        print(\"inactive\")\n    else:\n        print(f\"pending: {s.value}\")","lang":"python","description":"Define a sum type with three variants; pattern match using isinstance."},"warnings":[{"fix":"Migrate to 'adt' or 'union' library for actively maintained sum types.","message":"Library is in alpha (0.1a6) and appears unmaintained; last updated in 2015. Consider alternatives like 'union' or 'adt' for production use.","severity":"deprecated","affected_versions":"all"},{"fix":"Always check variant type via isinstance, not structural pattern matching.","message":"Avoid Python 3.10+ pattern matching (match/case) as it conflicts with sumtypes.Case naming. Use isinstance instead.","severity":"gotcha","affected_versions":"all"},{"fix":"If you need iteration, maintain a separate list of variants.","message":"sumtypes.Enum is not iterable and cannot be used like stdlib Enum. Do not call list() on it.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.1':24 'a6':25 'algebra':3,31 'alpha':26 'cadenc':29 'current':21 'data':4 'establish':30 'haskel':20 'inspir':16 'match':14,38 'pattern':13,37 'provid':2 'python':11 'releas':28 'rust':18 'safeti':40 'sum':6,33 'sumtyp':1 'support':15 'tag':8,35 'type':5,7,32,34,39 'union':9,36 'version':22","created_at":"2026-04-27T17:05:05.036466+00:00","updated_at":"2026-04-27T17:05:05.036466+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.1a6","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"http://github.com/radix/sumtypes","docs":null,"changelog":null,"pypi":"https://pypi.org/project/sumtypes/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}