Skip to content

bpo-29576: Improve some deprecations in the importlib - #32

Merged
brettcannon merged 2 commits into
python:masterfrom
Carreau:deprecations
Feb 16, 2017
Merged

bpo-29576: Improve some deprecations in the importlib#32
brettcannon merged 2 commits into
python:masterfrom
Carreau:deprecations

Conversation

@Carreau

Copy link
Copy Markdown
Contributor

Add the python version since the functionality is deprecated,
and raise a couple of deprecation warnings in a few places.

Theses functions are marked as deprecated in the documentation, but
especially in existing codebase, programmers tends to not re-check
whether functions are deprecated. So trigger the warning when possible.

It's also more probable that a developer will drop deprecated
functionality if we immediately give them information about
replacement API, and not have them to go find it in the documentation.

Include deprecation information in DocString as well, as many tools pull
documentation from there and not from docs.python.org.

Comment threadLib/importlib/abc.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

typo here s/MetaPatFinder/MetaPathFinder/

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Oops indeed, thanks.

@codecov

codecovBot commented Feb 12, 2017

Copy link
Copy Markdown

Codecov Report

Merging #32 into master will decrease coverage by -0.01%.
The diff coverage is 100%.

@@ Coverage Diff @@## master #32 +/- ##
==========================================
- Coverage 82.37% 82.36% -0.01% 
==========================================
Files 1427 1427 Lines 350948 350951 +3 ==========================================
- Hits 289093 289062 -31 - Misses 61855 61889 +34

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c22bfaa...58d8d3c. Read the comment docs.

@brettcannonbrettcannon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you add tests to make sure the warnings are being raised?

Comment threadLib/importlib/abc.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This line is somewhat redundant since the deprecation is mentioned in the previous paragraph. Maybe just add the version it was deprecated in above?

Comment threadLib/importlib/abc.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The deprecation is mentioned in the above paragraph, so if you would like to add the version info just toss in up there.

Comment threadLib/importlib/abc.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add () after find_spec.

Comment threadLib/importlib/abc.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add() as appropriate.

Add the python version since the functionality is deprecated,
and raise a couple of deprecation warnings in a few places.
Theses functions are marked as deprecated in the documentation, but
especially in existing codebase, programmers tends to not re-check
whether functions are deprecated. So trigger the warning when possible.
It's also more probable that a developer will drop deprecated
functionality if we immediately give them information about
replacement API, and not have them to go find it in the documentation.
Include deprecation information in DocString as well as many tools pull
documentation from there and not from docs.python.org.
Add test making sure `find_loader()` and `find_module()` Both emit a
deprecation warning.
@Carreau

Copy link
Copy Markdown
ContributorAuthor

All comments should be addressed.

@brettcannon

Copy link
Copy Markdown
Member

Thanks! Please add entries in Misc/NEWS and one in What's New in the "deprecated" section and this will be ready to be merged!

@CarreauCarreau changed the title Improve some deprecations in the importlibbpo-29576: Improve some deprecations in the importlibFeb 16, 2017
@brettcannon
brettcannon merged commit 1d4601c into python:masterFeb 16, 2017
@brettcannon

Copy link
Copy Markdown
Member

Thanks!

@Carreau
Carreau deleted the deprecations branch February 16, 2017 02:05
@Carreau

Copy link
Copy Markdown
ContributorAuthor

Thanks !

jaraco pushed a commit that referenced this pull request Dec 2, 2022
jaraco pushed a commit to jaraco/cpython that referenced this pull request Feb 17, 2023
Sign up for freeto 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.

4 participants

@Carreau@brettcannon@fgregg@the-knights-who-say-ni