Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -70,7 +71,9 @@ class StylerRenderer:
Base class to process rendering a Styler with a specified jinja2 template.
"""

loader = jinja2.PackageLoader("pandas", "io/formats/templates")
this_dir = pathlib.Path(__file__).parent.resolve()
template_dir = this_dir / "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
Loading