Skip to content

Commit

Permalink
CI: Drop Python 3.5 support (pandas-dev#29212)
Browse files Browse the repository at this point in the history
  • Loading branch information
datapythonista authored and proost committed Dec 19, 2019
1 parent eb5ba6c commit 25a2a5b
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 158 deletions.
13 changes: 6 additions & 7 deletions ci/azure/posix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ jobs:
strategy:
matrix:
${{ if eq(parameters.name, 'macOS') }}:
py35_macos:
ENV_FILE: ci/deps/azure-macos-35.yaml
CONDA_PY: "35"
py36_macos:
ENV_FILE: ci/deps/azure-macos-36.yaml
CONDA_PY: "36"
PATTERN: "not slow and not network"

${{ if eq(parameters.name, 'Linux') }}:
py35_compat:
ENV_FILE: ci/deps/azure-35-compat.yaml
CONDA_PY: "35"
py36_minimum_versions:
ENV_FILE: ci/deps/azure-36-minimum_versions.yaml
CONDA_PY: "36"
PATTERN: "not slow and not network"

py36_locale_slow_old_np:
ENV_FILE: ci/deps/azure-36-locale.yaml
CONDA_PY: "36"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,23 @@ channels:
dependencies:
- beautifulsoup4=4.6.0
- bottleneck=1.2.1
- cython>=0.29.13
- jinja2=2.8
- numexpr=2.6.2
- numpy=1.13.3
- openpyxl=2.4.8
- pytables=3.4.2
- python-dateutil=2.6.1
- python=3.5.3
- python=3.6.1
- pytz=2017.2
- scipy=0.19.0
- xlrd=1.1.0
- xlsxwriter=0.9.8
- xlwt=1.2.0
# universal
- html5lib=1.0.1
- hypothesis>=3.58.0
- pytest=4.5.0
- pytest-xdist
- pytest-mock
- pytest-azurepipelines
- pip
- pip:
# for python 3.5, pytest>=4.0.2, cython>=0.29.13 is not available in conda
- cython>=0.29.13
- pytest==4.5.0
- html5lib==1.0b2
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
- openpyxl
- pyarrow
- pytables
- python=3.5.*
- python=3.6.*
- python-dateutil==2.6.1
- pytz
- xarray
Expand Down
27 changes: 2 additions & 25 deletions doc/source/development/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ Creating a Python environment (pip)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you aren't using conda for your development environment, follow these instructions.
You'll need to have at least python3.5 installed on your system.
You'll need to have at least Python 3.6.1 installed on your system.

**Unix**/**Mac OS**

Expand Down Expand Up @@ -847,29 +847,6 @@ The limitation here is that while a human can reasonably understand that ``is_nu
With custom types and inference this is not always possible so exceptions are made, but every effort should be exhausted to avoid ``cast`` before going down such paths.

Syntax Requirements
~~~~~~~~~~~~~~~~~~~

Because *pandas* still supports Python 3.5, :pep:`526` does not apply and variables **must** be annotated with type comments. Specifically, this is a valid annotation within pandas:

.. code-block:: python
primes = [] # type: List[int]
Whereas this is **NOT** allowed:

.. code-block:: python
primes: List[int] = [] # not supported in Python 3.5!
Note that function signatures can always be annotated per :pep:`3107`:

.. code-block:: python
def sum_of_primes(primes: List[int] = []) -> int:
...
Pandas-specific Types
~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -1296,7 +1273,7 @@ environment by::

or, to use a specific Python interpreter,::

asv run -e -E existing:python3.5
asv run -e -E existing:python3.6

This will display stderr from the benchmarks, and use your local
``python`` that comes from your ``$PATH``.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/development/policies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Pandas may change the behavior of experimental features at any time.
Python Support
~~~~~~~~~~~~~~

Pandas will only drop support for specific Python versions (e.g. 3.5.x, 3.6.x) in
Pandas will only drop support for specific Python versions (e.g. 3.6.x, 3.7.x) in
pandas **major** releases.

.. _SemVer: https://semver.org
47 changes: 0 additions & 47 deletions doc/source/getting_started/dsintro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -564,53 +564,6 @@ to a column created earlier in the same :meth:`~DataFrame.assign`.
In the second expression, ``x['C']`` will refer to the newly created column,
that's equal to ``dfa['A'] + dfa['B']``.

To write code compatible with all versions of Python, split the assignment in two.

.. ipython:: python
dependent = pd.DataFrame({"A": [1, 1, 1]})
(dependent.assign(A=lambda x: x['A'] + 1)
.assign(B=lambda x: x['A'] + 2))
.. warning::

Dependent assignment may subtly change the behavior of your code between
Python 3.6 and older versions of Python.

If you wish to write code that supports versions of python before and after 3.6,
you'll need to take care when passing ``assign`` expressions that

* Update an existing column
* Refer to the newly updated column in the same ``assign``

For example, we'll update column "A" and then refer to it when creating "B".

.. code-block:: python
>>> dependent = pd.DataFrame({"A": [1, 1, 1]})
>>> dependent.assign(A=lambda x: x["A"] + 1, B=lambda x: x["A"] + 2)
For Python 3.5 and earlier the expression creating ``B`` refers to the
"old" value of ``A``, ``[1, 1, 1]``. The output is then

.. code-block:: console
A B
0 2 3
1 2 3
2 2 3
For Python 3.6 and later, the expression creating ``A`` refers to the
"new" value of ``A``, ``[2, 2, 2]``, which results in

.. code-block:: console
A B
0 2 4
1 2 4
2 2 4

Indexing / selection
~~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 2 additions & 2 deletions doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Instructions for installing from source,
Python version support
----------------------

Officially Python 3.5.3 and above, 3.6, 3.7, and 3.8.
Officially Python 3.6.1 and above, 3.7, and 3.8.

Installing pandas
-----------------
Expand Down Expand Up @@ -140,7 +140,7 @@ Installing with ActivePython
Installation instructions for
`ActivePython <https://www.activestate.com/activepython>`__ can be found
`here <https://www.activestate.com/activepython/downloads>`__. Versions
2.7 and 3.5 include pandas.
2.7, 3.5 and 3.6 include pandas.

Installing using your Linux distribution's package manager.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
8 changes: 4 additions & 4 deletions doc/source/whatsnew/v1.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
What's new in 1.0.0 (??)
------------------------

.. warning::

Starting with the 1.x series of releases, pandas only supports Python 3.6.1 and higher.

New Deprecation Policy
~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -37,10 +41,6 @@ See :ref:`policies.version` for more.
.. _2019 Pandas User Survey: http://dev.pandas.io/pandas-blog/2019-pandas-user-survey.html
.. _SemVer: https://semver.org

.. warning::

The minimum supported Python version will be bumped to 3.6 in a future release.

{{ header }}

These are the changes in pandas 1.0.0. See :ref:`release` for a full changelog
Expand Down
1 change: 0 additions & 1 deletion pandas/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import sys
import warnings

PY35 = sys.version_info[:2] == (3, 5)
PY36 = sys.version_info >= (3, 6)
PY37 = sys.version_info >= (3, 7)
PY38 = sys.version_info >= (3, 8)
Expand Down
4 changes: 1 addition & 3 deletions pandas/io/json/_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from pandas.core.dtypes.common import ensure_str, is_period_dtype

from pandas import DataFrame, MultiIndex, Series, compat, isna, to_datetime
from pandas import DataFrame, MultiIndex, Series, isna, to_datetime
from pandas._typing import JSONSerializable
from pandas.core.reshape.concat import concat

Expand Down Expand Up @@ -1115,8 +1115,6 @@ def _parse_no_numpy(self):
dtype=None,
orient="index",
)
if compat.PY35:
self.obj = self.obj.sort_index(axis="columns").sort_index(axis="index")
elif orient == "table":
self.obj = parse_table_schema(json, precise_float=self.precise_float)
else:
Expand Down
12 changes: 0 additions & 12 deletions pandas/tests/groupby/aggregate/test_aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,7 @@ def test_agg_with_one_lambda(self):
}
)

# sort for 35 and earlier
columns = ["height_sqr_min", "height_max", "weight_max"]
if compat.PY35:
columns = ["height_max", "height_sqr_min", "weight_max"]
expected = pd.DataFrame(
{
"height_sqr_min": [82.81, 36.00],
Expand Down Expand Up @@ -640,22 +637,13 @@ def test_agg_multiple_lambda(self):
"weight": [7.9, 7.5, 9.9, 198.0],
}
)
# sort for 35 and earlier
columns = [
"height_sqr_min",
"height_max",
"weight_max",
"height_max_2",
"weight_min",
]
if compat.PY35:
columns = [
"height_max",
"height_max_2",
"height_sqr_min",
"weight_max",
"weight_min",
]
expected = pd.DataFrame(
{
"height_sqr_min": [82.81, 36.00],
Expand Down
22 changes: 6 additions & 16 deletions pandas/tests/io/json/test_json_table_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import numpy as np
import pytest

from pandas.compat import PY35

from pandas.core.dtypes.dtypes import CategoricalDtype, DatetimeTZDtype, PeriodDtype

import pandas as pd
Expand All @@ -22,14 +20,6 @@
)


def assert_results_equal(result, expected):
"""Helper function for comparing deserialized JSON with Py35 compat."""
if PY35:
assert sorted(result.items()) == sorted(expected.items())
else:
assert result == expected


class TestBuildSchema:
def setup_method(self, method):
self.df = DataFrame(
Expand Down Expand Up @@ -245,7 +235,7 @@ def test_build_series(self):
]
)

assert_results_equal(result, expected)
assert result == expected

def test_to_json(self):
df = self.df.copy()
Expand Down Expand Up @@ -335,7 +325,7 @@ def test_to_json(self):
]
expected = OrderedDict([("schema", schema), ("data", data)])

assert_results_equal(result, expected)
assert result == expected

def test_to_json_float_index(self):
data = pd.Series(1, index=[1.0, 2.0])
Expand Down Expand Up @@ -365,7 +355,7 @@ def test_to_json_float_index(self):
]
)

assert_results_equal(result, expected)
assert result == expected

def test_to_json_period_index(self):
idx = pd.period_range("2016", freq="Q-JAN", periods=2)
Expand All @@ -386,7 +376,7 @@ def test_to_json_period_index(self):
]
expected = OrderedDict([("schema", schema), ("data", data)])

assert_results_equal(result, expected)
assert result == expected

def test_to_json_categorical_index(self):
data = pd.Series(1, pd.CategoricalIndex(["a", "b"]))
Expand Down Expand Up @@ -421,7 +411,7 @@ def test_to_json_categorical_index(self):
]
)

assert_results_equal(result, expected)
assert result == expected

def test_date_format_raises(self):
with pytest.raises(ValueError):
Expand Down Expand Up @@ -558,7 +548,7 @@ def test_categorical(self):
]
)

assert_results_equal(result, expected)
assert result == expected

@pytest.mark.parametrize(
"idx,nm,prop",
Expand Down
Loading

0 comments on commit 25a2a5b

Please sign in to comment.