Registry / serialization / deprecat

deprecat

JSON →
library2.1.3pypypi✓ verified 86d ago

The `deprecat` library provides a Python `@deprecat` decorator for marking classes, functions, and methods as deprecated. It also includes functionality to deprecate specific arguments within a function using `@deprecat.deprecated_args`. Maintained on GitHub, it's currently at version 2.1.3 and has a moderate release cadence, with the latest significant updates focusing on bug fixes and new features like `remove_version`.

pip install deprecat
INSTALL
IMPORT
SIG · DEPRECAT
D
deprecat
serializationpythonv2.1.3
Install
1.9s avg
Import
42ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.043s · 18.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.9s · import 0.040s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

deprecat
from deprecat import deprecat
from deprecated import deprecated
Often confused with the similarly named but distinct `deprecated` library.

Demonstrates basic usage of the `@deprecat` decorator on functions and methods, as well as marking specific arguments as deprecated using `@deprecat.deprecated_args`.

from deprecat import deprecat import warnings @deprecat(reason="This function is old, use new_sum instead", version="2.0.0") def old_sum(a, b): return a + b class MyClass: @deprecat(reason="This method is outdated", version="2.1.0") def old_method(self): return "Hello from old method" @deprecat(reason="This function's 'b' argument is deprecated", version='2.1.1') @deprecat.deprecated_args(version='2.1.1', deprecated_argument='b') def my_func(a, b): return a * b # Suppress deprecation warnings for cleaner output in quickstart with warnings.catch_warnings(): warnings.simplefilter("ignore", DeprecationWarning) print(f"Old sum: {old_sum(1, 2)}") obj = MyClass() print(f"Old method output: {obj.old_method()}") print(f"Function with deprecated arg: {my_func(3, b=4)}")
Debug
Known issues
gotchaThe `deprecat` library is distinct from the similarly named `deprecated` library. Ensure you import `from deprecat import deprecat` to use this library's specific features, particularly `deprecated_args`.
fix
Always use `from deprecat import deprecat`. If you previously used the `deprecated` library, note that `deprecat` might have different behavior or features.
affects: All versions
gotchaWhen using `@deprecat` without any arguments (e.g., just marking something as deprecated without specifying a reason or version), you must still include the parentheses: `@deprecat()`. Omitting them (`@deprecat`) will cause the decorator to not apply correctly or raise a `TypeError`.
fix
Ensure the decorator is always called, even if with empty parentheses: `@deprecat()`.
affects: All versions
gotchaThe `deprecated_args` functionality is available as an attribute of the `deprecat` decorator (i.e., `deprecat.deprecated_args`). It is not directly importable as `from deprecat import deprecated_args`.
fix
Import `deprecat` as `from deprecat import deprecat` and then use it as `@deprecat.deprecated_args(...)`.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'deprecated'
Attempting to import `deprecated` when `deprecat` is intended, or the wrong library is installed.
fix
Ensure you have installed `deprecat` (`pip install deprecat`) and are importing it correctly: `from deprecat import deprecat`.
TypeError: 'NoneType' object is not callable
Attempting to use `@deprecat` without calling it (i.e., omitting `()` when no arguments are passed).
fix
Always call the decorator, even if with empty parentheses: `@deprecat()`.
Upgrade
Version history
2.1.3latest on PyPI · released Jul 24, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
deprecat — pip install deprecat · libregistry