Skip to content

CI: add jinja2 as a hard dependency for DataFrame.to_latex/to_html #43423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
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
1 change: 1 addition & 0 deletions ci/deps/actions-38-db-min.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dependencies:
- numpy<1.20 # GH#39541 compat for pyarrow<3
- python-dateutil
- pytz
- jinja2

# optional
- beautifulsoup4
Expand Down
1 change: 1 addition & 0 deletions ci/deps/actions-38-db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies:
- gcsfs>=0.6.0
- geopandas
- html5lib
- jinja2
- matplotlib
- moto>=1.3.14
- flask
Expand Down
1 change: 1 addition & 0 deletions ci/deps/actions-38-locale_slow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ dependencies:
- xlsxwriter=1.2.2
- xlwt=1.3.0
- html5lib=1.1
- jinja2
1 change: 1 addition & 0 deletions ci/deps/actions-38-slow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ dependencies:
- moto
- flask
- numba
- jinja2
1 change: 1 addition & 0 deletions ci/deps/actions-38.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ dependencies:
- nomkl
- pytz
- tabulate==0.8.7
- jinja2
1 change: 1 addition & 0 deletions ci/deps/actions-39-numpydev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies:
# pandas dependencies
- python-dateutil
- pytz
- jinja2
- pip
- pip:
- cython==0.29.21 # GH#34014
Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ Package Minimum support
`NumPy <https://numpy.org>`__ 1.18.5
`python-dateutil <https://dateutil.readthedocs.io/en/stable/>`__ 2.8.1
`pytz <https://pypi.org/project/pytz/>`__ 2020.1
`Jinja2 <https://jinja.pocoo.org>`__ 2.11
================================================================ ==========================

.. _install.recommended_dependencies:
Expand Down Expand Up @@ -266,7 +267,6 @@ Visualization
Dependency Minimum Version Notes
========================= ================== =============================================================
matplotlib 3.3.2 Plotting library
Jinja2 2.11 Conditional formatting with DataFrame.style
tabulate 0.8.7 Printing in Markdown-friendly format (see `tabulate`_)
========================= ================== =============================================================

Expand Down
4 changes: 4 additions & 0 deletions doc/source/whatsnew/v1.4.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ Optional libraries below the lowest tested version may still work, but are not c

See :ref:`install.dependencies` and :ref:`install.optional_dependencies` for more.

Also note that ``Jinja2``, with minimum version 2.11, has been made a hard dependency to support
DataFrame rendering in LaTeX and HTML formats, where the methods :meth:`DataFrame.to_latex` and
:meth:`DataFrame.to_html` now utilise the :class:`.Styler` template parsing mechanics.

.. _whatsnew_140.api_breaking.other:

Other API changes
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dependencies:
- python=3.8
- python-dateutil>=2.8.1
- pytz
- jinja2 # pandas.Styler (DataFrame.to_html / to_latex)

# benchmarks
- asv
Expand Down Expand Up @@ -79,7 +80,6 @@ dependencies:
- bottleneck>=1.3.1
- ipykernel
- ipython>=7.11.1
- jinja2 # pandas.Styler
- matplotlib>=3.3.2 # pandas.plotting, Series.plot, DataFrame.plot
- numexpr>=2.7.1
- scipy>=1.4.1
Expand Down
8 changes: 2 additions & 6 deletions pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -2194,9 +2194,7 @@ def hide_index(
subset = non_reducing_slice(subset_)
hide = self.data.loc[subset]
hrows = self.index.get_indexer_for(hide.index)
# error: Incompatible types in assignment (expression has type
# "ndarray", variable has type "Sequence[int]")
self.hidden_rows = hrows # type: ignore[assignment]
self.hidden_rows = list(hrows)

if names:
self.hide_index_names = True
Expand Down Expand Up @@ -2333,9 +2331,7 @@ def hide_columns(
subset = non_reducing_slice(subset_)
hide = self.data.loc[subset]
hcols = self.columns.get_indexer_for(hide.columns)
# error: Incompatible types in assignment (expression has type
# "ndarray", variable has type "Sequence[int]")
self.hidden_columns = hcols # type: ignore[assignment]
self.hidden_columns = list(hcols)

if names:
self.hide_column_names = True
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
numpy>=1.18.5
python-dateutil>=2.8.1
pytz
jinja2
asv
cython>=0.29.21
black==21.5b2
Expand Down Expand Up @@ -51,7 +52,6 @@ blosc
bottleneck>=1.3.1
ipykernel
ipython>=7.11.1
jinja2
matplotlib>=3.3.2
numexpr>=2.7.1
scipy>=1.4.1
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ install_requires =
numpy>=1.18.5
python-dateutil>=2.8.1
pytz>=2020.1
jinja2>=2.11
python_requires = >=3.8
include_package_data = True
zip_safe = False
Expand Down