Unavailable Object
A placeholder object for optional dependencies.
Usage
from unavailable_object import UnavailableObject
try:
import optional_module
except ImportError:
optional_module = UnavailableObject("optional_module")
Type Checking
To not disturb the type checker, the alternative definition of optional_object should be guarded by if not TYPE_CHECKING
and type annotations put in quotes:
from typing import TYPE_CHECKING
from unavailable_object import UnavailableObject
try:
import optional_module
except ImportError:
if not TYPE_CHECKING:
optional_module = UnavailableObject("optional_module")
def foo(arg: "optional_module.SomeType") -> None:
pass
Metadata
Release files for unavailable-object 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| unavailable-object-0.0.2.tar.gz | 18.8 kB | Without provenance | Details for unavailable-object-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| unavailable_object-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for unavailable_object-0.0.2-py3-none-any.whl |
Total release size: 26.0 kB
Security for unavailable-object 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.