Skip to main content

deprecate-kwargs

formatting pytest

A Tool for Depreating (Keyword) Arguments for Python Functions.

A decorator is implemented to deprecate old kwargs in a function, with signature and docstring modified accordingly. Instead of replacing the old kwargs with new ones, this decorator makes old and new kwargs both available, with warnings raised when old kwargs are passed.

Usage Example

>>> from deprecate_kwargs import deprecate_kwargs
>>> @deprecate_kwargs([["new_arg_1", "old_arg_1"], ["new_arg_2", "old_arg_2"]])
>>> def some_func(old_arg_1: int, old_arg_2: int):
>>>     return old_arg_1 + old_arg_2
>>> some_func.__signature__
<Signature (new_arg_1:int, new_arg_2:int)>
>>> some_func(10, 20)
30
>>> some_func(new_arg_1=10, new_arg_2=20)
30
>>> some_func(old_arg_1=10, old_arg_2=20)
UserWarning: key word argument "old_arg_1" is deprecated, use "new_arg_1" instead
UserWarning: key word argument "old_arg_2" is deprecated, use "new_arg_2" instead
30

Metadata

Release files for deprecate-kwargs 0.0.1

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

Source distribution (sdist)

Source distribution for deprecate-kwargs 0.0.1
File Size Uploaded Provenance Actions
deprecate_kwargs-0.0.1.tar.gz 3.0 kB Without provenance Details for deprecate_kwargs-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for deprecate-kwargs 0.0.1
File Interpreter ABI Platform Actions
deprecate_kwargs-0.0.1-py3-none-any.whl Python 3 none any Details for deprecate_kwargs-0.0.1-py3-none-any.whl

Total release size: 6.4 kB

Release files / deprecate_kwargs-0.0.1.tar.gz

Download URL deprecate_kwargs-0.0.1.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
92b1cfe25b393ca5d1c167155e804e53dc69431b7fed8e9f5e24d93cca23c0fd
BLAKE2b-256 checksum
How to use checksums
7f9806f3820aca0b1132e69a866f66cdec4dc8de7ae43539e813991ba4fa8dc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.62.3 importlib-metadata/4.5.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.9

Release files / deprecate_kwargs-0.0.1-py3-none-any.whl

Download URL deprecate_kwargs-0.0.1-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
323122c27de304b8cccaa70172d6d1c12447db775e16109bb7a091cfb6dc2aaa
BLAKE2b-256 checksum
How to use checksums
a893726a855f7a2cd60aedb191af2004dc6cf53f6a664e5bff3aadc73b6cff04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.62.3 importlib-metadata/4.5.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.9

Security for deprecate-kwargs 0.0.1

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.

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