Skip to content

Conversation

@leavesster
Copy link
Contributor

Summary

  • Add warnings.warn() with DeprecationWarning for deprecated APIs
  • Affected methods: pkg_dir property, send_error() method

Problem

Deprecated APIs had docstring comments but no runtime warnings:

@property
def pkg_dir(self) -> str:
    """Deprecated, use pkg_data_dir instead."""
    return self.__pkg_data_dir

Users wouldn't know they're using deprecated APIs until reading docs.

Solution

Add proper deprecation warnings:

import warnings

@property
def pkg_dir(self) -> str:
    """Deprecated, use pkg_data_dir instead."""
    warnings.warn(
        "pkg_dir is deprecated, use pkg_data_dir instead",
        DeprecationWarning,
        stacklevel=2
    )
    return self.__pkg_data_dir

Test Plan

  • All existing tests pass
  • Using deprecated APIs now triggers visible warnings

Use warnings.warn with DeprecationWarning for deprecated methods:
- pkg_dir property: deprecated in favor of pkg_data_dir
- send_error method: deprecated in favor of error()

This allows users to catch deprecation warnings and migrate their code.
Copilot AI review requested due to automatic review settings January 31, 2026 09:28
@coderabbitai
Copy link

coderabbitai bot commented Jan 31, 2026

Warning

Rate limit exceeded

@leavesster has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 12 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

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 adds runtime deprecation warnings using Python's warnings.warn() for two deprecated APIs in the Context class that previously only had docstring notices. This ensures users are actively notified when using deprecated functionality.

Changes:

  • Added warnings module import
  • Added warnings.warn() calls with DeprecationWarning for pkg_dir property and send_error() method
  • Updated docstrings to use proper Sphinx deprecation directive format

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@leavesster leavesster changed the title fix: add warnings.warn for deprecated APIs fix(oocana): add warnings.warn for deprecated APIs Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants