Skip to main content

A tiny utility to test whether a value is exactly None.

Project description

is-none

PyPI version Python versions License: MIT

A minimal, deterministic utility for checking whether a value is exactly None.

Overview

is-none provides a single, explicit function for identity-based None checks in Python. It exists to make intent unambiguous in codebases where clarity, correctness, and long-term maintainability are prioritized.

The behavior is deliberately trivial and fully specified. There is no coercion, no interpretation of truthiness, and no behavior beyond an identity comparison against the singleton None.

This package is suitable for production use, testing utilities, and type-sensitive environments.


Design Principles

  • Explicit semantics
    The function performs an identity comparison (value is None) and nothing else.

  • Deterministic behavior
    The result depends solely on object identity. There are no side effects.

  • Minimal surface area
    A single public function with a stable signature.

  • Zero dependencies
    No runtime dependencies and no optional integrations.

  • Long-term stability
    The API is intentionally complete and not expected to change.


Installation

pip install is-none

Usage

from is_none import is_none

is_none(None)      # True
is_none(0)         # False
is_none("")        # False
is_none(False)     # False
is_none([])        # False

API Reference

is_none(value: Any) -> bool

Determine whether a value is exactly None.

The function uses identity comparison and does not consider other falsy values (e.g. 0, "", False, empty containers) to be equivalent to None.

Parameters

  • value (Any) The value to evaluate.

Returns

  • bool True if and only if value is None.

Rationale

In large or long-lived codebases, implicit truthiness checks can obscure intent:

if not value:
    ...

This pattern conflates None with other falsy values and can lead to subtle bugs or reduced readability.

is-none exists to make the check explicit:

if is_none(value):
    ...

This can be particularly useful in:

  • shared utility libraries
  • validation and normalization layers
  • testing and assertion helpers
  • codebases with strict linting or typing requirements

Non-Goals

The following are explicitly out of scope for this project:

  • Providing aliases such as is_not_none
  • Supporting custom sentinel values
  • Treating falsy values as equivalent to None
  • Adding configuration, flags, or environment-based behavior
  • Expanding into a general-purpose validation or typing library

If your use case requires any of the above, this package is likely not a good fit.


Versioning

This project follows Semantic Versioning.

Version 1.0.0 represents a stable, production-ready API. No breaking changes are anticipated.


Compatibility

  • Python 3.13+
  • Platform-independent
  • No reliance on implementation-specific behavior

License

This project is licensed under the MIT License. See the LICENSE file for details.


Project Status

This project is complete and maintained. No additional features are currently planned.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

is_none-1.0.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

is_none-1.0.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file is_none-1.0.0.tar.gz.

File metadata

  • Download URL: is_none-1.0.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.8

File hashes

Hashes for is_none-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cfa03acc996b2ce7964c4061af072aba6961b79ad7152be52f264736959e4ebf
MD5 312bdcd322b580b9f0e3c65eb56f5b00
BLAKE2b-256 df29258cb77ef082c0ad1aefcc099a91b115662c9c16a12bf156faf3f17c8f7d

See more details on using hashes here.

File details

Details for the file is_none-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: is_none-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.8

File hashes

Hashes for is_none-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37b50f17db19391ccce25fa4571536407c74b5e3f59399340520f87c1d93f787
MD5 9c93b115572cd6b2b755c5dd4703002a
BLAKE2b-256 391beda4f76a6a1c3d8c430d1da2589d38986d754e9491614af91ca96a70cfc2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page