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

Actually show deprecation warnings and their line level [2/2] #8002

Merged
merged 20 commits into from Jun 21, 2021

Conversation

carmocca
Copy link
Member

@carmocca carmocca commented Jun 16, 2021

What does this PR do?

Issue

DeprecationWarnings weren't being shown for two reasons:

  1. Need to set the stacklevel
  2. DeprecationWarnings needed to be enabled

Solution

  • Set the appropriate stacklevel for most calls
  • Creates our own LightningDeprecationWarning and enable it
  • Groups warning-related functions into warnings.py
  • Add a stderr special test for warnings

To decide

Since DeprecationWarnings haven't been shown, we need to decide if we should delay their removal versions.

Option 👀 : do nothing - an argument is that we already mention what's been deprecated in the release notes
Option 🚀 : Only delay the removal version of warnings set to be removed in 1.4
Option ❤️ : Do it for all

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • [n/a] Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • [n/a] Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

@carmocca carmocca added bug Something isn't working priority: 0 High priority task labels Jun 16, 2021
@carmocca carmocca self-assigned this Jun 16, 2021
@codecov
Copy link

codecov bot commented Jun 16, 2021

Codecov Report

Merging #8002 (fa74779) into master (a23a699) will decrease coverage by 5%.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master   #8002    +/-   ##
=======================================
- Coverage      92%     87%    -5%     
=======================================
  Files         207     210     +3     
  Lines       13497   13590    +93     
=======================================
- Hits        12367   11821   -546     
- Misses       1130    1769   +639     

@carmocca carmocca changed the title [WIP] Actually show deprecation warnings and their line level [WIP] Actually show deprecation warnings and their line level [2/2] Jun 18, 2021
@carmocca carmocca mentioned this pull request Jun 18, 2021
11 tasks
@carmocca carmocca added this to the v1.3.x milestone Jun 18, 2021
@carmocca carmocca changed the title [WIP] Actually show deprecation warnings and their line level [2/2] Actually show deprecation warnings and their line level [2/2] Jun 18, 2021
@carmocca carmocca marked this pull request as ready for review June 18, 2021 13:47
Copy link
Member

@awaelchli awaelchli left a comment

Choose a reason for hiding this comment

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

not fully convinced about splitting up the the rank_zero functions but if circular imports are trouble, ok sounds fair :)

@carmocca carmocca added the ready PRs ready to be merged label Jun 21, 2021
pytorch_lightning/core/lightning.py Show resolved Hide resolved
pytorch_lightning/utilities/distributed.py Show resolved Hide resolved
pytorch_lightning/utilities/warnings.py Show resolved Hide resolved
Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGMT !

tests/utilities/test_warnings.py Show resolved Hide resolved
@carmocca carmocca merged commit dd340a6 into master Jun 21, 2021
@carmocca carmocca deleted the bugfix/fix-deprecation-warnings branch June 21, 2021 16:51
awaelchli added a commit that referenced this pull request Jun 22, 2021
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
lexierule pushed a commit that referenced this pull request Jun 22, 2021
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: 0 High priority task ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants