diff --git a/ci/deps/actions-38-minimum_versions.yaml b/ci/deps/actions-38-minimum_versions.yaml index 99f8b89d1d562..786b304bdfc1d 100644 --- a/ci/deps/actions-38-minimum_versions.yaml +++ b/ci/deps/actions-38-minimum_versions.yaml @@ -20,38 +20,37 @@ dependencies: - numpy=1.18.5 - pytz=2020.1 - # optional dependencies, markupsafe for jinja2 - - beautifulsoup4=4.8.2 - - blosc=1.20.1 - - bottleneck=1.3.1 + # optional dependencies + - beautifulsoup4=4.9.3 + - blosc=1.21.0 + - bottleneck=1.3.2 - brotlipy=0.7.0 - fastparquet=0.4.0 - - fsspec=0.7.4 + - fsspec=2021.05.0 - html5lib=1.1 - - hypothesis=5.5.3 - - gcsfs=0.6.0 - - jinja2=2.11 - - lxml=4.5.0 - - markupsafe=2.0.1 + - hypothesis=6.13.0 + - gcsfs=2021.05.0 + - jinja2=3.0.0 + - lxml=4.6.3 - matplotlib=3.3.2 - - numba=0.50.1 - - numexpr=2.7.1 + - numba=0.53.1 + - numexpr=2.7.3 - odfpy=1.4.1 - - openpyxl=3.0.3 - - pandas-gbq=0.14.0 - - psycopg2=2.8.4 + - openpyxl=3.0.7 + - pandas-gbq=0.15.0 + - psycopg2=2.8.6 - pyarrow=1.0.1 - - pymysql=0.10.1 - - pyreadstat=1.1.0 + - pymysql=1.0.2 + - pyreadstat=1.1.2 - pytables=3.6.1 - python-snappy=0.6.0 - - pyxlsb=1.0.6 - - s3fs=0.4.0 - - scipy=1.4.1 - - sqlalchemy=1.4.0 - - tabulate=0.8.7 - - xarray=0.15.1 + - pyxlsb=1.0.8 + - s3fs=2021.05.0 + - scipy=1.7.1 + - sqlalchemy=1.4.16 + - tabulate=0.8.9 + - xarray=0.19.0 - xlrd=2.0.1 - - xlsxwriter=1.2.2 + - xlsxwriter=1.4.3 - xlwt=1.3.0 - zstandard=0.15.2 diff --git a/doc/source/whatsnew/v1.5.0.rst b/doc/source/whatsnew/v1.5.0.rst index 9e3a2b608855a..b519eeee60a04 100644 --- a/doc/source/whatsnew/v1.5.0.rst +++ b/doc/source/whatsnew/v1.5.0.rst @@ -363,7 +363,50 @@ If installed, we now require: +=================+=================+==========+=========+ | mypy (dev) | 0.950 | | X | +-----------------+-----------------+----------+---------+ - +| beautifulsoup4 | 4.9.3 | | X | ++-----------------+-----------------+----------+---------+ +| blosc | 1.21.0 | | X | ++-----------------+-----------------+----------+---------+ +| bottleneck | 1.3.2 | | X | ++-----------------+-----------------+----------+---------+ +| fsspec | 2021.05.0 | | X | ++-----------------+-----------------+----------+---------+ +| hypothesis | 6.13.0 | | X | ++-----------------+-----------------+----------+---------+ +| gcsfs | 2021.05.0 | | X | ++-----------------+-----------------+----------+---------+ +| jinja2 | 3.0.0 | | X | ++-----------------+-----------------+----------+---------+ +| lxml | 4.6.3 | | X | ++-----------------+-----------------+----------+---------+ +| numba | 0.53.1 | | X | ++-----------------+-----------------+----------+---------+ +| numexpr | 2.7.3 | | X | ++-----------------+-----------------+----------+---------+ +| openpyxl | 3.0.7 | | X | ++-----------------+-----------------+----------+---------+ +| pandas-gbq | 0.15.0 | | X | ++-----------------+-----------------+----------+---------+ +| psycopg2 | 2.8.6 | | X | ++-----------------+-----------------+----------+---------+ +| pymysql | 1.0.2 | | X | ++-----------------+-----------------+----------+---------+ +| pyreadstat | 1.1.2 | | X | ++-----------------+-----------------+----------+---------+ +| pyxlsb | 1.0.8 | | X | ++-----------------+-----------------+----------+---------+ +| s3fs | 2021.05.0 | | X | ++-----------------+-----------------+----------+---------+ +| scipy | 1.7.1 | | X | ++-----------------+-----------------+----------+---------+ +| sqlalchemy | 1.4.16 | | X | ++-----------------+-----------------+----------+---------+ +| tabulate | 0.8.9 | | X | ++-----------------+-----------------+----------+---------+ +| xarray | 0.19.0 | | X | ++-----------------+-----------------+----------+---------+ +| xlsxwriter | 1.4.3 | | X | ++-----------------+-----------------+----------+---------+ For `optional libraries `_ the general recommendation is to use the latest version. The following table lists the lowest version per library that is currently being tested throughout the development of pandas. diff --git a/pandas/compat/_optional.py b/pandas/compat/_optional.py index 43134c3ab01d5..ad6c6fb839f10 100644 --- a/pandas/compat/_optional.py +++ b/pandas/compat/_optional.py @@ -10,40 +10,39 @@ # Update install.rst when updating versions! VERSIONS = { - "bs4": "4.8.2", - "blosc": "1.20.1", - "bottleneck": "1.3.1", + "bs4": "4.9.3", + "blosc": "1.21.0", + "bottleneck": "1.3.2", "brotli": "0.7.0", "fastparquet": "0.4.0", - "fsspec": "0.7.4", + "fsspec": "2021.05.0", "html5lib": "1.1", - "hypothesis": "5.5.3", - "gcsfs": "0.6.0", - "jinja2": "2.11", - "lxml.etree": "4.5.0", - "markupsafe": "2.0.1", + "hypothesis": "6.13.0", + "gcsfs": "2021.05.0", + "jinja2": "3.0.0", + "lxml.etree": "4.6.3", "matplotlib": "3.3.2", - "numba": "0.50.1", - "numexpr": "2.7.1", + "numba": "0.53.1", + "numexpr": "2.7.3", "odfpy": "1.4.1", - "openpyxl": "3.0.3", - "pandas_gbq": "0.14.0", - "psycopg2": "2.8.4", # (dt dec pq3 ext lo64) - "pymysql": "0.10.1", + "openpyxl": "3.0.7", + "pandas_gbq": "0.15.0", + "psycopg2": "2.8.6", # (dt dec pq3 ext lo64) + "pymysql": "1.0.2", "pyarrow": "1.0.1", - "pyreadstat": "1.1.0", + "pyreadstat": "1.1.2", "pytest": "6.0", - "pyxlsb": "1.0.6", - "s3fs": "0.4.0", - "scipy": "1.4.1", + "pyxlsb": "1.0.8", + "s3fs": "2021.05.0", + "scipy": "1.7.1", "snappy": "0.6.0", - "sqlalchemy": "1.4.0", + "sqlalchemy": "1.4.16", "tables": "3.6.1", - "tabulate": "0.8.7", - "xarray": "0.15.1", + "tabulate": "0.8.9", + "xarray": "0.19.0", "xlrd": "2.0.1", "xlwt": "1.3.0", - "xlsxwriter": "1.2.2", + "xlsxwriter": "1.4.3", "zstandard": "0.15.2", } diff --git a/pandas/tests/io/data/excel/high_surrogate.xlsx b/pandas/tests/io/data/excel/high_surrogate.xlsx deleted file mode 100644 index 1e29b6bee6586..0000000000000 Binary files a/pandas/tests/io/data/excel/high_surrogate.xlsx and /dev/null differ diff --git a/pandas/tests/io/excel/__init__.py b/pandas/tests/io/excel/__init__.py index c4343497ded48..e7a182ea63178 100644 --- a/pandas/tests/io/excel/__init__.py +++ b/pandas/tests/io/excel/__init__.py @@ -1,12 +1,5 @@ import pytest -from pandas.compat._optional import ( - get_version, - import_optional_dependency, -) - -from pandas.util.version import Version - pytestmark = [ pytest.mark.filterwarnings( # Looks like tree.getiterator is deprecated in favor of tree.iter @@ -25,11 +18,3 @@ "ignore:.*In xlrd >= 2.0, only the xls format is supported:FutureWarning" ), ] - - -if import_optional_dependency("xlrd", errors="ignore") is None: - xlrd_version = None -else: - import xlrd - - xlrd_version = Version(get_version(xlrd)) diff --git a/pandas/tests/io/excel/test_readers.py b/pandas/tests/io/excel/test_readers.py index 1e0f74ea41453..f38b28fd583bf 100644 --- a/pandas/tests/io/excel/test_readers.py +++ b/pandas/tests/io/excel/test_readers.py @@ -21,8 +21,6 @@ Series, ) import pandas._testing as tm -from pandas.tests.io.excel import xlrd_version -from pandas.util.version import Version read_ext_params = [".xls", ".xlsx", ".xlsm", ".xlsb", ".ods"] engine_params = [ @@ -69,12 +67,7 @@ def _is_valid_engine_ext_pair(engine, read_ext: str) -> bool: return False if read_ext == ".xlsb" and engine != "pyxlsb": return False - if ( - engine == "xlrd" - and xlrd_version is not None - and xlrd_version >= Version("2") - and read_ext != ".xls" - ): + if engine == "xlrd" and read_ext != ".xls": return False return True @@ -1527,18 +1520,6 @@ def test_excel_read_binary_via_read_excel(self, read_ext, engine): expected = pd.read_excel("test1" + read_ext, engine=engine) tm.assert_frame_equal(result, expected) - @pytest.mark.skipif( - xlrd_version is not None and xlrd_version >= Version("2"), - reason="xlrd no longer supports xlsx", - ) - def test_excel_high_surrogate(self): - # GH 23809 - expected = DataFrame(["\udc88"], columns=["Column1"]) - - # should not produce a segmentation violation - actual = pd.read_excel("high_surrogate.xlsx", engine="xlrd") - tm.assert_frame_equal(expected, actual) - @pytest.mark.parametrize("filename", ["df_empty.xlsx", "df_equals.xlsx"]) def test_header_with_index_col(self, filename): # GH 33476 diff --git a/pandas/tests/io/excel/test_writers.py b/pandas/tests/io/excel/test_writers.py index 26c283a7dcc45..42483645d9fc3 100644 --- a/pandas/tests/io/excel/test_writers.py +++ b/pandas/tests/io/excel/test_writers.py @@ -21,7 +21,6 @@ option_context, ) import pandas._testing as tm -from pandas.util.version import Version from pandas.io.excel import ( ExcelFile, @@ -1091,8 +1090,7 @@ def test_comment_empty_line(self, path): result = pd.read_excel(path, comment="#") tm.assert_frame_equal(result, expected) - def test_datetimes(self, path, request): - openpyxl = pytest.importorskip("openpyxl") + def test_datetimes(self, path): # Test writing and reading datetimes. For issue #9139. (xref #9185) datetimes = [ datetime(2013, 1, 13, 1, 2, 3), @@ -1110,16 +1108,6 @@ def test_datetimes(self, path, request): write_frame = DataFrame({"A": datetimes}) write_frame.to_excel(path, "Sheet1") - if (path.endswith("xlsx") or path.endswith("xlsm")) and Version( - openpyxl.__version__ - ) < Version("3.0.6"): - request.node.add_marker( - pytest.mark.xfail( - reason="Defaults to openpyxl and fails with " - "floating point error on datetimes; may be fixed on " - "newer versions of openpyxl - GH #38644" - ) - ) read_frame = pd.read_excel(path, sheet_name="Sheet1", header=0) tm.assert_series_equal(write_frame["A"], read_frame["A"]) diff --git a/pandas/tests/io/excel/test_xlrd.py b/pandas/tests/io/excel/test_xlrd.py index f2ae668dee5a3..86141f08f5f2d 100644 --- a/pandas/tests/io/excel/test_xlrd.py +++ b/pandas/tests/io/excel/test_xlrd.py @@ -6,8 +6,6 @@ import pandas as pd import pandas._testing as tm -from pandas.tests.io.excel import xlrd_version -from pandas.util.version import Version from pandas.io.excel import ExcelFile from pandas.io.excel._base import inspect_excel_format @@ -20,11 +18,7 @@ ) -# error: Unsupported operand types for <= ("Version" and "None") -if xlrd_version >= Version("2"): # type: ignore[operator] - exts = [".xls"] -else: - exts = [".xls", ".xlsx", ".xlsm"] +exts = [".xls"] @pytest.fixture(params=exts) @@ -77,19 +71,11 @@ def test_read_excel_warning_with_xlsx_file(datapath): path = datapath("io", "data", "excel", "test1.xlsx") has_openpyxl = import_optional_dependency("openpyxl", errors="ignore") is not None if not has_openpyxl: - if xlrd_version >= Version("2"): - with pytest.raises( - ValueError, - match="Your version of xlrd is ", - ): - pd.read_excel(path, "Sheet1", engine=None) - else: - with tm.assert_produces_warning( - FutureWarning, - raise_on_extra_warnings=False, - match="The xlrd engine is no longer maintained", - ): - pd.read_excel(path, "Sheet1", engine=None) + with pytest.raises( + ValueError, + match="Your version of xlrd is ", + ): + pd.read_excel(path, "Sheet1", engine=None) else: with tm.assert_produces_warning(None): pd.read_excel(path, "Sheet1", engine=None) diff --git a/pandas/tests/io/formats/style/test_highlight.py b/pandas/tests/io/formats/style/test_highlight.py index 63138d87bc72f..3d59719010ee0 100644 --- a/pandas/tests/io/formats/style/test_highlight.py +++ b/pandas/tests/io/formats/style/test_highlight.py @@ -188,7 +188,6 @@ def test_highlight_quantile(styler, kwargs): assert result == expected -@pytest.mark.skipif(np.__version__[:4] in ["1.16", "1.17"], reason="Numpy Issue #14831") @pytest.mark.parametrize( "f,kwargs", [ diff --git a/pandas/tests/io/test_fsspec.py b/pandas/tests/io/test_fsspec.py index 91ea5e09aa013..9f4ad8b9c6789 100644 --- a/pandas/tests/io/test_fsspec.py +++ b/pandas/tests/io/test_fsspec.py @@ -3,8 +3,6 @@ import numpy as np import pytest -from pandas.compat._optional import VERSIONS - from pandas import ( DataFrame, date_range, @@ -294,21 +292,7 @@ def test_stata_options(fsspectest): @td.skip_if_no("tabulate") -def test_markdown_options(request, fsspectest): - import fsspec - - # error: Library stubs not installed for "tabulate" - # (or incompatible with Python 3.8) - import tabulate # type: ignore[import] - - request.node.add_marker( - pytest.mark.xfail( - fsspec.__version__ == VERSIONS["fsspec"] - and tabulate.__version__ == VERSIONS["tabulate"], - reason="Fails on the min version build", - raises=FileNotFoundError, - ) - ) +def test_markdown_options(fsspectest): df = DataFrame({"a": [0]}) df.to_markdown("testmem://afile", storage_options={"test": "md_write"}) assert fsspectest.test[0] == "md_write" diff --git a/pandas/tests/series/methods/test_interpolate.py b/pandas/tests/series/methods/test_interpolate.py index bd8b165335d09..c46f427fd6f09 100644 --- a/pandas/tests/series/methods/test_interpolate.py +++ b/pandas/tests/series/methods/test_interpolate.py @@ -12,7 +12,6 @@ isna, ) import pandas._testing as tm -from pandas.util.version import Version @pytest.fixture( @@ -791,11 +790,8 @@ def test_interpolate_timedelta_index(self, request, interp_methods_ind): df = pd.DataFrame([0, 1, np.nan, 3], index=ind) method, kwargs = interp_methods_ind - import scipy - if method in {"cubic", "zero"} or ( - method == "barycentric" and Version(scipy.__version__) < Version("1.5.0") - ): + if method in {"cubic", "zero"}: request.node.add_marker( pytest.mark.xfail( reason=f"{method} interpolation is not supported for TimedeltaIndex"