Stop showing DeprecationWarnings from all modules by default #3612

Closed
opened 2020-02-24 16:49:11 +01:00 by Drapersniper · 8 comments
Drapersniper commented 2020-02-24 16:49:11 +01:00 (Migrated from github.com)

This provides no useful info for the end user, and it only causes noise and confusion to be generated

As such the current behaviour should be hidden behind the --debug flag
github.com/Cog-Creators/Red-DiscordBot@42a4d10ea5 (diff-3b9bdb4dfe) should use

if "--debug" in _sys.argv:
    _warnings.filterwarnings("default", category=DeprecationWarning)
This provides no useful info for the end user, and it only causes noise and confusion to be generated As such the current behaviour should be hidden behind the `--debug` flag https://github.com/Cog-Creators/Red-DiscordBot/commit/42a4d10ea5ed0d8f337edb73a2c8a3c60e162aaa#diff-3b9bdb4dfee95e89963ffdc7160a5a6fR200 should use ```py if "--debug" in _sys.argv: _warnings.filterwarnings("default", category=DeprecationWarning) ```
Stonedestroyer commented 2020-02-24 16:59:39 +01:00 (Migrated from github.com)

I will shortly PR this.

I will shortly PR this.
Jackenmen commented 2020-02-24 20:00:27 +01:00 (Migrated from github.com)

I have a feeling, it might be better to filter the specific warnings that we can't solve because they occur because of our current dependencies and mark them with # DEP-WARN so that we can look if they got addressed each time we bump dependencies.

While you are right they are just warning and they might not give much information to the user, they are things that should be fixed. And if users see them, they will be able to come to us and therefore let us know they exist. This is in my opinion a lot better than letting them get by silently because of nobody knowing they occurred.

Warnings filters are quite powerful and each entry in warnings filter list can specify any of these:

  • a regular expression that the warning message must match
  • warning category (i.e. DeprecationWarning)
  • a regular expression that the module name must match
  • integer that the line number where the warning occurred must match

I'm putting this up as a possible alternative way of handling this, I don't have much problem with the solution proposed here, just thinking there might be some advantages to the one I proposed here (though there are some disadvantages too - like having to update the filtering on dep update and also when someone finds an unfiltered warning that needs filtering in logs too)

I have a feeling, it might be better to filter the specific warnings that we can't solve because they occur because of our current dependencies and mark them with `# DEP-WARN` so that we can look if they got addressed each time we bump dependencies. While you are right they are just warning and they might not give much information to the user, they are things that **should** be fixed. And if users see them, they will be able to come to us and therefore let us know they exist. This is in my opinion a lot better than letting them get by silently because of nobody knowing they occurred. Warnings filters are quite powerful and each entry in warnings filter list can specify any of these: - a regular expression that the warning message must match - warning category (i.e. `DeprecationWarning`) - a regular expression that the module name must match - integer that the line number where the warning occurred must match --- I'm putting this up as a possible alternative way of handling this, I don't have much problem with the solution proposed here, just thinking there might be some advantages to the one I proposed here (though there are some disadvantages too - like having to update the filtering on dep update and also when someone finds an unfiltered warning that needs filtering in logs too)
Stonedestroyer commented 2020-02-25 13:00:16 +01:00 (Migrated from github.com)

Would filtering the warnings for non debug and showing all warnings for debug be a good solution?

Would filtering the warnings for non debug and showing all warnings for debug be a good solution?
Stonedestroyer commented 2020-02-26 11:41:30 +01:00 (Migrated from github.com)

#3615 is an alternative.

#3615 is an alternative.
Drapersniper commented 2020-02-26 16:48:32 +01:00 (Migrated from github.com)

Before deciding the route to take here, it would be great hearing users feedback.

Does the community feel that the DepricationWanings provide them with any benefit ?

Here is an example of the warnings I mean.
https://gist.github.com/MatrixSouler/ed7d74b0f6911b3b3b92ca631a4d0a40
And the ones in https://github.com/Cog-Creators/Red-DiscordBot/issues/3529

Note that these could change overtime as things become depricated.

Let us know so we can decide where to put this output behind the --debug flag or still show them to all users.

Before deciding the route to take here, it would be great hearing users feedback. Does the community feel that the DepricationWanings provide them with any benefit ? Here is an example of the warnings I mean. https://gist.github.com/MatrixSouler/ed7d74b0f6911b3b3b92ca631a4d0a40 And the ones in https://github.com/Cog-Creators/Red-DiscordBot/issues/3529 Note that these could change overtime as things become depricated. Let us know so we can decide where to put this output behind the `--debug` flag or still show them to all users.
Bakersbakebread commented 2020-02-26 18:33:08 +01:00 (Migrated from github.com)

If they are relevant to third party code then Deprecation Warnings are only noise since they are not the end users responsibility to fix.

Hiding it behind the --dev flag ensures that only those who want to see the warnings can see them, one would hope that the test framework will enable these warnings too.

If they are relevant to third party code then Deprecation Warnings are only noise since they are not the end users responsibility to fix. Hiding it behind the `--dev` flag ensures that only those who want to see the warnings can see them, one would hope that the test framework will enable these warnings too.
Twentysix26 commented 2020-02-27 03:36:10 +01:00 (Migrated from github.com)

I think filtering only known warnings is the more sensible solution (#3615). Having users being able to report new warnings to us is valuable and so is having warnings show up in case third party cogs use deprecated core functions.

I think filtering only known warnings is the more sensible solution (#3615). Having users being able to report new warnings to us is valuable and so is having warnings show up in case third party cogs use deprecated core functions.
Jackenmen commented 2020-02-28 02:24:20 +01:00 (Migrated from github.com)

We can reiterate this at later date if proved problematic, for now we decided to choose #3615, we also asked about this in #v3-burndown on Red server and most people did choose this option too.

We can reiterate this at later date if proved problematic, for now we decided to choose #3615, we also asked about this in #v3-burndown on Red server and most people did choose this option too.
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#3612
No description provided.