[New-bugs-announce] [issue43697] Importlib documentation does not cover how meta path finders should handle namespace packages
Paul Moore
report at bugs.python.org
Thu Apr 1 11:49:52 EDT 2021
New submission from Paul Moore <p.f.moore at gmail.com>:
I am trying to write a meta path finder that "redirects" module loads to a different part of the filesystem. There's not much information in the importlib documentation, but PEP 451 says "find_spec() must return a spec with "loader" set to None (a.k.a. not set) and with submodule_search_locations set to the same portions as would have been provided by find_loader()".
I have done that, and it does work as long as all parts of the namespace package are handled by the *same* metapath loader. But if I have (for instance) one portion of the namespace package handled by my finder, and want to leave the filesystem finder to handle other parts, that doesn't work.
Is there a supported way to set up a finder on sys.meta_path which will expose just one "portion" of a namespace package?
----------
assignee: brett.cannon
components: Documentation
messages: 389997
nosy: brett.cannon, paul.moore
priority: normal
severity: normal
status: open
title: Importlib documentation does not cover how meta path finders should handle namespace packages
type: behavior
versions: Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43697>
_______________________________________
More information about the New-bugs-announce
mailing list