Importing Modules¶
The modules described in this chapter provide new ways to import other Python modules and hooks for customizing the import process.
The full list of modules described in this chapter is:
zipimport
— Import modules from Zip archivespkgutil
— Package extension utilitymodulefinder
— Find modules used by a scriptrunpy
— Locating and executing Python modulesimportlib
— The implementation ofimport
- Introduction
- Functions
importlib.abc
– Abstract base classes related to importimportlib.machinery
– Importers and path hooksSOURCE_SUFFIXES
DEBUG_BYTECODE_SUFFIXES
OPTIMIZED_BYTECODE_SUFFIXES
BYTECODE_SUFFIXES
EXTENSION_SUFFIXES
all_suffixes()
BuiltinImporter
FrozenImporter
WindowsRegistryFinder
PathFinder
FileFinder
SourceFileLoader
SourcelessFileLoader
ExtensionFileLoader
NamespaceLoader
ModuleSpec
AppleFrameworkLoader
importlib.util
– Utility code for importers- Examples
importlib.resources
– Package resource reading, opening and accessimportlib.resources.abc
– Abstract base classes for resourcesimportlib.metadata
– Accessing package metadata- The initialization of the
sys.path
module search path