Repository navigation
feat(common): add deprecated decorator (#300) - #472
Open
borderlessboy wants to merge 1 commit into
Open
borderlessboy wants to merge 1 commit into
borderlessboy wants to merge 1 commit into
Conversation
…er#300) Add pyaml.common.deprecation.deprecated, which emits a DeprecationWarning naming the deprecated function, method or class, with an optional custom message. Works on functions, methods and classes; keeps metadata via functools.wraps. Tests in tests/common/test_deprecation.py (6 passing). Full suite: 459 passed; test_tuning_orm fails on base too (Windows temp-file PermissionError).
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue Reference
Closes #300
What Was Changed
pyaml/common/deprecation.py: newdeprecated(message=None)decorator. Works on functions, methods and classes. Each call or instantiation emits aDeprecationWarningnaming the object and the optional message. Usesfunctools.wraps, so name and docstring are kept.tests/common/test_deprecation.py: 6 tests (function, custom message, method, class, warning points at caller, metadata kept).Why Was It Changed
The issue asks for a standard way to mark functions and classes as deprecated, with a warning to developers. Nothing in the codebase did this before.
Screenshots
N/A (library code, no UI change).
Checklist
Additional Context
Verification (Windows, Python 3.12.14):
pytest tests/common/test_deprecation.py: 6 passed.pytest tests -m "not integration": 459 passed, 1 failed. The failure istests/tuning_tools/test_tuning_orm.py::test_tuning_orm(PermissionError on a Windows temp file). It also fails on the unmodified base commit, so it predates this change.ruff checkandruff format --checkon the two new files: clean.