Hugo van Kemenade
a62562859d
Python 3.15.0a2
2025-11-18 16:51:17 +02:00
Serhiy Storchaka
d8e6bdc0d0
gh-135801: Add the module parameter to compile() etc (GH-139652)
...
Many functions related to compiling or parsing Python code, such as
compile(), ast.parse(), symtable.symtable(),
and importlib.abc.InspectLoader.source_to_code() now allow to pass
the module name used when filtering syntax warnings.
2025-11-13 13:21:32 +02:00
Filipe Laíns
ede5693be1
GH-119668: expose importlib.machinery.NamespacePath ( #119669 )
...
* GH-119668: expose importlib.NamespacePath
Signed-off-by: Filipe Laíns <lains@riseup.net>
* add news
Signed-off-by: Filipe Laíns <lains@riseup.net>
* add to docs
Signed-off-by: Filipe Laíns <lains@riseup.net>
* Apply suggestions from code review
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Fix news (importlib.NamespacePath > importlib.machinery.NamespacePath)
Signed-off-by: Filipe Laíns <lains@riseup.net>
* Link to module.__path__ in NamespacePath docs
Signed-off-by: Filipe Laíns <lains@riseup.net>
* Mention the path argument in the documentation
Signed-off-by: Filipe Laíns <lains@riseup.net>
* Simplify docs text
Signed-off-by: Filipe Laíns <lains@riseup.net>
* Highlight argument names in docs text
Signed-off-by: Filipe Laíns <lains@riseup.net>
* Update Lib/importlib/_bootstrap_external.py
Co-authored-by: Brett Cannon <brett@python.org>
* Rewrite NamespacePath's doc
Signed-off-by: Filipe Laíns <lains@riseup.net>
* Specify path_finder's type in the NamespacePath docstring
Signed-off-by: Filipe Laíns <lains@riseup.net>
* Fix doc tests
Signed-off-by: Filipe Laíns <lains@riseup.net>
* Apply suggestions from code review
Co-authored-by: Barry Warsaw <barry@python.org>
* Fix doc lint
Signed-off-by: Filipe Laíns <lains@riseup.net>
* Update Doc/library/importlib.rst
Co-authored-by: Brett Cannon <brett@python.org>
---------
Signed-off-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Barry Warsaw <barry@python.org>
2025-11-01 00:39:48 +00:00
Tan Long
2ebd0cdb16
Remove duplicate words in the documentation ( #140221 )
2025-10-16 18:27:00 +01:00
Samuel Sloniker
66ef16105a
gh-85076: Document exceptions that can be raised by importlib.import_module (GH-94662)
2025-09-09 12:52:00 -07:00
Brett Cannon
7140b99b0d
GH-137426: Remove code deprecation of importlib.abc.ResourceLoader (GH-137567)
...
Enough other classes in `importlib.abc` inherit from the class and the deprecation was to redirect people to `TraversableResources`. The documentation now makes it clear the class only exists for backwards compatibility.
---------
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-08-11 16:18:54 -07:00
Bartosz Sławecki
69d8fe50dd
gh-126548: Add a thread-unsafety warning for importlib.reload() (GH-136704)
2025-07-16 12:34:14 -04:00
Adam Turner
30e892473e
GH-121970: Replace custom abstract method directive with the `:abstract:` option ( #129311 )
2025-02-22 01:53:57 +00:00
Tomas R.
aa81a6f6e4
gh-97850: Update the deprecation warning of importlib.abc.Loader.load_module (GH-129855)
2025-02-11 11:04:16 -08:00
Serhiy Storchaka
078ab828b9
Use roles :data: and :const: for referencing module variables (GH-129507)
2025-02-04 16:16:41 +02:00
Tomas R.
256d6d2131
gh-97850: Suggest TraversableResources as the alternative for ResourceLoader (GH-128601)
...
Suggest TraversableResources as the alternative for ResourceLoader.
Previously, ResourceReader was the suggested alternative, but it
is itself deprecated in favour of TraversableResources.
2025-01-15 12:47:36 -08:00
Alex Waygood
3024b16d51
gh-101100: Consolidate documentation on ModuleType attributes ( #124709 )
...
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Barry Warsaw <barry@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-10-09 10:53:57 +00:00
Alex Waygood
6716dd1c33
Fixup indentation for docs on ModuleSpec attributes ( #124681 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-27 17:35:09 +00:00
Brett Cannon
67201ad53f
GH-65961: Document the deprecation of __package__ and __cached__ (GH-124377)
...
The code changes for warning related to `__package__` landed in Python 3.12. `__cached__` doesn't have any changes as it isn't used but only set by the import system.
2024-09-23 14:14:33 -07:00
Chris Barker
38809171b8
gh-121607: Edited source file import recipe to make it more clear ( #121519 )
...
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-09-13 16:36:40 -07:00
Ville Skyttä
bc264eac3a
Docs: spelling and grammar fixes ( #122084 )
...
Corrected some grammar and spelling issues in documentation.
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-22 09:14:25 +08:00
Xie Yanbo
17a2cc199d
Docs: fix typos in documentation (GH-118815)
2024-05-10 09:11:50 +01:00
Russell Keith-Magee
408e127159
gh-114099 - Add iOS framework loading machinery. (GH-116454)
...
Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-03-19 08:36:19 -04:00
Erlend E. Aasland
dbe44f150c
Docs: mark up NotImplemented using the :data: role throughout the docs ( #116135 )
2024-02-29 20:46:12 +00:00
Alex Waygood
2e632fa07d
Docs: fix markup for importlib.machinery.NamespaceLoader ( #112479 )
2023-11-28 00:15:23 +00:00
Thomas Grainger
6c0ddca409
gh-105189: fix importlib.resources.abc deprecation docs ( #105232 )
...
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-09-13 07:42:26 +03:00
xzmeng
88f1c5b454
Fix misc doc typos ( #108592 )
2023-08-29 00:14:21 +00:00
Eric Snow
cf63df88d3
gh-107307: Update the importlib Docs for PEP 684 (gh-107400)
2023-07-28 16:00:03 -06:00
Serhiy Storchaka
d036db728e
gh-106892: Use roles :data: and :const: for referencing module variables (GH-106894)
2023-07-21 12:34:30 +03:00
Barry Warsaw
326997829d
gh-98040: Remove find_loader, find_module and other deprecated APIs ( #98059 )
...
* 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>
2023-05-03 04:55:22 -07:00
busywhitespace
17143e2c30
gh-101390: Fix docs for imporlib.util.LazyLoader.factory to properly call it a class method (GH-101391)
2023-02-10 15:29:24 -08:00
Nikita Sobolev
27025e158c
gh-97850: Remove deprecated functions from importlib.utils ( #97898 )
...
* gh-97850: Remove deprecated functions from `importlib.utils`
* Rebase and remove `set_package` from diff
2022-10-06 17:57:10 -07:00
Brett Cannon
c206e53bb7
gh-65961: Raise DeprecationWarning when __package__ differs from __spec__.parent ( #97879 )
...
Also remove `importlib.util.set_package()` which was already slated for removal.
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2022-10-05 15:00:45 -07:00
Barry Warsaw
e1182bc377
gh-94619: Remove long deprecated methods module_repr() and load_module() ( #94624 )
...
* gh-94619: Remove long deprecated methods module_repr() and load_module()
Closes #94619
* Update Misc/NEWS.d/next/Library/2022-07-06-14-57-33.gh-issue-94619.PRqKVX.rst
Fix typo
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Brett Cannon <brett@python.org>
2022-08-04 17:24:26 -07:00
Petr Viktorin
ccd7c7a0bd
gh-93610: Improve docs for importlib.resources ( #93611 )
...
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-07-25 18:16:17 +02:00
Ned Batchelder
3440d197a5
Docs: remove redundant "adverb-adjective" hyphens from compound modifiers (GH-94551)
...
Discussion: https://discuss.python.org/t/slight-grammar-fix-throughout-adverbs-dont-need-hyphen/17021
2022-07-05 11:16:10 +02:00
Shantanu
e39cd76561
gh-92994: Clarify importlib "check" example ( #92995 )
...
Fixes #92994
2022-05-22 18:53:24 -07:00
Alex Waygood
70aa1b9b91
gh-92417: importlib docs: remove references to unsupported Python versions (GH-92424)
...
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-05-19 17:48:44 +02:00
David Gilbertson
5f45a9d3c3
importlib docs: Update importlib.abc hierarchy ( #31113 )
...
Fixed some inconsistencies in the text about relationships
2022-05-02 14:26:35 -06:00
Russel Webber
c62b944dfc
bpo-31582: Created a new documentation section describing sys.path initialization (GH-31082)
2022-03-23 17:29:40 +00:00
Jason R. Coombs
99945c6b5c
bpo-46109: Separate out files relating to importlib.resources (GH-30160)
...
* Separate out files relating to importlib.resources
* Update Introduction to direct readers to the submodule documentation.
* Create separate file for abcs relating to resources.
* Move abc docs back to where they were.
2021-12-30 21:17:05 -05:00
Jason R. Coombs
d5cd2effa6
bpo-45514: Deprecate importlib resources legacy functions. (GH-29036)
...
* bpo-45514: Apply changes from importlib_resources@a3ef4128c6
* Mark legacy functions as deprecated in the docs and link to the migration docs in importlib_resources docs.
* Apply changes from importlib_resources@329ae9d5f2c.
* Indicate importlib.resources as a module.
Co-authored-by: Filipe Laíns <lains@riseup.net>
2021-11-24 02:51:37 -05:00
Miro Hrončok
ae1965ccb4
bpo-45703: Invalidate _NamespacePath cache on importlib.invalidate_ca… (GH-29384)
...
Consider the following directory structure:
.
└── PATH1
└── namespace
└── sub1
└── __init__.py
And both PATH1 and PATH2 in sys path:
$ PYTHONPATH=PATH1:PATH2 python3.11
>>> import namespace
>>> import namespace.sub1
>>> namespace.__path__
_NamespacePath(['.../PATH1/namespace'])
>>> ...
While this interpreter still runs, PATH2/namespace/sub2 is created:
.
├── PATH1
│ └── namespace
│ └── sub1
│ └── __init__.py
└── PATH2
└── namespace
└── sub2
└── __init__.py
The newly created module cannot be imported:
>>> ...
>>> namespace.__path__
_NamespacePath(['.../PATH1/namespace'])
>>> import namespace.sub2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'namespace.sub2'
Calling importlib.invalidate_caches() now newly allows to import it:
>>> import importlib
>>> importlib.invalidate_caches()
>>> namespace.__path__
_NamespacePath(['.../PATH1/namespace'])
>>> import namespace.sub2
>>> namespace.__path__
_NamespacePath(['.../PATH1/namespace', '.../PATH2/namespace'])
This was not previously possible.
2021-11-23 07:38:02 -08:00
Géry Ogam
d7e210070f
bpo-37800: Clean up importlib documentation for some module attributes (GH-10016)
...
Automerge-Triggered-By: GH:brettcannon
2021-11-16 11:59:45 -08:00
Filipe Laíns
bc8fd7c9c2
bpo-45516: fix Traversable.name documentation (GH-29194)
...
Here we go again... Sorrry!
Signed-off-by: Filipe Laíns <lains@riseup.net>
Automerge-Triggered-By: GH:jaraco
2021-10-31 07:57:21 -07:00
Filipe Laíns
8ce20bbdd6
bpo-45516: add protocol description to the TraversableResources documentation ( #29173 )
...
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-10-23 11:47:55 -04:00
Barry Warsaw
876fc7fcec
bpo-35673: Add a public alias for namespace package __loader__ attribute ( #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.
2021-10-20 14:05:29 -07:00
Filipe Laíns
c029567530
bpo-45516: use documentation links in TraversableResources' description (GH-29045)
...
I think this makes the documentation much more digestible :)
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-10-18 20:52:28 -04:00
Filipe Laíns
4d03de3329
bpo-45516: add protocol description to the Traversable documentation ( #29039 )
...
* bpo-45516: add protocol description to the Traversable documentation
Signed-off-by: Filipe Laíns <lains@riseup.net>
* Update Doc/library/importlib.rst
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* Update Lib/importlib/abc.py
* Update Doc/library/importlib.rst
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2021-10-18 18:58:13 -04:00
Jason R. Coombs
7148293d96
bpo-44195: Use 'TraversableResources' in the docs to match the implementation. (GH-26317)
2021-05-24 13:08:10 -04:00
Junnosuke Kuroda
8b9310d902
bpo-43207: InspectLoader.is_package is not an abstract method (GH-24517)
...
Making the description of `InspectLoader.is_package` aligned with the current implementation.
Automerge-Triggered-By: GH:jaraco
2021-05-23 12:19:52 -07:00
Brett Cannon
57c6cb5100
bpo-42135: Deprecate implementations of find_module() and find_loader() (GH-25169)
2021-04-06 08:56:57 -07:00
Jason R. Coombs
af50c84643
bpo-43644: Add docs for importlib.resources.as_file. ( #25048 )
2021-03-27 20:25:53 -04:00
Brett Cannon
9cb31d6716
bpo-42137: have ModuleType.__repr__ prefer __spec__ over module_repr() (GH-24953)
...
This is to work towards the removal of the use of module_repr() in Python 3.12 (documented as deprecated since 3.4).
2021-03-24 08:26:56 -07:00
Yair Frid
ff8458b918
bpo-42811: Update importlib.utils.resolve_name() docs to use __spec__.parent (GH-24100)
...
Automerge-Triggered-By: GH:brettcannon
2021-01-06 09:42:10 -08:00