feat: add deprecation proxies for built-in types, dataclass and Enum#114
Merged
Conversation
…g objects and classes Co-authored-by: Claude code <noreply@anthropic.com>
for more information, see https://pre-commit.ci
…ests and implementation
for more information, see https://pre-commit.ci
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces new proxy-based deprecation utilities to the public API (deprecated_instance and deprecated_class) to support deprecating non-callable instances/constants and whole class objects (e.g., Enums/dataclasses) with optional target redirection, and updates docs + tests accordingly.
Changes:
- Added
src/deprecate/proxy.pyimplementing_DeprecatedProxy,deprecated_instance(), anddeprecated_class(). - Exported the new proxy utilities via
src/deprecate/__init__.pyand documented them inREADME.mdand.github/CONTRIBUTING.md. - Added new integration + unit tests and updated test collections with proxy-based deprecation examples.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
src/deprecate/proxy.py |
Implements the new proxy abstraction and the deprecated_instance / deprecated_class APIs. |
src/deprecate/__init__.py |
Re-exports the new proxy utilities as part of the public API. |
src/deprecate/audit.py |
Adds a TODO note related to audit coverage for proxies. |
README.md |
Documents deprecated_instance and deprecated_class with runnable examples and outputs. |
.github/CONTRIBUTING.md |
Adds documentation/test-writing guidance and references the new module. |
tests/collection_targets.py |
Adds a target Enum used for forwarding tests. |
tests/collection_deprecate.py |
Adds proxy-based deprecated constants and class wrappers used by integration/unit tests. |
tests/integration/test_instance.py |
Adds integration coverage for deprecated_instance behavior (warnings, read-only, etc.). |
tests/unittests/test_structures.py |
Adds unit tests for _DeprecatedProxy internals and deprecated_class behavior. |
dataclass and Enum
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
for more information, see https://pre-commit.ci
Co-authored-by: Codex <codex@openai.com>
Contributor
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (9 files)
|
… values Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
for more information, see https://pre-commit.ci
…lated tests, docs, and implementation
for more information, see https://pre-commit.ci
….parametrize` and improve warning match specificity
…rning match formatting for readability
Contributor
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Owner
Author
|
@codex[agent] implement all unresolved suggestions from the code review |
Merged
Contributor
* Initial plan * fix: address remaining proxy review feedback * test: fix audit test spacing and rerun targeted tests * test: add proxy audit edge-case coverage --------- Co-authored-by: openai-code-agent[bot] <242516109+Codex@users.noreply.github.com>
… 'import' and 'import from' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…e` references in audit tests
…ext on proxy object coverage gaps
…deprecated__` dictionaries for cleaner state management and metadata alignment
for more information, see https://pre-commit.ci
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.
Before submitting
What does this PR do?
This pull request updates the documentation and public API to introduce new proxy-based deprecation tools:
deprecated_instancefor wrapping constants and objects, anddeprecated_classfor deprecating entire Enums or dataclasses. It also adds detailed usage instructions and examples to both the README and contributing guidelines, and notes a follow-up for extending audit coverage to these new features.Documentation and API updates:
deprecated_instanceanddeprecated_classto the README, including runnable code blocks and output sections for clarity. [1] [2]src/deprecate/__init__.pyto include the new proxy functions, and re-exported them for public use. [1] [2]Contributing guidelines improvements:
proxy.pyfile. [1] [2]pytest.raises, avoiding bareassert, and not defining classes or targets inline in test files.Future audit enhancements:
audit.pynoting the need to extend audit functions to detect and validate deprecated proxy objects and constants, ensuring they are treated consistently with regular callables.Part of #109
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