-
Notifications
You must be signed in to change notification settings - Fork 9
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 #321
chore: add warnings #321
Conversation
make IDEs signal deprecated code instead of relying on runtime logs only
Warning Rate limit exceeded@JarbasAl has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 45 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📒 Files selected for processing (3)
WalkthroughThis pull request introduces a comprehensive deprecation warning strategy across multiple modules in the Changes
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (1)
ovos_utils/signal.py (1)
5-13
: Minor formatting nitpick in the warning message.There's a stray backtick in
"ovos_utils.signal module has been deprecated without replacement\
"`. Removing it will make this message cleaner. Everything else looks good for indicating a total module deprecation.-warnings.warn( - "ovos_utils.signal module has been deprecated without replacement`", - DeprecationWarning, - stacklevel=2, -) +warnings.warn( + "ovos_utils.signal module has been deprecated without replacement", + DeprecationWarning, + stacklevel=2, +)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
ovos_utils/__init__.py
(2 hunks)ovos_utils/bracket_expansion.py
(8 hunks)ovos_utils/fakebus.py
(2 hunks)ovos_utils/messagebus.py
(1 hunks)ovos_utils/network_utils.py
(2 hunks)ovos_utils/ocp.py
(2 hunks)ovos_utils/signal.py
(1 hunks)ovos_utils/system.py
(7 hunks)
🔇 Additional comments (22)
ovos_utils/messagebus.py (1)
7-14
: Good addition of a direct deprecation warning.You have successfully introduced a
DeprecationWarning
in addition to the existinglog_deprecation
call. This dual approach provides broader coverage, ensuring that both logs and IDEs highlight the deprecated status.ovos_utils/network_utils.py (1)
6-6
: Consistent deprecation strategy.Importing
warnings
at line 6 and adding a directwarnings.warn
call for theis_connected
function aligns with the rest of the PR changes. This ensures IDEs and tooling can easily identify its deprecated status.Also applies to: 134-138
ovos_utils/__init__.py (1)
18-18
: Deprecation warning complements log_deprecation.Importing
warnings
and emitting aDeprecationWarning
forget_handler_name
mirrors the approach in other modules. This will better surface the deprecation in IDEs and user environments.Also applies to: 155-159
ovos_utils/bracket_expansion.py (8)
4-4
: No issues with warnings import.
This import is necessary to raise deprecation warnings and is consistent with Python best practices.
95-99
: Good use ofwarnings.warn
withDeprecationWarning
.
The stack level is set to 2, ensuring the warning points to the caller's frame. This helps developers locate where the deprecated function is being invoked.
112-116
: Deprecation added consistently.
Same approach is repeated with appropriate stack level inexpand_options
. This is clear and consistent with the rest of the code.
134-138
: Constructor deprecation warning is clear.
Notifies callers that they should useexpand_template
instead. The message is straightforward and helps nudge users toward the new implementation.
169-173
: Deprecation inWord
constructor is consistent.
This maintains consistency across constructors by providing the same warning message as other classes.
195-199
: Consistent approach forSentence
constructor.
The repeated pattern ofwarnings.warn
usage is appropriate for large-scale deprecation.
230-234
: Consistent deprecation message forOptions
.
Clear, concise, and includes the replacement guidance.
258-262
: Deprecation inSentenceTreeParser.__init__
.
All references now consistently point toexpand_template
.ovos_utils/fakebus.py (2)
4-4
: No issues with warnings import.
This is required to emit deprecation warnings for the deprecatedMessage
class.
336-340
: Deprecation warning forMessage
class.
Clear indication to import fromovos-bus-client
directly. The log_deprecation call further reinforces the timeline for removal.ovos_utils/system.py (7)
7-7
: Importingwarnings
is consistent with the new deprecation approach.
No issues; ensures all system-manipulation functions can emit warnings properly.
43-47
: Deprecation warning inntp_sync
.
It’s clear thatovos-PHAL-plugin-system
is now responsible. Stack level is suitable to guide developers to call sites.
58-62
: Deprecatedsystem_shutdown
.
The warning message clearly indicates the recommended alternative.
75-79
: Deprecatedsystem_reboot
.
Similar pattern used for consistent user notifications.
93-97
: SSH enable function deprecation is correct.
The approach matches the other system utilities, ensuring a uniform transition path.
107-111
: SSH disable function deprecation is correct.
Matches the standard approach with the recommended alternative.
121-125
: Deprecation ofrestart_mycroft_service
.
Warnings are consistent, pointing toovos-PHAL-plugin-system
as the replacement.ovos_utils/ocp.py (2)
6-6
: Implementation of thewarnings
import.
Maintains consistency in approach across the modules.
136-140
: Deprecatedavailable_extractors
function.
The message clarifies the new import path, andstacklevel=2
properly references the caller.
make IDEs signal deprecated code instead of relying on runtime logs only
Summary by CodeRabbit
Release Notes
Deprecation Warnings
Maintenance
warnings
moduleThese changes help developers transition to newer, recommended methods and import paths in the OVOS utilities library.