DEP: Add 'python_requires' to setup.py to drop 3.4 support
State: closed

- [x] closes #20697 
- [ ] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

This is a small change to the setup.py that *should* stop newer versions of pandas from being downloaded in environments with older/unsupported versions of python. I followed the instructions here: https://packaging.python.org/guides/dropping-older-python-versions/

Labels:
name: Build
description: Library building on various platforms

Comments:
cc @TomAugspurger 
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20698?src=pr&el=h1) Report
> Merging [#20698](https://codecov.io/gh/pandas-dev/pandas/pull/20698?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/ec7968d023a9edee0c8be926f008d3b91ec2d0f8?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/20698/graphs/tree.svg?token=eZ4WkYLtcO&width=650&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/20698?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #20698      +/-   ##
==========================================
+ Coverage   91.81%   91.81%   +<.01%     
==========================================
  Files         153      153              
  Lines       49275    49279       +4     
==========================================
+ Hits        45241    45245       +4     
  Misses       4034     4034
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.2% <ø> (ø)` | :arrow_up: |
| #single | `41.9% <ø> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/20698?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/20698/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.16% <0%> (ø)` | :arrow_up: |
| [pandas/core/indexes/multi.py](https://codecov.io/gh/pandas-dev/pandas/pull/20698/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9tdWx0aS5weQ==) | `95.06% <0%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20698?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20698?src=pr&el=footer). Last update [ec7968d...24a9270](https://codecov.io/gh/pandas-dev/pandas/pull/20698?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Moving the discussion outside of the commits in case more changes are done. Simple test for a simpler `python_requires`:

```
In [15]: from pip.utils.packaging import specifiers, version

In [16]: version.parse('3.5.0') in specifiers.SpecifierSet('==2.7,>=3.5.*')
Out[16]: False

# later I did:
In [2]: version.parse('3.5.0') in specifiers.SpecifierSet('==2.7,>=3.5')
Out[2]: False

```
I read the source for `SpecifierSet` and `Specifier`. The condition is basically `all(my_version in specifier for specifier in specifiers)` where the `__contains__` is doing the individual condition for each version specifier (`my_version == 2.7 and my_version >=3.5`).

I guess you'll just have to drop python 2.7 sooner /s

Source: https://github.com/pypa/pip/blob/master/src/pip/_vendor/packaging/specifiers.py#L180
https://github.com/pypa/pip/blob/master/src/pip/_vendor/packaging/specifiers.py#L724
@davidh-ssec ok this looks ok. can you change our min for setuptools to 24.2.0, see [here](https://stackoverflow.com/questions/42238484/prevent-package-from-being-installed-on-old-python-versions) (which is pretty old anyhow). and update the Dependencies in install.rst & in the whatsnew.
@jreback You want the setuptools version in `setup_requires`? Or is there somewhere else it is currently specified?
Oh you meant set the min version in install.rst and update the deps in the 0.23 whatsnew. For the deps do you want it added to the min version table of deps?
yes + in

```
(pandas) bash-3.2$ grep setuptools ci/*
ci/environment-dev.yaml:  - setuptools>=3.3
ci/requirements_dev.txt:setuptools>=3.3
```
 (just update these)

thanks @davidh-ssec 
We’re hoping to do a release in about 1 week.

________________________________
From: Jeff Reback <notifications@github.com>
Sent: Monday, April 16, 2018 5:34:51 AM
To: pandas-dev/pandas
Cc: Tom Augspurger; Mention
Subject: Re: [pandas-dev/pandas] DEP: Add 'python_requires' to setup.py to drop 3.4 support (#20698)


thanks @davidh-ssec<https://github.com/davidh-ssec>

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://github.com/pandas-dev/pandas/pull/20698#issuecomment-381555602>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABQHIhVLiRg70pbG07q8GryTC7zmZ2vYks5tpHPLgaJpZM4TVRcb>.

Should we remove our `pyproject.toml` alltogether for upcoming 0.23.0 until support in pip is more mature? It seems that also the varying numpy version depending on the python version is not yet supported (cfr https://github.com/scipy/scipy/issues/8734)