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

planned_deprecations #254

Merged
merged 2 commits into from
Sep 5, 2024
Merged

planned_deprecations #254

merged 2 commits into from
Sep 5, 2024

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Sep 5, 2024

part of #249 review

Summary by CodeRabbit

  • New Features

    • Enhanced clarity in plugin management by removing deprecated wrapper functions, encouraging direct usage of utility functions.
    • Added a main guard in the TTS module for standalone execution of the find_tts_plugins function.
  • Bug Fixes

    • Updated deprecation messages across various modules to reflect the new versioning scheme.
  • Refactor

    • Streamlined codebase by eliminating unnecessary layers of abstraction and outdated references across multiple modules.

Copy link
Contributor

coderabbitai bot commented Sep 5, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes involve the removal of deprecated functions find_plugins and load_plugin from multiple files within the ovos_plugin_manager module. These functions previously acted as wrappers that logged deprecation warnings and redirected calls to utility functions in ovos_plugin_manager.utils. Additionally, some deprecation messages were updated to reflect a new versioning scheme. The overall focus is on streamlining the codebase by encouraging direct usage of the utility functions.

Changes

Files Change Summary
ovos_plugin_manager/__init__.py Removed find_plugins and load_plugin.
ovos_plugin_manager/audio.py Commented out deprecation warning; removed find_plugins.
ovos_plugin_manager/audio2ipa.py Removed find_plugins and load_plugin.
ovos_plugin_manager/audio_transformers.py Removed find_plugins and load_plugin.
ovos_plugin_manager/coreference.py Removed find_plugins and load_plugin.
ovos_plugin_manager/g2p.py Removed find_plugins and load_plugin.
ovos_plugin_manager/gui.py Removed find_plugins and load_plugin.
ovos_plugin_manager/keywords.py Removed find_plugins and load_plugin.
ovos_plugin_manager/language.py Removed find_plugins and load_plugin.
ovos_plugin_manager/metadata_transformers.py Removed find_plugins and load_plugin.
ovos_plugin_manager/microphone.py Removed find_plugins and load_plugin.
ovos_plugin_manager/phal.py Removed find_plugins and load_plugin.
ovos_plugin_manager/postag.py Removed find_plugins and load_plugin.
ovos_plugin_manager/segmentation.py Removed find_plugins and load_plugin.
ovos_plugin_manager/skills.py Updated deprecation warning version in get_default_skills_directory.
ovos_plugin_manager/solvers.py Removed find_plugins and load_plugin.
ovos_plugin_manager/stt.py Removed find_plugins, load_plugin, and MAPPINGS; added main guard for find_tts_plugins.
ovos_plugin_manager/templates/solvers.py Updated deprecation warning version in func_wrapper.
ovos_plugin_manager/templates/stt.py Updated deprecation warning version for various properties and methods.
ovos_plugin_manager/templates/tts.py Updated deprecation warning version for various properties and methods.
ovos_plugin_manager/tokenization.py Removed find_plugins and load_plugin.
ovos_plugin_manager/vad.py Removed find_plugins and load_plugin.
ovos_plugin_manager/wakewords.py Removed find_plugins and load_plugin.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PluginManager
    participant Utils

    User->>PluginManager: Request to find plugins
    PluginManager->>Utils: Call find_plugins()
    Utils-->>PluginManager: Return list of plugins
    PluginManager-->>User: Provide list of plugins
Loading

🐰 In the meadow, hopping with glee,
"Oh, look at the changes, so fresh and so free!
No more wrappers, just direct calls,
Streamlined and tidy, no clutter at all!
With each little hop, we embrace the new way,
Hooray for the updates, hip-hip-hooray!" 🌼


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 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.

@JarbasAl JarbasAl mentioned this pull request Sep 5, 2024
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: 1

Outside diff range, codebase verification and nitpick comments (6)
ovos_plugin_manager/audio.py (2)

Line range hint 13-18: Inconsistent use of removed function find_plugins.

The function find_plugins has been removed, but find_audio_service_plugins still references it. This will cause runtime errors.

Consider updating this function to directly use utility functions from ovos_plugin_manager.utils or remove the reference if find_plugins is indeed deprecated.

Tools
Ruff

5-5: ovos_utils.log.log_deprecation imported but unused

Remove unused import: ovos_utils.log.log_deprecation

(F401)


Line range hint 63-79: Address dependency on problematic function.

load_audio_service_plugins depends on find_audio_service_plugins, which incorrectly uses a removed function. This needs correction to avoid runtime errors.

Update the reference in load_audio_service_plugins to ensure it does not rely on deprecated or removed functionality.

Tools
Ruff

5-5: ovos_utils.log.log_deprecation imported but unused

Remove unused import: ovos_utils.log.log_deprecation

(F401)

ovos_plugin_manager/stt.py (3)

Line range hint 10-15: Remove deprecated function usage.

The function find_stt_plugins still uses find_plugins, which is marked for deprecation. Consider refactoring this to directly use utility functions from ovos_plugin_manager.utils or remove the function if it's no longer needed.

Tools
Ruff

