BLD: Require enum34 for Python < 3.4
State: closed

pandas-dev/pandas#22802 imports `enum`, which was added to the built-ins in Python 3.4. The `enum34` package backports `enum` to earlier Python versions, so this should be a dependency as long as Python 2.7 is still supported.

To demonstrate the issue, creating a minimal environment using `conda` and installing the nightly Pandas build suffices:

```Shell
conda create -y -n pandas_nightly python=2.7
conda activate pandas_nightly
pip install --pre --find-links=https://5cf40426d9f06eb7461d-6fe47d9331aba7cd62fc36c7196769e4.ssl.cf2.rackcdn.com --find-links https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com pandas
```

Then:

```Shell
$ python -c 'import pandas'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/anaconda3/envs/pandas_nightly/lib/python2.7/site-packages/pandas/__init__.py", line 35, in <module>
    "the C extensions first.".format(module))
ImportError: C extension: No module named enum not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
```

If I install `enum34`:

```Shell
$ pip install enum34
Collecting enum34
  Using cached https://files.pythonhosted.org/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl
Installing collected packages: enum34
Successfully installed enum34-1.1.6
$ python -c 'import pandas'
$
```

- [ ] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Not sure what the best way to test this would be. Currently, installing `hypothesis` masks this error, because it contains the requirement `enum34; python_version == "2.7"`.

Related: MacPython/pandas-wheels#36, bids-standard/pybids#276, bids-standard/pybids#315

Labels:
name: Dependencies
description: Required and optional dependencies

Comments:
Hello @effigies! Thanks for submitting the PR.

 - There are no PEP8 issues in the file [`setup.py`](https://github.com/effigies/pandas/blob/f5e0e156cdf022f0ba160af679540719bb0f8032/setup.py) !


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

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

```diff
@@            Coverage Diff             @@
##           master   #24153      +/-   ##
==========================================
- Coverage    92.2%    92.2%   -0.01%     
==========================================
  Files         162      162              
  Lines       51700    51700              
==========================================
- Hits        47671    47670       -1     
- Misses       4029     4030       +1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.6% <ø> (-0.01%)` | :arrow_down: |
| #single | `43.02% <ø> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24153?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/internals/blocks.py](https://codecov.io/gh/pandas-dev/pandas/pull/24153/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL2Jsb2Nrcy5weQ==) | `93.65% <0%> (-0.07%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24153?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/24153?src=pr&el=footer). Last update [67faf6c...f5e0e15](https://codecov.io/gh/pandas-dev/pandas/pull/24153?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

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

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

```diff
@@            Coverage Diff             @@
##           master   #24153      +/-   ##
==========================================
- Coverage    92.2%    92.2%   -0.01%     
==========================================
  Files         162      162              
  Lines       51700    51700              
==========================================
- Hits        47671    47670       -1     
- Misses       4029     4030       +1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.6% <ø> (-0.01%)` | :arrow_down: |
| #single | `43.02% <ø> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24153?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/internals/blocks.py](https://codecov.io/gh/pandas-dev/pandas/pull/24153/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL2Jsb2Nrcy5weQ==) | `93.65% <0%> (-0.07%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24153?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/24153?src=pr&el=footer). Last update [67faf6c...f5e0e15](https://codecov.io/gh/pandas-dev/pandas/pull/24153?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

I guess this makes sense, even if after the next version only Python>=3.5 will be supported, so it'll be only for 0.24.

@TomAugspurger 
we may actually want to just change it and not use enums which is slightly simpler

adding a required dependency has some implications for wheel and conda building (meaning we haven’t touched these in a while)
Yeah we should be able to write this without an enum fairly easily.
superseded by #24170