datadog 0.37.0 wheel import error for Python < 3.5
envgap__DataDog__datadogpy-571
01 / FAILURE SIGNATURE
As reported upstream
ImportError: No module named typing
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
6fdade248b7fb58f75eb5102547ddaaf227ab9d8- Manifest
setup.py- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
DataDog/datadogpy #571 · read the original issue
**Describe the bug**
After installing the latest datadog 0.37.0 wheel release using a Python version < 3.5, a `typing` package import error is raised when importing `datadog`.
**To Reproduce**
Steps to reproduce the behavior:
1. Install a version of Python < 3.5 (for example, Python 3.4 or Python 2.7).
2. Install the wheel release of datadog 0.37.0 by running `pip install datadog`.
3. Try importing `datadog` in an interactive interpreter to see the import error:
```
>>> import datadog
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "datadog/__init__.py", line 17, in <module>
from typing import Any, List, Optional
ImportError: No module named typing
```
**Expected behavior**
The `typing` package should be included in the wheel's install requirements if Python < 3.5 is being used.
In `setup.py`, the `typing` package is added to `install_requires` if running a Python version < 3.5 (otherwise, the package is already included in the standard library for newer Python versions). This optional `typing` dependency is correctly installed when running `python setup.py install` or pip-installing from source. The wheel release that is installed via `pip install datadog` doesn't include the `typing` dependency (probably because the wheel release isn't Python version specific).
A couple of solutions come to mind:
- (Probably easiest) Always include the `typing` package in `install_requires`, regardless of Python version. According to the [`typing` package docs](https://pypi.org/project/typing/), if `typing` is already part of the standard library, installing the package has no effect.
- Create separate wheel releases for Python < 3.5 and Python >= 3.5.
**Environment and Versions:**
Version: datadog 0.37.0
Tested with Python 2.7.15 on macOS 10.15.5.
**Additional context**
The `typing` package import was added in PR #565. Thanks @justinsousa for pointing out this issue!04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]