fix(deps): remove unmaintained deprecation package, use stdlib instead#1999
Conversation
…lacement The `deprecation` package (>=2.1.0,<3.0.0) has had no release since 2019 and is flagged as a security / maintenance risk by dependency scanners. The package was only used in one file (`weaviate/collections/batch/client.py`) to add docstring notes and emit `DeprecationWarning` at call time. This PR removes the external dependency and replaces it with an equivalent `docstring_deprecated` helper implemented entirely with stdlib (`functools`, `warnings`). The public behaviour is unchanged: * The function docstring gets a `.. deprecated::` RST prefix. * Calling the function emits a :class:`DeprecationWarning`. The `typing_extensions.deprecated` import (already present) is kept because it provides static analysis / IDE warnings via the `__deprecated__` attribute. Fixes weaviate#1998 Signed-off-by: NIK-TIGER-BILL <nik.tiger.bill@github.com>
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
|
To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge. |
|
I agree to the Contributor License Agreement (CLA). ✅ |
|
Hey, thanks for contributing! I had a quick look, but we use the deprecated package in more places:
Could you:
|
… 6 files Per maintainer feedback (@dirkkul), consolidate the stdlib deprecation helper into weaviate/util.py so all modules share a single implementation. Changes: - weaviate/util.py: add docstring_deprecated() function - weaviate/collections/batch/client.py: remove inline definition, import from util - weaviate/collections/batch/collection.py: replace 'from deprecation import...' - weaviate/connect/helpers.py: replace 'from deprecation import...' - weaviate/collections/classes/config.py: replace 'from deprecation import...' - weaviate/collections/classes/config_vectorizers.py: replace 'from deprecation import...' - weaviate/collections/classes/config_named_vectors.py: replace 'from deprecation import...' The 'deprecation' package is now fully removed from the codebase. Signed-off-by: NIK-TIGER-BILL <nik.tiger.bill@github.com>
|
Thanks for the thorough review @dirkkul! Updated in the latest commit:
The |
|
@dirkkul any chance to priortize release of this change? |
There was a problem hiding this comment.
Pull request overview
This PR removes the unmaintained deprecation dependency and replaces its usage with a local stdlib-based docstring_deprecated decorator to preserve runtime deprecation warnings and docstring annotations across the client.
Changes:
- Dropped
deprecationfromsetup.cfgruntime dependencies. - Added
weaviate.util.docstring_deprecated()as an internal replacement usingfunctools+warnings. - Updated all prior
deprecation.deprecatedimports to useweaviate.util.docstring_deprecated.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| weaviate/util.py | Adds the stdlib replacement decorator that mutates docstrings and emits DeprecationWarning. |
| weaviate/connect/helpers.py | Switches docstring_deprecated import to the new helper. |
| weaviate/collections/classes/config.py | Switches docstring_deprecated import to the new helper. |
| weaviate/collections/classes/config_vectorizers.py | Switches docstring_deprecated import to the new helper. |
| weaviate/collections/classes/config_named_vectors.py | Switches docstring_deprecated import to the new helper. |
| weaviate/collections/batch/collection.py | Switches docstring_deprecated import to the new helper. |
| weaviate/collections/batch/client.py | Switches docstring_deprecated import to the new helper. |
| setup.cfg | Removes deprecation from install_requires. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dirkkul
left a comment
There was a problem hiding this comment.
Two more comment, I think we can merge afterwards
…p deprecation from dev deps - Remove **_kwargs parameter from docstring_deprecated() since all call sites use only 'details' and 'deprecated_in' keyword args - Move docstring modification to wrapper instead of original func to preserve the original function's __doc__ - Remove deprecation==2.1.0 from requirements-devel.txt to fully eliminate the unmaintained dependency Signed-off-by: NIK-TIGER-BILL <nik.tiger.bill@github.com>
|
Thanks again for this contribution! |
Summary
Removes the
deprecationpackage dependency and replaces its single usage with an inline stdlib helper.Fixes #1998
Motivation
The
deprecationpackage:weaviate/collections/batch/client.py) for two decoratorsChanges
setup.cfgRemoved:
weaviate/collections/batch/client.pyReplaced
from deprecation import deprecated as docstring_deprecatedwith an inlinedocstring_deprecated()helper using only stdlib (functools,warnings).The helper provides identical runtime behaviour:
.. deprecated::RST note to the wrapped function's docstring.DeprecationWarningat call time (same as the original package).The
typing_extensions.deprecatedimport (already present, unchanged) continues to provide static-analysis / IDE warnings via the__deprecated__attribute.Testing
All existing tests for the deprecated
experimental()anddynamic()methods should pass without modification — the runtime behaviour is identical.