Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add warnings #317

Merged
merged 1 commit into from
Jan 4, 2025
Merged

chore: add warnings #317

merged 1 commit into from
Jan 4, 2025

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Jan 4, 2025

make IDEs signal deprecated code instead of relying on runtime logs only

Summary by CodeRabbit

Release Notes

  • Deprecation Warnings

    • Added warnings for multiple modules and methods indicating upcoming removals or preferred alternative approaches
    • Notified users about deprecated import paths and methods across various components
    • Encouraged migration to newer implementation patterns and pipeline plugins
  • Code Maintenance

    • Removed deprecated import from skill launcher
    • Enhanced deprecation notification mechanisms using Python's warnings module

These changes help guide developers towards more current implementation practices while maintaining existing functionality.

make IDEs signal deprecated code instead of relying on runtime logs only
Copy link
Contributor

coderabbitai bot commented Jan 4, 2025

Walkthrough

This pull request introduces a comprehensive deprecation warning strategy across multiple files in the ovos_workshop package. The changes involve adding warnings.warn() calls to notify users about deprecated methods, classes, and import paths. The modifications aim to guide developers towards newer, preferred implementations while maintaining existing functionality. The warnings are implemented using Python's DeprecationWarning mechanism, providing clear signals about upcoming removals or changes in the codebase.

Changes

File Change Summary
ovos_workshop/backwards_compat.py Added deprecation warning at file start
ovos_workshop/decorators/__init__.py Added warning for intent_file_handler decorator
ovos_workshop/decorators/converse.py Added module-level deprecation warning
ovos_workshop/decorators/fallback_handler.py Added import deprecation warning
ovos_workshop/intents.py Added deprecation warnings for detach_intent and get_intent_names methods
ovos_workshop/skill_launcher.py Removed deprecated import from ovos_utils.log
ovos_workshop/skills/common_query_skill.py Added deprecation warning in CommonQuerySkill class
ovos_workshop/skills/intent_provider.py Added module and class-level deprecation warnings
ovos_workshop/skills/layers.py Replaced deprecation logging with warnings.warn()

Possibly related PRs

Suggested labels

breaking

Suggested reviewers

  • NeonDaniel

Poem

🐰 Deprecated code, oh what a sight!
Warnings hop in with warning's might
Guiding devs with gentle care
To newer paths beyond compare
Code evolution's rabbit dance 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Jan 4, 2025

Codecov Report

Attention: Patch coverage is 30.00000% with 14 lines in your changes missing coverage. Please review.

Project coverage is 49.27%. Comparing base (dc51ea7) to head (43bfe5b).
Report is 20 commits behind head on dev.

Files with missing lines Patch % Lines
ovos_workshop/skills/intent_provider.py 0.00% 4 Missing ⚠️
ovos_workshop/backwards_compat.py 0.00% 2 Missing ⚠️
ovos_workshop/decorators/converse.py 0.00% 2 Missing ⚠️
ovos_workshop/decorators/fallback_handler.py 0.00% 2 Missing ⚠️
ovos_workshop/intents.py 33.33% 2 Missing ⚠️
ovos_workshop/skills/layers.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #317      +/-   ##
==========================================
- Coverage   49.89%   49.27%   -0.62%     
==========================================
  Files          37       37              
  Lines        4341     4426      +85     
==========================================
+ Hits         2166     2181      +15     
- Misses       2175     2245      +70     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
ovos_workshop/skills/layers.py (1)

4-10: Use consistent deprecation messaging and document recommended alternatives.

Shifting from log_deprecation() to warnings.warn() is good for IDE integration, but ensure you specify the recommended alternative or future usage path in the message to help downstream consumers adopt new patterns quickly. Consider explicitly mentioning the correct import path or replacement function.

ovos_workshop/decorators/fallback_handler.py (1)

3-9: Align the warning message with recommended usage.

The new warning is helpful, but the message merely mentions the old import path. You may want to include guidance on where to import from instead. A more descriptive message can reduce confusion and shorten migration time.

ovos_workshop/decorators/__init__.py (1)

78-82: Ensure the deprecation message is explicit.

While the generic message references @intent_handler, consider clarifying the recommended usage pattern, e.g., "Replace @intent_file_handler(intent_file) with @intent_handler(intent_file)". This ensures a frictionless developer experience when migrating older code.

ovos_workshop/skills/intent_provider.py (1)

17-21: Appropriate use of warnings within class constructor.

Using stacklevel=2 ensures that calling code is identified correctly in the traceback. Consider pairing this warning with docstring updates to help inform users about the recommended transition process.

ovos_workshop/backwards_compat.py (1)

1-7: Well-placed deprecation warning at the file level.

Notifying developers that this file “will be removed soon” sets clear expectations. However, consider specifying the exact version or date of removal to provide an even more precise roadmap.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9fdc036 and 43bfe5b.

📒 Files selected for processing (9)
  • ovos_workshop/backwards_compat.py (1 hunks)
  • ovos_workshop/decorators/__init__.py (2 hunks)
  • ovos_workshop/decorators/converse.py (1 hunks)
  • ovos_workshop/decorators/fallback_handler.py (1 hunks)
  • ovos_workshop/intents.py (3 hunks)
  • ovos_workshop/skill_launcher.py (1 hunks)
  • ovos_workshop/skills/common_query_skill.py (2 hunks)
  • ovos_workshop/skills/intent_provider.py (2 hunks)
  • ovos_workshop/skills/layers.py (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • ovos_workshop/skill_launcher.py
🔇 Additional comments (10)
ovos_workshop/decorators/converse.py (1)

2-8: Confirm the justification for the warning.

It's good to issue a DeprecationWarning on module import; however, ensure that you have updated the documentation accordingly and provided a clear migration path. This helps developers know which module or function to switch to.

ovos_workshop/decorators/__init__.py (1)

4-4: Keep import statements consistent across all deprecation changes.

Adding warnings here is consistent with other files. Make sure that all modules implementing deprecation warnings import and log them similarly to avoid confusion.

ovos_workshop/skills/intent_provider.py (3)

7-7: Great addition of the warnings import statement.

This import is necessary to enable the newly added deprecation notifications.


9-13: Deprecation warning at module level looks good.

Issuing a deprecation warning at the module level effectively raises developer awareness of planned changes, aligning with the PR’s objective to warn about deprecated code.


65-69: Consistent deprecation strategy in IntentEngineSkill.

This warning mirrors the earlier approach in BaseIntentEngine. The approach is consistent and helps unify the codebase’s deprecation flow.

ovos_workshop/skills/common_query_skill.py (2)

21-21: Good practice to import warnings.

The import is placed in a logical position. No issues here.


63-67: Clear and user-friendly deprecation message.

The message provides a concise migration path, recommending the @common_query decorator with OVOSSkill. Ensure the documentation strongly references this path to guide users seamlessly.

ovos_workshop/intents.py (3)

6-6: warnings import looks properly introduced.

No conflicts or issues detected.


503-507: Effective nudge towards the new remove_intent method.

The message clearly communicates that the old method is deprecated. Ensure that all references to detach_intent in your codebase or documentation are updated accordingly.


622-626: Deprecation warning for get_intent_names is concise.

Excellent job directing users to the new property-based approach. Verify that any references in downstream code or docs are updated to reduce confusion.

@JarbasAl JarbasAl merged commit 43bfe5b into dev Jan 4, 2025
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant