summaryrefslogtreecommitdiffstats
path: root/Doc/library/importlib.rst
Commit message (Collapse)AuthorAgeFilesLines
* whatsnew: InspectLoader.get_code now concrete, b32decode raises binascii.Error.R David Murray2014-01-081-4/+4
| | | | And a news item rephrase.
* Issue #19719: Update various finder and loader ABCs such that theirBrett Cannon2014-01-071-2/+14
| | | | | | | 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: Update importlib docs for module spec changes, including ↵Eric Snow2013-12-171-22/+150
| | | | deprecations.
* merge for issue #19963Brett Cannon2013-12-131-2/+5
|\
| * Issue #19963: Document that importlib.import_module() will importBrett Cannon2013-12-131-2/+5
| | | | | | | | parent packages automatically.
| * Revert unrelated changes introduced by changeset b2066bc8cab9 (issue #19795).Serhiy Storchaka2013-11-291-10/+0
| |
* | Issue #18864: Add a setter for ModuleSpec.has_location.Eric Snow2013-12-111-1/+1
| |
* | Issue #19795: Improved markup of True/False constants.Serhiy Storchaka2013-11-291-2/+2
|\ \ | |/
| * Issue #19795: Improved markup of True/False constants.Serhiy Storchaka2013-11-291-0/+10
| |
* | Implement PEP 451 (ModuleSpec).Eric Snow2013-11-221-64/+80
| |
* | Issue #19410: Put back in special-casing of '' forBrett Cannon2013-11-011-3/+0
| | | | | | | | | | | | | | | | | | importlib.machinery.FileFinder. While originally moved to stop special-casing '' as PathFinder farther up the typical call chain now uses the cwd in the instance of '', it was deemed an unnecessary risk to breaking subclasses of FileFinder to take the special-casing out.
* | Tweak some doc wording for importlib.reloadBrett Cannon2013-10-251-2/+3
| |
* | Doc markup fixes.Georg Brandl2013-10-191-2/+2
| |
* | Issue #18416: Have importlib.machinery.PathFinder treat '' as the cwdBrett Cannon2013-10-181-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and stop importlib.machinery.FileFinder treating '' as '.'. Previous PathFinder transformed '' into '.' which led to __file__ for modules imported from the cwd to always be relative paths. This meant the values of the attribute were wrong as soon as the cwd changed. This change now means that as long as the site module is run (which makes all entries in sys.path absolute) then all values for __file__ will also be absolute unless it's for __main__ when specified by file path in a relative way (modules imported by runpy will have an absolute path). Now that PathFinder is no longer treating '' as '.' it only makes sense for FileFinder to stop doing so as well. Now no transformation is performed for the directory given to the __init__ method. Thanks to Madison May for the initial patch.
* | Issue #18758: Fixed and improved cross-references.Serhiy Storchaka2013-10-131-1/+1
|\ \ | |/
| * [issue19152] Revert 832579dbafd6.Eric Snow2013-10-031-5/+1
| |
| * [issue19152] Add ExtensionFileLoader.get_filename().Eric Snow2013-10-031-1/+5
| |
* | [issue 19152] Add versionadded for ExtensionFileLoader.get_filename().Eric Snow2013-10-051-0/+2
| |
* | [issue19152] Add ExtensionFileLoader.get_filename().Eric Snow2013-10-031-1/+5
| |
* | Issue #18955: clarify what is removed by importlib.util.module_for_loader.Brett Cannon2013-09-131-3/+3
| |
* | merge for issue #18278Brett Cannon2013-06-211-0/+2
|\ \ | |/
| * Issue #18278: properly document how the loaders are called for FileFinderBrett Cannon2013-06-211-0/+2
| |
* | documentation suggesting something which doesn't existBrett Cannon2013-06-161-2/+1
| |
* | Merge doc/argument name fixBrett Cannon2013-06-161-1/+1
|\ \ | |/
| * Fix a misnaming of a method and an argumentBrett Cannon2013-06-161-1/+1
| |
* | Issue #18076: Introduce imoportlib.util.decode_source().Brett Cannon2013-06-161-0/+8
| | | | | | | | | | | | | | The helper function makes it easier to implement imoprtlib.abc.InspectLoader.get_source() by making that function require just the raw bytes for source code and handling all other details.
* | Issue #17907: touch up the code for imp.new_module().Brett Cannon2013-06-151-0/+30
| |
* | Issue #18192: Introduce importlib.util.MAGIC_NUMBER and document theBrett Cannon2013-06-141-0/+7
| | | | | | | | deprecation of imp.get_magic().
* | Issue #18193: Add importlib.reload(), documenting (but notBrett Cannon2013-06-141-0/+67
| | | | | | | | | | | | implementing in code) the deprecation of imp.reload(). Thanks to Berker Peksag for the patch.
* | Issues #18088, 18089: IntroduceBrett Cannon2013-05-311-9/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Add a reset_name argument to importlib.util.module_to_load in order toBrett Cannon2013-05-311-1/+5
| | | | | | | | | | control whether to reset the module's __name__ attribute in case a reload is being done.
* | Add a reference to module_to_loadBrett Cannon2013-05-311-2/+1
| |
* | Rename importlib.util.ModuleManager to module_to_load so that the nameBrett Cannon2013-05-301-6/+7
| | | | | | | | explains better what the context manager is providing.
* | Undo a recommendation as load_module() methods might be called directlyBrett Cannon2013-05-281-5/+1
| |
* | Issue #18070: importlib.util.module_for_loader() now sets __loader__Brett Cannon2013-05-281-8/+14
| | | | | | | | | | and __package__ unconditionally in order to do the right thing for reloading.
* | Clarify some documentationBrett Cannon2013-05-281-31/+17
| |
* | Introduce importlib.util.ModuleManager which is a context manager toBrett Cannon2013-05-281-0/+13
| | | | | | | | | | | | | | | | handle providing (and cleaning up if needed) the module to be loaded. A future commit will use the context manager in Lib/importlib/_bootstrap.py and thus why the code is placed there instead of in Lib/importlib/util.py.
* | Issue #18072: Implement get_code() for importlib.abc.InspectLoader andBrett Cannon2013-05-281-4/+8
| | | | | | | | ExecutionLoader.
* | Move importlib.abc.SourceLoader.source_to_code() to InspectLoader.Brett Cannon2013-05-261-11/+11
| | | | | | | | | | | | | | 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.
* | mergeBrett Cannon2013-05-251-3/+8
|\ \ | |/
| * Various tweaks to importlib docs.Brett Cannon2013-05-251-3/+8
| |
* | #17115,17116: Have modules initialize the __package__ and __loader__Brett Cannon2013-05-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | attributes to None. The long-term goal is for people to be able to rely on these attributes existing and checking for None to see if they have been set. Since import itself sets these attributes when a loader does not the only instances when the attributes are None are from someone overloading __import__() and not using a loader or someone creating a module from scratch. This patch also unifies module initialization. Before you could have different attributes with default values depending on how the module object was created. Now the only way to not get the same default set of attributes is to circumvent initialization by calling ModuleType.__new__() directly.
* | merge for issue #17357Brett Cannon2013-04-281-5/+5
|\ \ | |/
| * Issue #17357: Use more stern wording forBrett Cannon2013-04-281-5/+5
| | | | | | | | importlib.invalidate_caches().
* | Fix invalid markup.Georg Brandl2013-04-111-2/+2
| |
* | Issue #17093,17566,17567: Methods from classes in importlib.abc now raise/returnBrett Cannon2013-04-091-13/+59
| | | | | | | | | | | | | | | | | | | | 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 #17099: Have importlib.find_loader() raise ValueError whenBrett Cannon2013-03-131-1/+7
| | | | | | | | | | | | __loader__ is not set on a module. This brings the exception in line with when __loader__ is None (which is equivalent to not having the attribute defined).
* | Issue #17117: Have both import itself and importlib.util.set_loader()Brett Cannon2013-03-131-0/+4
| | | | | | | | | | | | set __loader__ on a module when set to None. Thanks to Gökcen Eraslan for the fix.
* | Issue #17215: Fix documentation misprints (patch by July Tikhonov)Andrew Svetlov2013-02-171-1/+1
|\ \ | |/
| * Issue #17215: Fix documentation misprints (patch by July Tikhonov)Andrew Svetlov2013-02-171-1/+1
| |