Preparing for system design interviews?  Try bugzed.com →

Phantom Types for Python

JSON →
library 3.0.2 ·python
verified Jun 28, 2026

phantom-types is a Python library that enables the creation of 'phantom types' to enforce type safety at compile time without incurring runtime overhead. It leverages Python's `__instancecheck__` protocol and boolean predicates to allow developers to define stricter type constraints, helping to make 'illegal states unrepresentable' and mitigate 'shotgun parsing'. The library is currently at version 3.0.2 and follows semantic versioning after its 1.0 release, with new versions released periodically to add features, fix bugs, and maintain compatibility.

total hits 10
actors 4 distinct systems
last hit 19d ago ByteDance
GPTBot
4
Script
1
ByteDance
1
Humans
1

top countries 🇺🇸 United States · 🇨🇦 Canada · 🇸🇬 Singapore · 🇩🇪 Germany