--- id: niltype version: "1.0.2" license: MIT license_treatment: permissive maintenance: dormant --- # niltype — A singleton Nil object to represent missing values when None is a valid data value License: permissive · Maintenance: dormant · Downloads: 100.1K/mo ## What it is and what it does NilType provides a `Nil` singleton—a distinct sentinel value for representing the absence of data when `None` itself is a meaningful value in your data model. This solves a real problem in Python: when your domain allows `None` as a valid entry (e.g., a database field that can legitimately store null), you need a separate marker to mean 'no value provided' or 'undefined'. The package exports `Nil` for identity checks and a `Nilable` type alias for type annotations. The typical use case is function signatures where you want to distinguish between an explicit `None` argument and no argument at all. For example, a `get()` function can use `Nil` as its default parameter value, then check `if default is not Nil` to know whether the caller passed something. The package is minimal—no dependencies, pure Python, and typed—making it a lightweight addition to any codebase that needs this pattern. Use it for: - Default function parameters: distinguish between an explicit `None` and an unspecified argument using `Nil` as the default. - Data model fields: represent missing or undefined values in classes or dataclasses where `None` is a valid stored value. - Optional configuration: mark configuration values as explicitly unset (Nil) versus set to None or a default. - Type-hinted optional values: use `Nilable[T]` in function signatures to document that a value can be a type or Nil. - Sentinel-based control flow: use identity checks (`is Nil`) to branch on whether a value was explicitly provided. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a `Nil` singleton object to represent missing or undefined values in situations where `None` is itself a valid data value and cannot be used as a sentinel. Yes, if you have a codebase where `None` is a valid data value and you need a distinct sentinel. The package is tiny, has no dependencies, is MIT-licensed, and solves a real semantic problem. Dormant maintenance is not a concern for a single-purpose utility with no external dependencies. Install it if the pattern fits your domain; skip it if you can use a different sentinel (e.g., a custom class) or if `None` is always sufficient. ## Install pip install niltype uv add niltype poetry add niltype ## Installing niltype Before you install: Low friction: pure Python wheel with no runtime dependencies. Maintenance is dormant—last commit was 2024-09-21 and no activity since, though the repository remains open and the package is typed. License in practice: MIT license (permissive) places no restrictions on use, modification, or redistribution in commercial or private projects. Quickstart: pip install niltype from niltype import Nil if x is Nil: print("x is missing") Verify before relying: - Whether Nil works correctly with type checkers (mypy, pyright) beyond the Nilable type alias provided - Performance characteristics when used in tight loops or large data structures - Compatibility with pickle, dataclass, or other serialization frameworks ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 100.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sentinel value for missing data, nil object python, distinguish none from missing, null placeholder when none is valid, optional value without overloading none, missing data representation, sentinel-value, type-hints [View on SkillFed](https://skillfed.io/packages/niltype) · [View on PyPI](https://pypi.org/project/niltype/)