7-7: ovos_plugin_manager.templates.stt.StreamingSTT imported but unused

Remove unused import

(F401)


7-7: ovos_plugin_manager.templates.stt.StreamThread imported but unused

Remove unused import

(F401)


Line range hint 17-23: Remove deprecated function usage.

The function load_stt_plugin still uses load_plugin, which is marked for deprecation. Consider refactoring this to directly use utility functions from ovos_plugin_manager.utils or remove the function if it's no longer needed.

Tools
Ruff

7-7: ovos_plugin_manager.templates.stt.StreamingSTT imported but unused

Remove unused import

(F401)


7-7: ovos_plugin_manager.templates.stt.StreamThread imported but unused

Remove unused import

(F401)


Line range hint 79-99: Remove deprecated function usage in class methods.

The methods get_class and create in the OVOSSTTFactory class still use load_stt_plugin, which is marked for deprecation. Consider refactoring these methods to directly use utility functions from ovos_plugin_manager.utils or remove the methods if they're no longer needed.

ovos_plugin_manager/tts.py (1)

Line range hint 81-87: Consider Using a More Secure Hashing Algorithm.

While the function get_voice_id is correctly implemented for generating unique identifiers, using MD5 is not recommended for security-sensitive applications due to known vulnerabilities. Consider using SHA-256 or another more secure hashing algorithm.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7b0d673 and a66b148.

Files selected for processing (25)
  • ovos_plugin_manager/init.py (1 hunks)
  • ovos_plugin_manager/audio.py (1 hunks)
  • ovos_plugin_manager/audio2ipa.py (1 hunks)
  • ovos_plugin_manager/audio_transformers.py (1 hunks)
  • ovos_plugin_manager/coreference.py (1 hunks)
  • ovos_plugin_manager/g2p.py (1 hunks)
  • ovos_plugin_manager/gui.py (1 hunks)
  • ovos_plugin_manager/keywords.py (1 hunks)
  • ovos_plugin_manager/language.py (1 hunks)
  • ovos_plugin_manager/metadata_transformers.py (1 hunks)
  • ovos_plugin_manager/microphone.py (1 hunks)
  • ovos_plugin_manager/phal.py (1 hunks)
  • ovos_plugin_manager/postag.py (1 hunks)
  • ovos_plugin_manager/segmentation.py (1 hunks)
  • ovos_plugin_manager/skills.py (1 hunks)
  • ovos_plugin_manager/solvers.py (1 hunks)
  • ovos_plugin_manager/stt.py (4 hunks)
  • ovos_plugin_manager/templates/solvers.py (1 hunks)
  • ovos_plugin_manager/templates/stt.py (7 hunks)
  • ovos_plugin_manager/templates/tts.py (14 hunks)
  • ovos_plugin_manager/text_transformers.py (2 hunks)
  • ovos_plugin_manager/tokenization.py (1 hunks)
  • ovos_plugin_manager/tts.py (5 hunks)
  • ovos_plugin_manager/vad.py (1 hunks)
  • ovos_plugin_manager/wakewords.py (1 hunks)
Files skipped from review due to trivial changes (21)
  • ovos_plugin_manager/init.py
  • ovos_plugin_manager/audio2ipa.py
  • ovos_plugin_manager/audio_transformers.py
  • ovos_plugin_manager/coreference.py
  • ovos_plugin_manager/g2p.py
  • ovos_plugin_manager/gui.py
  • ovos_plugin_manager/keywords.py
  • ovos_plugin_manager/language.py
  • ovos_plugin_manager/metadata_transformers.py
  • ovos_plugin_manager/microphone.py
  • ovos_plugin_manager/phal.py
  • ovos_plugin_manager/postag.py
  • ovos_plugin_manager/segmentation.py
  • ovos_plugin_manager/skills.py
  • ovos_plugin_manager/solvers.py
  • ovos_plugin_manager/templates/solvers.py
  • ovos_plugin_manager/templates/stt.py
  • ovos_plugin_manager/text_transformers.py
  • ovos_plugin_manager/tokenization.py
  • ovos_plugin_manager/vad.py
  • ovos_plugin_manager/wakewords.py
Additional comments not posted (16)
ovos_plugin_manager/audio.py (3)

Line range hint 21-27: LGTM!

The implementation of get_audio_service_configs is correct and does not use any deprecated functions.

Tools
Ruff

5-5: ovos_utils.log.log_deprecation imported but unused

Remove unused import: ovos_utils.log.log_deprecation

(F401)


Line range hint 30-38: LGTM!

The implementation of get_audio_service_module_configs is correct and does not use any deprecated functions.

Tools
Ruff

5-5: ovos_utils.log.log_deprecation imported but unused

Remove unused import: ovos_utils.log.log_deprecation

(F401)


Line range hint 41-60: LGTM!

The implementation of setup_audio_service is correct and does not use any deprecated functions.

Tools
Ruff

5-5: ovos_utils.log.log_deprecation imported but unused

Remove unused import: ovos_utils.log.log_deprecation

(F401)

ovos_plugin_manager/stt.py (5)

