summaryrefslogtreecommitdiffstats
path: root/Doc/library/importlib.rst
Commit message (Collapse)AuthorAgeFilesLines
* Fix a few doc errors, mostly undefined keywords.Georg Brandl2011-01-151-12/+12
|
* #9911: doc copyedits.Georg Brandl2010-09-211-1/+1
|
* #6522: add a "decorator" directive to explicitly document decorators, and ↵Georg Brandl2010-07-291-3/+3
| | | | use it in a few places.
* Minor clarification about importlib.abc.SourceLoader.get_filename.Brett Cannon2010-07-211-1/+1
|
* Make importlib.abc.SourceLoader the primary mechanism for importlib.Brett Cannon2010-07-031-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This required moving the class from importlib/abc.py into importlib/_bootstrap.py and jiggering some code to work better with the class. This included changing how the file finder worked to better meet import semantics. This also led to fixing importlib to handle the empty string from sys.path as import currently does (and making me wish we didn't support that instead just required people to insert '.' instead to represent cwd). It also required making the new set_data abstractmethod create any needed subdirectories implicitly thanks to __pycache__ (it was either this or grow the SourceLoader ABC to gain an 'exists' method and either a mkdir method or have set_data with no data arg mean to create a directory). Lastly, as an optimization the file loaders cache the file path where the finder found something to use for loading (this is thanks to having a sourceless loader separate from the source loader to simplify the code and cut out stat calls). Unfortunately test_runpy assumed a loader would always work for a module, even if you changed from underneath it what it was expected to work with. By simply dropping the previous loader in test_runpy so the proper loader can be returned by the finder fixed the failure. At this point importlib deviates from import on two points: 1. The exception raised when trying to import a file is different (import does an explicit file check to print a special message, importlib just says the path cannot be imported as if it was just some module name). 2. the co_filename on a code object is not being set to where bytecode was actually loaded from instead of where the marshalled code object originally came from (a solution for this has already been agreed upon on python-dev but has not been implemented yet; issue8611).
* Make a sentence a little less awkward.Brett Cannon2010-06-291-2/+1
|
* Move importlib.abc.SourceLoader to _bootstrap.Brett Cannon2010-06-281-1/+2
| | | | | | | | | | | Required updating code relying on other modules to switch to _bootstrap's unique module requirements. This led to the realization that get_code was being too liberal in its exception catching when calling set_data by blindly grabbing IOError. Shifted the responsibility of safely ignoring writes to a read-only path to set_data. Importlib is still not relying on SourceLoader yet; requires creating a SourcelessLoader and updating the source finder.
* Implement importlib.abc.SourceLoader and deprecate PyLoader and PyPycLoader.Brett Cannon2010-06-271-111/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | SourceLoader is a simplification of both PyLoader and PyPycLoader. If one only wants to use source, then they need to only implement get_data and get_filename. To also use bytecode -- sourceless loading is not supported -- then two abstract methods -- path_mtime and set_data -- need to be implemented. Compared to PyLoader and PyPycLoader, there are less abstract methods introduced and bytecode files become an optimization controlled by the ABC and hidden from the user (this need came about as PEP 3147 showed that not treating bytecode as an optimization can cause problems for compatibility). PyLoader is deprecated in favor of SourceLoader. To be compatible from Python 3.1 onwards, a subclass need only use simple methods for source_path and is_package. Otherwise conditional subclassing based on whether Python 3.1 or Python 3.2 is being is the only change. The documentation and docstring for PyLoader explain what is exactly needed. PyPycLoader is deprecated also in favor of SourceLoader. Because PEP 3147 shifted bytecode path details so much, there is no foolproof way to provide backwards-compatibility with SourceLoader. Because of this the class is simply deprecated and users should move to SourceLoader (and optionally PyLoader for Python 3.1). This does lead to a loss of support for sourceless loading unfortunately. At some point before Python 3.2 is released, SourceLoader will be moved over to importlib._bootstrap so that the core code of importlib relies on the new code instead of the old PyPycLoader code. This commit is being done now so that there is no issue in having the API in Python 3.1a1.
* Add a link to PEP 3147 from the importlib docs.Brett Cannon2010-06-271-0/+3
| | | | Closes issue 8667. Thanks Ashley Sands for the patch.
* Fix the wrong numbering of a PEP.Brett Cannon2010-01-131-1/+1
|
* Wording clarification.Brett Cannon2009-12-101-4/+5
|
* Clarify the intention of raising ImportError for ↵Brett Cannon2009-12-091-2/+3
| | | | importlib.abc.PyLoader.(source|bytecode)_path.
* update to realityBenjamin Peterson2009-11-131-2/+2
|
* Pluralize a word.Brett Cannon2009-11-071-1/+1
|
* Clean up a minor bit of wording.Brett Cannon2009-08-181-2/+2
|
* Make the wdocs for importlib.abc.ExecutionLoader to be weaker in terms of ↵Brett Cannon2009-07-201-1/+1
| | | | what is needed to execute a module.
* Implement the PEP 302 protocol for get_filename() asBrett Cannon2009-07-201-5/+36
| | | | | | importlib.abc.ExecutionLoader. PyLoader now inherits from this ABC instead of InspectLoader directly. Both PyLoader and PyPycLoader provide concrete implementations of get_filename in terms of source_path and bytecode_path.
* typoTarek Ziadé2009-05-141-1/+1
|
* Explain a little about the explanation.Brett Cannon2009-04-011-0/+5
|
* Add a meta path importer example.Brett Cannon2009-04-011-7/+98
|
* Add some clarification to the importlib docs.Brett Cannon2009-04-011-4/+8
|
* Thorough review of importlib docs. Reviewed by Brett himself.Guido van Rossum2009-03-301-34/+50
|
* Fix a doc typo.Brett Cannon2009-03-161-1/+1
|
* Implement InspectLoader for FrozenImporter.Brett Cannon2009-03-151-1/+2
|
* Implement InspectLoader for BuiltinImporter.Brett Cannon2009-03-151-10/+11
|
* #5486: typos.Georg Brandl2009-03-131-3/+3
|
* Implement importlib.util.set_loader: a decorator to automatically setBrett Cannon2009-03-101-1/+9
| | | | __loader__ on modules.
* Implement get_source for importlib.abc.PyLoader using source_path and get_data.Brett Cannon2009-03-101-0/+7
|
* Fix some reST mishaps.Brett Cannon2009-03-091-12/+12
|
* Clarify an assumption that importlib.abc.PyLoader makes when importing aBrett Cannon2009-03-091-1/+4
| | | | package and setting __path__.
* Introduce importlib.abc. The module contains various ABCs related to importsBrett Cannon2009-03-091-31/+184
| | | | | | | (mostly stuff specified by PEP 302). There are two ABCs, PyLoader and PyPycLoader, which help with implementing source and source/bytecode loaders by implementing load_module in terms of other methods. This removes a lot of gritty details loaders typically have to worry about.
* Rename importlib.util.set___package__ to set_package.Brett Cannon2009-03-041-1/+1
|
* Expose importlib.util.set___package__.Brett Cannon2009-03-021-13/+21
|
* Implement the more specific PEP 302 semantics for loaders and what happens uponBrett Cannon2009-02-171-0/+33
| | | | | | load failure in relation to reloads. Also expose importlib.util.module_for_loader to handle all of the details of this along with making sure all current loaders behave nicely.
* Document importlib.machinery.PathFinder.Brett Cannon2009-02-161-3/+28
|
* Rewrite the code implementing __import__ for importlib. Now it is much simplerBrett Cannon2009-02-071-3/+7
| | | | | | | | | and relies much more on meta path finders to abstract out various parts of import. As part of this the semantics for import_module tightened up and now follow __import__ much more closely (biggest thing is that the 'package' argument must now already be imported, else a SystemError is raised).
* use the classmethod directiveBenjamin Peterson2009-01-251-4/+4
|
* Document both importlib.machinery.BuiltinImporter and FrozenImporter.Brett Cannon2009-01-251-1/+47
|
* Fix markup for arguments in importlib docs.Brett Cannon2009-01-221-2/+2
|
* Document the (very small) public API for importlib. As time goes on and someBrett Cannon2009-01-201-0/+78
key refactorings occur more of the API will be exposed and documented.