Open
Description
I noticed when trying to upgrade the pandas CI to use more recent versions of meson-python that I started to see jinja2 failures in our test suite. As far as I can tell, jinja2 resolves paths to the package by loading the module specification via calls to importlib.util.find_spec("pandas")
In meson-python < 0.16.0, the debugger shows that specification as:
ModuleSpec(name='pandas', loader=<_pandas_editable_loader.SourceFileLoader object at 0x7ede6cb92e60>, origin='/home/willayd/clones/pandas/pandas/__init__.py', submodule_search_locations=[])
With meson-python 0.16.0, that same specification now shows as:
ModuleSpec(name='pandas', loader=<_pandas_editable_loader.SourceFileLoader object at 0x7d7938ab6020>, origin='/home/willayd/clones/pandas/pandas/__init__.py', submodule_search_locations=['/home/willayd/miniforge3/envs/pandas-dev/lib/python3.10/site-packages/_pandas_editable_loader.py/pandas'])
The problem is that the submodule_search_locations in meson-python 0.16.0 are non-existent, so when jinja2 tries to navigate those it ends up throwing an error like
pandas/tests/io/formats/style/test_exceptions.py:10: in <module>
from pandas.io.formats.style import Styler
pandas/io/formats/style.py:43: in <module>
from pandas.io.formats.style_render import (
pandas/io/formats/style_render.py:69: in <module>
class StylerRenderer:
pandas/io/formats/style_render.py:74: in StylerRenderer
loader = jinja2.PackageLoader("pandas", "io/formats/templates")
../../miniforge3/envs/pandas-dev/lib/python3.10/site-packages/jinja2/loaders.py:323: in __init__
raise ValueError(
E ValueError: The 'pandas' package was not installed in a way that PackageLoader understands.