Line range hint 25-31: LGTM!

The function get_stt_configs aligns with the PR's objectives and does not use any deprecated functions.

Tools
Ruff

7-7: ovos_plugin_manager.templates.stt.StreamingSTT imported but unused

Remove unused import

(F401)


7-7: ovos_plugin_manager.templates.stt.StreamThread imported but unused

Remove unused import

(F401)


Line range hint 33-43: LGTM!

The function get_stt_module_configs aligns with the PR's objectives and does not use any deprecated functions.

Tools
Ruff

7-7: ovos_plugin_manager.templates.stt.StreamingSTT imported but unused

Remove unused import

(F401)


7-7: ovos_plugin_manager.templates.stt.StreamThread imported but unused

Remove unused import

(F401)


Line range hint 45-57: LGTM!

The function get_stt_lang_configs aligns with the PR's objectives and does not use any deprecated functions.

Tools
Ruff

7-7: ovos_plugin_manager.templates.stt.StreamingSTT imported but unused

Remove unused import

(F401)


7-7: ovos_plugin_manager.templates.stt.StreamThread imported but unused

Remove unused import

(F401)


Line range hint 59-65: LGTM!

The function get_stt_supported_langs aligns with the PR's objectives and does not use any deprecated functions.

Tools
Ruff

7-7: ovos_plugin_manager.templates.stt.StreamingSTT imported but unused

Remove unused import

(F401)


7-7: ovos_plugin_manager.templates.stt.StreamThread imported but unused

Remove unused import

(F401)


Line range hint 67-77: LGTM!

The function get_stt_config aligns with the PR's objectives and does not use any deprecated functions.

Tools
Ruff

7-7: ovos_plugin_manager.templates.stt.StreamingSTT imported but unused

Remove unused import

(F401)


7-7: ovos_plugin_manager.templates.stt.StreamThread imported but unused

Remove unused import

(F401)

ovos_plugin_manager/tts.py (7)

Line range hint 29-35: Function Implementation Approved.

The function get_tts_configs correctly uses utility functions to retrieve configurations for TTS plugins. This implementation is clean and adheres to best practices.


Line range hint 37-49: Function Implementation Approved.

The function get_tts_module_configs is well-implemented, using utility functions to load and sort configurations. This is a good example of clean and maintainable code.


Line range hint 51-61: Function Implementation Approved.

The function get_tts_lang_configs is correctly implemented, providing options to include dialects and using utility functions effectively. This implementation promotes code reusability and maintainability.


Line range hint 63-69: Function Implementation Approved.

The function get_tts_supported_langs is straightforward and correctly uses utility functions to retrieve supported languages for TTS plugins.


Line range hint 71-79: Function Implementation Approved.

The function get_tts_config is correctly implemented, using utility functions to retrieve configurations based on global or specific settings. This promotes flexibility and code reusability.


Line range hint 89-111: Function Implementation Approved.

The function scan_voices is well-implemented, providing a systematic way to scan and store voice configurations using JSON. This method is appropriate for the use case and promotes data integrity.


177-179: Main Guard Addition Approved.

The addition of the main guard at the end of the file enhances the script's usability as a standalone module. This is a positive change, promoting testing and direct usage.

ovos_plugin_manager/templates/tts.py (1)

736-736: Review of Deprecated Functions and Properties

The following deprecated functions and properties have been updated with a new deprecation version "1.0.0". This change is consistent across the file and aligns with the PR's objective to clarify the timeline for deprecation. Here are the specific items reviewed:

  • enclosure property (getter and setter)
  • filename property (getter and setter)
  • tts_id property
  • cache property (getter and setter)
  • get_voice method
  • get_cache method
  • clear_cache method
  • save_phonemes method
  • load_phonemes method
  • get_from_cache method
  • lang property (setter)
  • RemoteTTS class constructor

Each of these items has been marked with the updated deprecation version, and the deprecation messages are clear and informative. This update helps developers understand when these features will be removed, which is essential for planning future development and maintenance.

Also applies to: 750-750, 761-761, 773-773, 783-783, 794-794, 806-806, 816-816, 830-830, 844-844, 851-851, 868-868, 883-883, 905-905, 1189-1189

Comment on lines +8 to +10
# TODO - restore this log in next release with updated version string
#log_deprecation("ovos_plugin_manager.audio has been deprecated on ovos-audio, "
# "move to ovos_plugin_manager.media", "1.0.0")
Copy link
Contributor

Choose a reason for hiding this comment

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

Track restoration of deprecation log.

The deprecation log has been commented out with a note to restore it in the next release. It's crucial to track this task to ensure it's not forgotten.

Would you like me to open a GitHub issue to track the restoration of this deprecation log?

@JarbasAl JarbasAl merged commit 5ca16a9 into dev Sep 5, 2024
8 checks passed
@JarbasAl JarbasAl deleted the breaking/deprecations branch September 5, 2024 09:53
@coderabbitai coderabbitai bot mentioned this pull request Sep 11, 2024
@coderabbitai coderabbitai bot mentioned this pull request Nov 13, 2024
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.

1 participant