Skip to main content

nullable

Typed Null support

import typing as t
from dataclasses import dataclass

from nullable import Null, NullType, Nullable, NullableNoneOr

# valid typehints:
val: int | NullType = Null
val: Nullable[int] = Null

val: int | None | NullType = Null
val: NullableNoneOr[int] = Null

# example usage:
@dataclass
class Settings:
    is_cool: bool
    countdown: t.Optional[int]

    def alter(
        self,
        *,
        is_cool: Nullable[bool] = Null,
        countdown: NullableNoneOr[int] = Null,
    ) -> None:
        if is_cool is not Null:
            self.is_cool = is_cool
        if countdown is not Null:
            self.countdown = countdown

Metadata

Release files for nullable 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nullable 0.2.0
File Size Uploaded
nullable-0.2.0.tar.gz 1.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nullable 0.2.0
File Interpreter ABI Platform
nullable-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.3 kB

Release files / nullable-0.2.0.tar.gz

Download URL nullable-0.2.0.tar.gz
Size 1.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d42011b1634750e1df528a86781f3d0abd92d2aba8211c91a9182880a1753307
BLAKE2b-256 checksum
How to use checksums
fba0f7c97dcffa9a101b0c733f1c41bd2a43a345892820f6e7f74deb8a46ec4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.8.16 Linux/5.15.0-1035-azure

Release files / nullable-0.2.0-py3-none-any.whl

Download URL nullable-0.2.0-py3-none-any.whl
Size 2.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3faea4e40fbd0b23080df2bb77113aa6a5d6eaaa148731aab73b1a045b9f35cf
BLAKE2b-256 checksum
How to use checksums
d198952254e3c02a462958bb73f725fb48c8fac1a7a0f2df9b79d585e527f72e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.8.16 Linux/5.15.0-1035-azure

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page