summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/abc.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-114099 - Add iOS framework loading machinery. (GH-116454)Russell Keith-Magee2024-03-191-1/+5
| | | | Co-authored-by: Malcolm Smith <smith@chaquo.com> Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* gh-98040: Remove find_loader, find_module and other deprecated APIs (#98059)Barry Warsaw2023-05-031-91/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove deprecated classes from pkgutil * Remove some other PEP 302 obsolescence * Use find_spec instead of load_module * Remove more tests of PEP 302 obsolete APIs * Remove another bunch of tests using obsolete load_modules() * Remove deleted names from __all__ * Remove obsolete footnote * imp is removed * Remove `imp` from generated stdlib names * What's new and blurb * Update zipimport documentation for the removed methods * Fix some Windows tests * Remove any test (or part of a test) that references `find_module()`. * Use assertIsNone() / assertIsNotNone() consistently. * Update Doc/reference/import.rst * We don't need pkgutil._get_spec() any more either * test.test_importlib.fixtures.NullFinder * ...BadLoaderFinder.find_module * ...test_api.InvalidatingNullFinder.find_module * ...test.test_zipimport test of z.find_module * Suppress cross-references to find_loader and find_module * Suppress cross-references to Finder * Suppress cross-references to pkgutil.ImpImporter and pkgutil.ImpLoader --------- Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
* gh-93963: Officially deprecate abcs and warn about their usage. (GH-93965)Jason R. Coombs2022-07-031-5/+14
| | | | | Fixes #93963 Automerge-Triggered-By: GH:jaraco
* bpo-46118: Move importlib.resources to its own package. (#30176)Jason R. Coombs2021-12-311-135/+13
| | | | | * bpo-46118: Move importlib.resources to its own package. * Expand compatibility shims with documentation and explicit imports.
* bpo-46125: Refactor tests to test traversable API directly. Includes changes ↡Jason R. Coombs2021-12-191-1/+1
| | | | from importlib_resources 5.4.0. (GH-30189)
* bpo-35673: Add a public alias for namespace package __loader__ attribute ↡Barry Warsaw2021-10-201-1/+1
| | | | | | | | (#29049) Rename namespace package __loader__ class to be public. Make the old name, i.e. _NamespaceLoader, an alias for the public name, for backward compatibility.
* bpo-42135: Deprecate implementations of find_module() and find_loader() ↡Brett Cannon2021-04-061-4/+16
| | | | (GH-25169)
* bpo-42129: Add support for resources in namespaces (GH-24670)Jason R. Coombs2021-03-041-31/+34
| | | | | * Unify behavior in ResourceReaderDefaultsTests and align with the behavior found in importlib_resources. * Equip NamespaceLoader with a NamespaceReader. * Apply changes from importlib_resources 5.0.4
* bpo-42403: Fix pyflakes warnings in importlib (GH-23396)Victor Stinner2020-11-191-1/+0
| | | Remove unused imports and unused local variables.
* bpo-41006: importlib.util no longer imports typing (GH-20938)Victor Stinner2020-06-171-47/+1
| | | | Create importlib._abc submodule to avoid importing typing when importlib.util is imported. Move Loader ABC into importlib._abc.
* bpo-39791 native hooks for importlib.resources.files (GH-20576)Jason R. Coombs2020-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * Provide native .files support on SourceFileLoader. * Add native importlib.resources.files() support to zipimporter. Remove fallback support. * make regen-all * πŸ“œπŸ€– Added by blurb_it. * Move 'files' into the ResourceReader so it can carry the relevant module name context. * Create 'importlib.readers' module and add FileReader to it. * Add zip reader and rely on it for a TraversableResources object on zipimporter. * Remove TraversableAdapter, no longer needed. * Update blurb. * Replace backslashes with forward slashes. * Incorporate changes from importlib_metadata 2.0, finalizing the interface for extension via get_resource_reader. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-39791: Add files() to importlib.resources (GH-19722)Jason R. Coombs2020-05-081-0/+86
| | | | | | | | | * bpo-39791: Update importlib.resources to support files() API (importlib_resources 1.5). * πŸ“œπŸ€– Added by blurb_it. * Add some documentation about the new objects added. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* Remove binding of captured exceptions when not used to reduce the chances of ↡Pablo Galindo2019-11-191-1/+1
| | | | | | | creating cycles (GH-17246) Capturing exceptions into names can lead to reference cycles though the __traceback__ attribute of the exceptions in some obscure cases that have been reported previously and fixed individually. As these variables are not used anyway, we can remove the binding to reduce the chances of creating reference cycles. See for example GH-13135
* bpo-35133: Fix mistakes when concatenate string literals on different lines. ↡Serhiy Storchaka2018-11-051-1/+1
| | | | | | | | | | (GH-10284) Two kind of mistakes: 1. Missed space. After concatenating there is no space between words. 2. Missed comma. Causes unintentional concatenating in a list of strings.
* bpo-33254: do not return an empty list when asking for the contents of a ↡Brett Cannon2018-04-301-2/+2
| | | | namespace package (GH-6467)
* Implement the get_resource_reader() API for file system imports (#5168)Barry Warsaw2018-01-151-1/+4
|
* bpo-32248: Introduce the concept of Loader.get_resource_reader() (GH-5108)Brett Cannon2018-01-121-2/+7
|
* bpo-32248: Implement importlib.abc.ResourceReader (GH-4892)Brett Cannon2017-12-161-0/+38
|
* bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051)Serhiy Storchaka2017-04-161-3/+3
|
* bpo-29576: add explicit deprecation for importlib.abc.find_loader() and ↡Matthias Bussonnier2017-02-161-6/+19
| | | | | | find_module() (GH-32)
* Issue #26186: Remove an invalid type check inBrett Cannon2016-02-211-1/+0
| | | | | | | | | | | importlib.util.LazyLoader. The class was checking its argument as to whether its implementation of create_module() came directly from importlib.abc.Loader. The problem is that the classes coming from imoprtlib.machinery do not directly inherit from the ABC as they come from _frozen_importlib. Because the documentation has always said that create_module() was ignored, the check has simply been removed.
* Issue #24192: Fix namespace package imports.Eric Snow2015-05-161-1/+2
|
* Issue #23911: Move path-based bootstrap code to a separate frozen module.Eric Snow2015-05-031-8/+16
|
* Issue #23014: Make importlib.abc.Loader.create_module() required whenBrett Cannon2015-01-091-3/+0
| | | | | | | | | importlib.abc.Loader.exec_module() is also defined. Before this change, create_module() was optional **and** could return None to trigger default semantics. This change now reduces the options for choosing default semantics to one and in the most backporting-friendly way (define create_module() to return None).
* Issue #20383: Introduce importlib.util.module_from_spec().Brett Cannon2014-05-301-1/+1
| | | | | | Along the way, dismantle importlib._bootstrap._SpecMethods as it was no longer relevant and constructing the new function required partially dismantling the class anyway.
* Issue #21156: importlib.abc.InspectLoader.source_to_code() is now aBrett Cannon2014-05-091-1/+2
| | | | staticmethod.
* Issue #19719: Update various finder and loader ABCs such that theirBrett Cannon2014-01-071-6/+26
| | | | | | | old methods now provide implementations when PEP 451 APIs are present. This should help with backwards-compatibility with code which has not been updated to work with PEP 451.
* Issue 19713: Add PEP 451-related deprecations.Eric Snow2014-01-071-5/+8
|
* Implement PEP 451 (ModuleSpec).Eric Snow2013-11-221-49/+53
|
* [issue 19152] Ensure we have actually registered ExtensionFileLoader as an ↡Eric Snow2013-10-051-2/+2
| | | | ExecutionLoader.
* [issue19152] Add ExtensionFileLoader.get_filename().Eric Snow2013-10-031-0/+2
|
* Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a)Brett Cannon2013-07-041-1/+1
|
* Issues #18058, 18057: Make importlib._bootstrap.NamespaceLoaderBrett Cannon2013-06-161-1/+1
| | | | | conform the the InspectLoader ABC. Perk of this is that runpy/-m can now work with namespace packages.
* Issue #18200: Update the stdlib (except tests) to useBrett Cannon2013-06-141-1/+1
| | | | ModuleNotFoundError.
* Issues #18088, 18089: IntroduceBrett Cannon2013-05-311-5/+27
| | | | | | | | | | | | | | | | | | | | | importlib.abc.Loader.init_module_attrs() and implement importlib.abc.InspectLoader.load_module(). The importlib.abc.Loader.init_module_attrs() method sets the various attributes on the module being loaded. It is done unconditionally to support reloading. Typically people used importlib.util.module_for_loader, but since that's a decorator there was no way to override it's actions, so init_module_attrs() came into existence to allow for overriding. This is also why module_for_loader is now pending deprecation (having its other use replaced by importlib.util.module_to_load). All of this allowed for importlib.abc.InspectLoader.load_module() to be implemented. At this point you can now implement a loader with nothing more than get_code() (which only requires get_source(); package support requires is_package()). Thanks to init_module_attrs() the implementation of load_module() is basically a context manager containing 2 methods calls, a call to exec(), and a return statement.
* Docstring cleanupBrett Cannon2013-05-311-2/+3
|
* Issue #18072: Implement get_code() for importlib.abc.InspectLoader andBrett Cannon2013-05-281-5/+25
| | | | ExecutionLoader.
* Move importlib.abc.SourceLoader.source_to_code() to InspectLoader.Brett Cannon2013-05-261-0/+7
| | | | | | | While the previous location was fine, it makes more sense to have the method higher up in the inheritance chain, especially at a point where get_source() is defined which is the earliest source_to_code() could programmatically be used in the inheritance tree in importlib.abc.
* Issue #17093,17566,17567: Methods from classes in importlib.abc now raise/returnBrett Cannon2013-04-091-28/+45
| | | | | | | | | | the default exception/value when called instead of raising/returning NotimplementedError/NotImplemented (except where appropriate). This should allow for the ABCs to act as the bottom/end of the MRO with expected default results. As part of this work, also make importlib.abc.Loader.module_repr() optional instead of an abstractmethod.
* Issue #15641: Clean up deprecated classes from importlibAndrew Svetlov2012-11-051-177/+0
| | | | Patch by Taras Lyapun.
* Issue #15502: Refactor some code.Brett Cannon2012-08-101-4/+1
|
* Issue #15502: Finish bringing importlib.abc in line with the currentBrett Cannon2012-08-101-14/+28
| | | | | | | | | state of the import system. Also make importlib.invalidate_caches() work with sys.meta_path instead of sys.path_importer_cache to completely separate the path-based import system from the overall import system. Patch by Eric Snow.
* Close #15519: Properly expose WindowsRegistryFinder in importlib and bring ↡Nick Coghlan2012-08-021-1/+1
| | | | the name into line with normal import terminology. Original patch by Eric Snow
* Issue #15502: Bring the importlib ABCs into line with the current state of ↡Nick Coghlan2012-08-021-21/+49
| | | | the import protocols given PEP 420. Original patch by Eric Snow.
* Typo.Barry Warsaw2012-07-311-2/+2
|
* Integration of importdocs from the features/pep-420 repo.Barry Warsaw2012-07-291-1/+18
|
* Closes #15030: Make importlib.abc.PyPycLoader respect the new .pycBrett Cannon2012-07-021-1/+7
| | | | | | | file size header field. Thanks to Marc Abramowitz and Ronan Lamy for helping out with various parts of the patch.
* Issue #14605: Rename _SourcelessFileLoader to SourcelessFileLoader.Marc-Andre Lemburg2012-04-251-1/+1
| | | | | This time also recreating the Python/importlib.h file to make make happy. See the ticket for details.
* Issue #14605: Revert renaming of _SourcelessFileLoader, since it causedMarc-Andre Lemburg2012-04-251-1/+1
| | | | the buildbots to fail.
* Issue #14605: Rename _SourcelessFileLoader to SourcelessFileLoaderMarc-Andre Lemburg2012-04-241-1/+1
|