sentinel
Create sentinel objects, akin to None, NotImplemented, Ellipsis
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 on this page — 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
sentinel on PyPI
pip
pip install sentineluv
uv add sentinelpoetry
poetry add sentinelInstalling 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 the current Python release (>=3.6,<4.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,483 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 146,455/month — #11,098 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sentinel-1.0.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
niltypeProvides a `Nil` singleton object to represent…
permissive · top 15,000 on PyPI
nulltypeDefines custom null and sentinel values that…
permissive · top 5,000 on PyPI
sentinelsProvides singleton sentinel objects with…
permissive · top 5,000 on PyPI
solusProvides thread-safe and thread-unsafe…
permissive · top 15,000 on PyPI
Redis-Sentinel-UrlParses redis:// and redis+sentinel:// URLs and…
permissive · top 15,000 on PyPI
redis-cliProvides a lightweight wrapper around redis-py…
permissive · top 15,000 on PyPI
singleton-decoratorProvides a decorator that enforces singleton…
copyleft · top 15,000 on PyPI
func_argsProvides sentinel values (REQ and OPT) and…
permissive · top 5,000 on PyPI
iteratorsWraps Python iterators to add timeout behavior,…
permissive · top 15,000 on PyPI
sentinelhubsentinelhub provides a Python interface to…
permissive · top 15,000 on PyPI