Skip to content

Commit

Permalink
Use different jinja loader to work with meson-python
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Jan 10, 2025
1 parent a439bce commit 4136fa9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pandas/io/formats/style_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Sequence,
)
from functools import partial
import pathlib
import re
from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -71,7 +72,9 @@ class StylerRenderer:
Base class to process rendering a Styler with a specified jinja2 template.
"""

loader = jinja2.PackageLoader("pandas", "io/formats/templates")
thisdir = pathlib.Path(__file__).parent.resolve()
template_dir = thisdir / "templates"
loader = jinja2.FileSystemLoader(template_dir)
env = jinja2.Environment(loader=loader, trim_blocks=True)
template_html = env.get_template("html.tpl")
template_html_table = env.get_template("html_table.tpl")
Expand Down
5 changes: 4 additions & 1 deletion pandas/tests/io/formats/style/test_html.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pathlib
from textwrap import (
dedent,
indent,
Expand All @@ -18,7 +19,9 @@

@pytest.fixture
def env():
loader = jinja2.PackageLoader("pandas", "io/formats/templates")
project_dir = pathlib.Path(__file__).parent.parent.parent.parent.parent.resolve()
template_dir = project_dir / "io" / "formats" / "templates"
loader = jinja2.FileSystemLoader(template_dir)
env = jinja2.Environment(loader=loader, trim_blocks=True)
return env

Expand Down

0 comments on commit 4136fa9

Please sign in to comment.