--- id: sentinel version: "1.0.0" license: MIT license_treatment: permissive maintenance: abandoned --- # sentinel — Create sentinel objects, akin to None, NotImplemented, Ellipsis License: permissive · Maintenance: abandoned · Downloads: 146.5K/mo ## What it is and what it does Sentinel creates lightweight singleton objects that act as unique markers, similar to Python's built-in None, NotImplemented, and Ellipsis. Each sentinel is the only instance of its own anonymous class, making it safe to compare with `is` rather than `==`. This is useful when you need to distinguish a truly missing or unset value from legitimate falsy values like 0, False, or None that might actually be stored in a data structure. The package supports pickling, deepcopy, and allows you to attach custom methods and attributes to sentinels. It has an optional feature (via the varname extra) to infer sentinel names from assignment expressions, reducing boilerplate. With zero runtime dependencies and support for Python 3.6+, it's a minimal utility for cases where None alone is insufficient as a sentinel. Use it for: - Distinguish missing dictionary entries from stored None or falsy values using dict.get() with a sentinel default. - Set meaningful default values in dict.setdefault() when all other values (including 0, False, None) are valid. - Mark leaf nodes or terminal states in tree or graph structures with a singleton that can be checked with `is`. - Create self-documenting API return values that signal special conditions without overloading None or raising exceptions. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Creates singleton sentinel objects that represent special terminating conditions or symbolic meanings, allowing you to distinguish missing values from falsy ones like None, 0, or False. Yes, if you need sentinel objects for a small, self-contained utility. The package is stable, has no dependencies, and solves a real problem cleanly. However, the abandoned status (last commit 2022-07-23) means no future maintenance or Python 4 support—acceptable for a mature, narrow-scope library but worth noting if you depend on active upstream development. ## Install pip install sentinel uv add sentinel poetry add sentinel ## Installing sentinel Before you install: Low friction installation with no runtime dependencies. Package is marked abandoned (last commit 2022-07-23), though it remains stable and compatible with Python 3.6 through 3.10. License in practice: MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open and closed-source projects. Quickstart: pip install sentinel import sentinel Missing = sentinel.create("Missing") if d.get("key", Missing) is Missing: print("Key not found") Verify before relying: - Whether the abandoned status and 2022 last commit affect real-world reliability for typical use cases. - Whether python-varname extra (for name inference) remains compatible with current python-varname versions. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: abandoned - Downloads: 146.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sentinel objects python, singleton pattern implementation, missing value marker, distinguish none from missing, special symbolic objects, terminating condition marker, singleton-pattern, design-pattern [View on SkillFed](https://skillfed.io/packages/sentinel) · [View on PyPI](https://pypi.org/project/sentinel/)