Repository: chainer/chainer

Issue:
typing-extensions version conflict with mypy
I encountered the following warning when installing chainer with style check tools.

```
mypy 0.720 has requirement typing-extensions>=3.7.4, but you'll have typing-extensions 3.6.6 which is incompatible.
```

## Environment
  - Chainer version: master
  - OS/Platform: Darwin-18.6.0-x86_64-i386-64bit
  - Python version: 3.6.6
  - Pip version: 10.0.1

## Install Log
```
$ pip install -e '.[stylecheck]'
Obtaining file:///private/tmp/chainer
Requirement already satisfied: setuptools in ./env/lib/python3.6/site-packages (from chainer==7.0.0b2) (39.0.1)
Collecting typing<=3.6.6 (from chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/4a/bd/eee1157fc2d8514970b345d69cb9975dcd1e42cd7e61146ed841f6e68309/typing-3.6.6-py3-none-any.whl
Collecting typing_extensions<=3.6.6 (from chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/62/4f/392a1fa2873e646f5990eb6f956e662d8a235ab474450c72487745f67276/typing_extensions-3.6.6-py3-none-any.whl
Collecting filelock (from chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/93/83/71a2ee6158bb9f39a90c0dea1637f81d5eef866e188e1971a1b1ab01a35a/filelock-3.0.12-py3-none-any.whl
Collecting numpy>=1.9.0 (from chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/0f/c9/3526a357b6c35e5529158fbcfac1bb3adc8827e8809a6d254019d326d1cc/numpy-1.16.4-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting protobuf<3.8.0rc1,>=3.0.0 (from chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/46/1e/c481d59760cded074d89ff51c99381708111c550ff698934cc296d27df2c/protobuf-3.7.1-cp36-cp36m-macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting six>=1.9.0 (from chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting autopep8<1.5,>=1.4.1 (from chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/45/f3/24b437da561b6af4840c871fbbda32889ca304fc1f7b6cc3ada8b09f394a/autopep8-1.4.4.tar.gz
Collecting flake8<3.8,>=3.7 (from chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/26/de/3f815a99d86eb10464ea7bd6059c0172c7ca97d4bdcfca41051b388a653b/flake8-3.7.8-py2.py3-none-any.whl
Collecting pycodestyle<2.6,>=2.5 (from chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/0e/0c/04a353e104d2f324f8ee5f4b32012618c1c86dd79e52a433b64fceed511b/pycodestyle-2.5.0-py2.py3-none-any.whl
Collecting mypy (from chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/41/65/fb68b086fa2714695962b27dafc65ceeb164221e4a4fff7ab3020363c469/mypy-0.720-cp36-cp36m-macosx_10_6_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting mccabe<0.7.0,>=0.6.0 (from flake8<3.8,>=3.7->chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/87/89/479dc97e18549e21354893e4ee4ef36db1d237534982482c3681ee6e7b57/mccabe-0.6.1-py2.py3-none-any.whl
Collecting entrypoints<0.4.0,>=0.3.0 (from flake8<3.8,>=3.7->chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/ac/c6/44694103f8c221443ee6b0041f69e2740d89a25641e62fb4f2ee568f2f9c/entrypoints-0.3-py2.py3-none-any.whl
Collecting pyflakes<2.2.0,>=2.1.0 (from flake8<3.8,>=3.7->chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/84/f2/ed0ffb887f8138a8fe5a621b8c0bb9598bfb3989e029f6c6a85ee66628ee/pyflakes-2.1.1-py2.py3-none-any.whl
Collecting mypy-extensions<0.5.0,>=0.4.0 (from mypy->chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/4d/72/8d54e2b296631b9b14961d583e56e90d9d7fba8a240d5ce7f1113cc5e887/mypy_extensions-0.4.1-py2.py3-none-any.whl
Collecting typed-ast<1.5.0,>=1.4.0 (from mypy->chainer==7.0.0b2)
  Using cached https://files.pythonhosted.org/packages/4c/16/9a45b107957d9e50ff9c99352516e59966433d5cf9148e6b4ba60bd4ce96/typed_ast-1.4.0-cp36-cp36m-macosx_10_9_x86_64.whl
mypy 0.720 has requirement typing-extensions>=3.7.4, but you'll have typing-extensions 3.6.6 which is incompatible.
Installing collected packages: typing, typing-extensions, filelock, numpy, six, protobuf, pycodestyle, autopep8, mccabe, entrypoints, pyflakes, flake8, mypy-extensions, typed-ast, mypy, chainer
  Running setup.py install for autopep8 ... done
  Running setup.py develop for chainer
Successfully installed autopep8-1.4.4 chainer entrypoints-0.3 filelock-3.0.12 flake8-3.7.8 mccabe-0.6.1 mypy-0.720 mypy-extensions-0.4.1 numpy-1.16.4 protobuf-3.7.1 pycodestyle-2.5.0 pyflakes-2.1.1 six-1.12.0 typed-ast-1.4.0 typing-3.6.6 typing-extensions-3.6.6
You are using pip version 10.0.1, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
```



Discussion:
Maybe we can remove mypy from requirements?
(We are currently not using mypy in CIs)

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -24,8 +24,11 @@
 requirements = {
     'install': [
         'setuptools',
-        'typing<=3.6.6',
-        'typing_extensions<=3.6.6',
+        # typing==3.7.4 causes error "TypeError: Instance and class checks can
+        # only be used with @runtime_checkable protocols" only with Python 2.
+        # https://github.com/chainer/chainer/pull/7562
+        'typing' + ('<=3.6.6' if sys.version_info[0] <= 2 else ''),
+        'typing_extensions' + ('<=3.6.6' if sys.version_info[0] <= 2 else ''),
         'filelock',
         'numpy>=1.9.0',
         # protobuf 3.8.0rc1 causes CI errors.


Test patch: