-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Deprecate portions or all of pkgutil module. #64138
Comments
In the last Python releases, particularly 3.3 and 3.4, we've made improvements to the import machinery that render (at least) portions of pkgutil obsolete. Here's a breakdown of the public API of pkgutil: get_importer() - duplicate of PathFinder._path_importer_cache() I would expect that nearly all of the module could be deprecated and any gaps in functionality ported to importlib.util. Is it worth it to go to the effort? To me the biggest thing would be identifying what functionality (e.g. locating all packages within a directory) in pkgutil is still relevant and should be distilled into public APIs in importlib. The job of actually deprecating and porting code would mostly be mechanical and not even a large amount of work. |
Programmatic deprecation definitely isn't worth it - setuptools et al need this for cross-version compatibility with 2.x, and packaging tools are hard enough to write without us programatically deprecating things in 3.x releases. Explicit documented deprecations where appropriate would be good, though. |
I think programmatic deprecation is actually fine since that only comes up when running under -W which would be a bit odd for any tool to be run under except when testing. E.g. I had no personal issue deprecating imp for Python 3.4 even though that's the only way to do 2/3 programmatic import craziness as its use should be discouraged as much as possible since it's now fundamentally the wrong paradigm. And the tools can simply silence the deprecation if they actually find it noisy. I do agree it should just be a PendingDeprecationWarning and not expect to remove it until either Python 4 or when the community has heavily shifted to Python 3. But when there are semantic replacements I think not doing a programmatic deprecation with warnings off by default is a disservice. |
I think we are down to iter_modules, walk_packages, and ModuleInfo that need replacing or a decision what to do about them. |
Some notes on how to replace a bunch of things in
|
Not correct: older docs show a deprecation message since 3.3, now the doc is cleaned up in 3.12 and the class is still there (this is a doc deprecation to avoid causing trouble to people). |
Which class is still where?
|
I meant in the code, not doc (that’s that we call a doc deprecation). But I was looking at the wrong code locally, I was on 3.9 to build CPython for an old project. @warsaw removed ImpImporter in 3.12 indeed |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: