Skip to content

feat: add deprecation proxies for built-in types, dataclass and Enum#114

Merged
Borda merged 30 commits into
mainfrom
feat/structs
Mar 2, 2026
Merged

feat: add deprecation proxies for built-in types, dataclass and Enum#114
Borda merged 30 commits into
mainfrom
feat/structs

Conversation

@Borda

@Borda Borda commented Mar 1, 2026

Copy link
Copy Markdown
Owner
Before submitting
  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

What does this PR do?

This pull request updates the documentation and public API to introduce new proxy-based deprecation tools: deprecated_instance for wrapping constants and objects, and deprecated_class for 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:

  • Added documentation and usage examples for deprecated_instance and deprecated_class to the README, including runnable code blocks and output sections for clarity. [1] [2]
  • Updated the API reference in src/deprecate/__init__.py to include the new proxy functions, and re-exported them for public use. [1] [2]

Contributing guidelines improvements:

  • Added a guideline to always use full import paths with Sphinx cross-reference syntax in docstrings, and updated the module structure to include the new proxy.py file. [1] [2]
  • Expanded testing guidelines to clarify the three-layer separation and rules for README example tests, especially regarding the use of pytest.raises, avoiding bare assert, and not defining classes or targets inline in test files.

Future audit enhancements:

  • Added a TODO in audit.py noting 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 🙃

…g objects and classes

Co-authored-by: Claude code <noreply@anthropic.com>
Comment thread tests/integration/test_instance.py Fixed
@Borda Borda added the enhancement New feature or request label Mar 2, 2026
@Borda Borda marked this pull request as ready for review March 2, 2026 00:24
Copilot AI review requested due to automatic review settings March 2, 2026 00:24
@dosubot

dosubot Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Related Documentation

Checked 1 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@dosubot dosubot Bot added documentation Improvements or additions to documentation tests labels Mar 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py implementing _DeprecatedProxy, deprecated_instance(), and deprecated_class().
  • Exported the new proxy utilities via src/deprecate/__init__.py and documented them in README.md and .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.

Comment thread src/deprecate/proxy.py
Comment thread README.md Outdated
Comment thread src/deprecate/audit.py Outdated
Comment thread tests/collection_deprecate.py Outdated
Comment thread tests/unittests/test_structures.py Outdated
Comment thread tests/unittests/test_proxy.py
Comment thread .github/CONTRIBUTING.md Outdated
Comment thread src/deprecate/proxy.py Outdated
Comment thread tests/collection_deprecate.py Outdated
@Borda Borda changed the title feat: add target redirection for deprecation proxies feat: add deprecation proxies for built-in types, dataclass and Enum Mar 2, 2026
Borda and others added 4 commits March 2, 2026 07:26
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Codex <codex@openai.com>
@Borda Borda requested a review from Copilot March 2, 2026 07:07
Comment thread tests/integration/test_instance.py Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Comment thread src/deprecate/audit.py Outdated
Comment thread tests/integration/test_instance.py Outdated
Comment thread src/deprecate/proxy.py
Comment thread src/deprecate/proxy.py
Comment thread src/deprecate/proxy.py
Comment thread README.md Outdated
Comment thread tests/integration/test_audit.py Fixed
Comment thread tests/integration/test_instance.py Outdated
Comment thread src/deprecate/proxy.py Outdated
@kilo-code-bot

kilo-code-bot Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
tests/integration/test_instance.py 154 Comparison of identical values

WARNING

File Line Issue
src/deprecate/proxy.py 132 Incorrect comment
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
src/deprecate/proxy.py 240 len uses source object even when target is set, while iter uses active object (target if set) - this inconsistency is noted as intentional in tests but should be documented
README.md 490 Example wraps a float constant but notes that arithmetic operations don't work - consider clarifying that proxy doesn't implement arithmetic dunder methods
Files Reviewed (9 files)
  • src/deprecate/proxy.py - 1 issue
  • tests/integration/test_instance.py - 1 issue
  • README.md - documentation concern
  • src/deprecate/__init__.py - no issues
  • src/deprecate/audit.py - no issues
  • tests/collection_deprecate.py - no issues
  • tests/collection_targets.py - no issues
  • tests/integration/test_audit.py - no issues
  • tests/unittests/test_proxy.py - no issues
  • .github/CONTRIBUTING.md - no issues

Borda and others added 7 commits March 2, 2026 09:33
… 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>
….parametrize` and improve warning match specificity

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.

Comment thread src/deprecate/proxy.py Outdated
Comment thread src/deprecate/audit.py Outdated
Comment thread src/deprecate/proxy.py Outdated
Comment thread tests/unittests/test_proxy.py Outdated
Comment thread tests/unittests/test_proxy.py Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread tests/integration/test_audit.py Outdated

Copilot AI commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

@Borda I've opened a new pull request, #115, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Borda

Borda commented Mar 2, 2026

Copy link
Copy Markdown
Owner Author

@codex[agent] implement all unresolved suggestions from the code review

@Codex Codex AI mentioned this pull request Mar 2, 2026
@Codex

Codex AI commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

@Borda I've opened a new pull request, #116, to work on those changes. Once the pull request is ready, I'll request review from you.

* 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>
Comment thread tests/integration/test_audit.py Fixed
Borda and others added 7 commits March 2, 2026 11:43
… 'import' and 'import from'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…deprecated__` dictionaries for cleaner state management and metadata alignment
@Borda Borda merged commit de3be7f into main Mar 2, 2026
33 of 34 checks passed
@Borda Borda deleted the feat/structs branch March 2, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants