Skip to main content

Qblox-deprecation

Useful decorators to mark functions, classes, parameters, etc, as deprecated.

Examples

from qblox_deprecation.deprecate import (
    deprecate_positional_args_from,
    deprecated,
    deprecated_arg_alias,
)


def new_function(foo):
    return foo + foo


# Emit a future warning and call new_function instead
@deprecated("1.0", new_function)
def deprecated_function():
    return foo * foo


# Emit a future warning, extended with the message, and call the original function.
@deprecated("1.0", "Please use new_function instead.")
def deprecated_function():
    return 2


class NewClass:
    def __init__(self) -> None:
        pass


# Emit a future warning and construct an instance of NewClass instead
@deprecated("1.0", NewClass)
class OldClass:
    def __init__(self) -> None:
        pass


# Emit a future warning, extended with the message, and use the original class.
@deprecated("1.0", "Please use NewClass instead.")
class OldClass:
    def __init__(self) -> None:
        self.foo = "foo"


# Emit a future warning, and replace any usage of 'quux' with 'baz'.
@deprecated_arg_alias("1.3", quux="baz")
def foo(bar, baz, qux):
    pass


# Emit a future warning if any argument after 'b' is specified as a positional argument.
# This prepares for a refactor to `my_func(a, b, *, c, d)`
@deprecate_positional_args_from("c")
def my_func(a, b, c, d):
    pass


# You can use it on classes too!
@deprecate_positional_args_from("c")
class MyClass:
    def __init__(self, a, b, c, d):
        pass

Fixtures

The package also contains optional fixtures. Install qblox-deprecation with the optional [pytest] dependency to use them. Examples:

# pyproject.toml
[tool.pytest]
markers = ["deprecated"]
# conftest.py
from qblox_deprecation.fixtures import handle_deprecated_marker


# test_xyz.py
@pytest.mark.deprecated("1.13", "my-package")
def test_xyz(): ...

Metadata

Release files for qblox-deprecation 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 qblox-deprecation 0.2.0
File Size Uploaded Provenance Actions
qblox_deprecation-0.2.0.tar.gz 87.7 kB Without provenance Details for qblox_deprecation-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 94.0 kB

Release files / qblox_deprecation-0.2.0.tar.gz

Download URL qblox_deprecation-0.2.0.tar.gz
Size 87.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2180e1fa05540c37e428b1047cb276c414dbb091bda001e3830323c4cdcb3d73
BLAKE2b-256 checksum
How to use checksums
43197b0060f7238c5021650e2af834e07c15d0a3fa0eb38dba5f0235e75c5104
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL qblox_deprecation-0.2.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7cb57e09d4381549a394084bfa696ca4ef6c1a6d269ece6e4cf4f511ba95a0c4
BLAKE2b-256 checksum
How to use checksums
2fcf08ad0541e352dfdf429a4af7f1387a99036802b4c00e5288d791fa10facd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for qblox-deprecation 0.2.0

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