prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  dvc: unify requirements files and setup.py
  We have duplication between `requirements.txt` and `setup.py` `install_requires`. We also use three `pip install` lines in docs to set things up. Ideally we would just say:
  ```bash
  pip install -e .[tests]
  # or
  pip install -e .[all,tests]  # for all remotes
  ```
  So this contains several parts:
  - [ ] include `requirements.txt` in test requirements with `-r` syntax,
  - [ ] parse requirements files in `setup.py` or drop requirement files 
  - [ ] update contributing docs
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `setup.py`
  Content:
  ```
  1 from setuptools import setup, find_packages
  2 from setuptools.command.build_py import build_py as _build_py
  3 import os
  4 
  5 
  6 # https://packaging.python.org/guides/single-sourcing-package-version/
  7 pkg_dir = os.path.dirname(__file__)
  8 
  9 # This will define __version__ implicitly
  10 with open(os.path.join(pkg_dir, "dvc", "version.py")) as fobj:
  11     exec(fobj.read())
  12 
  13 version = __version__  # noqa: F821
  14 
  15 
  16 # To achieve consistency between the build version and the one provided
  17 # by your package during runtime, you need to **pin** the build version.
  18 #
  19 # This custom class will replace the version.py module with a **static**
  20 # `__version__` that your package can read at runtime, assuring consistancy.
  21 #
  22 # References:
  23 #   - https://docs.python.org/3.7/distutils/extending.html
  24 #   - https://github.com/python/mypy
  25 class build_py(_build_py):
  26     def pin_version(self):
  27         path = os.path.join(self.build_lib, "dvc")
  28         self.mkpath(path)
  29         with open(os.path.join(path, "version.py"), "w") as fobj:
  30             fobj.write("# AUTOGENERATED at build time by setup.py\n")
  31             fobj.write('__version__ = "{}"\n'.format(version))
  32 
  33     def run(self):
  34         self.execute(self.pin_version, ())
  35         _build_py.run(self)
  36 
  37 
  38 install_requires = [
  39     "ply>=3.9",  # See https://github.com/pyinstaller/pyinstaller/issues/1945
  40     "configparser>=3.5.0",
  41     "zc.lockfile>=1.2.1",
  42     "future>=0.16.0",
  43     "colorama>=0.3.9",
  44     "configobj>=5.0.6",
  45     "networkx>=2.1",
  46     "gitpython>=2.1.8",
  47     "setuptools>=34.0.0",
  48     "nanotime>=0.5.2",
  49     "pyasn1>=0.4.1",
  50     "schema>=0.6.7",
  51     "jsonpath-ng>=1.4.3",
  52     "requests>=2.22.0",
  53     "grandalf==0.6",
  54     "asciimatics>=1.10.0",
  55     "distro>=1.3.0",
  56     "appdirs>=1.4.3",
  57     "treelib>=1.5.5",
  58     "inflect>=2.1.0",
  59     "humanize>=0.5.1",
  60     "dulwich>=0.19.11",
  61     "ruamel.yaml>=0.15.91",
  62 ]
  63 
  64 # Extra dependencies for remote integrations
  65 gs = ["google-cloud-storage==1.13.0"]
  66 s3 = ["boto3==1.9.115"]
  67 azure = ["azure-storage-blob==1.3.0"]
  68 oss = ["oss2==2.6.1"]
  69 ssh = ["paramiko>=2.4.1"]
  70 all_remotes = gs + s3 + azure + ssh + oss
  71 
  72 setup(
  73     name="dvc",
  74     version=version,
  75     description="Git for data scientists - manage your code and data together",
  76     long_description=open("README.rst", "r").read(),
  77     author="Dmitry Petrov",
  78     author_email="dmitry@dataversioncontrol.com",
  79     download_url="https://github.com/iterative/dvc",
  80     license="Apache License 2.0",
  81     install_requires=install_requires,
  82     extras_require={
  83         "all": all_remotes,
  84         "gs": gs,
  85         "s3": s3,
  86         "azure": azure,
  87         "oss": oss,
  88         "ssh": ssh,
  89         # NOTE: https://github.com/inveniosoftware/troubleshooting/issues/1
  90         ':python_version=="2.7"': ["futures", "pathlib2"],
  91     },
  92     keywords="data science, data version control, machine learning",
  93     python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
  94     classifiers=[
  95         "Development Status :: 4 - Beta",
  96         "Programming Language :: Python :: 2",
  97         "Programming Language :: Python :: 2.7",
  98         "Programming Language :: Python :: 3",
  99         "Programming Language :: Python :: 3.5",
  100         "Programming Language :: Python :: 3.6",
  101         "Programming Language :: Python :: 3.7",
  102     ],
  103     packages=find_packages(exclude=["tests"]),
  104     include_package_data=True,
  105     url="http://dataversioncontrol.com",
  106     entry_points={"console_scripts": ["dvc = dvc.main:main"]},
  107     cmdclass={"build_py": build_py},
  108     zip_safe=False,
  109 )
  110
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -1,6 +1,7 @@
   from setuptools import setup, find_packages
   from setuptools.command.build_py import build_py as _build_py
   import os
  +import sys
   
   
   # https://packaging.python.org/guides/single-sourcing-package-version/
  @@ -69,6 +70,34 @@
   ssh = ["paramiko>=2.4.1"]
   all_remotes = gs + s3 + azure + ssh + oss
   
  +# Extra dependecies to run tests
  +tests_requirements = [
  +    "PyInstaller==3.4",
  +    "wheel>=0.31.1",
  +    "pydot>=1.2.4",
  +    # Test requirements:
  +    "pytest>=4.4.0",
  +    "pytest-timeout>=1.3.3",
  +    "pytest-cov>=2.6.1",
  +    "pytest-xdist>=1.26.1",
  +    "pytest-mock>=1.10.4",
  +    "flaky>=3.5.3",
  +    "mock>=3.0.0",
  +    "xmltodict>=0.11.0",
  +    "awscli>=1.16.125",
  +    "google-compute-engine",
  +    "pywin32; sys_platform == 'win32'",
  +    "Pygments",  # required by collective.checkdocs,
  +    "collective.checkdocs",
  +    "flake8",
  +    "flake8-docstrings",
  +    "jaraco.windows==3.9.2",
  +    "mock-ssh-server>=0.5.0",
  +]
  +
  +if (sys.version_info) >= (3, 6):
  +    tests_requirements.append("black==19.3b0")
  +
   setup(
       name="dvc",
       version=version,
  @@ -87,7 +116,8 @@
           "oss": oss,
           "ssh": ssh,
           # NOTE: https://github.com/inveniosoftware/troubleshooting/issues/1
  -        ':python_version=="2.7"': ["futures", "pathlib2"],
  +        ":python_version=='2.7'": ["futures", "pathlib2"],
  +        "tests": tests_requirements,
       },
       keywords="data science, data version control, machine learning",
       python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -1,6 +1,7 @@\n from setuptools import setup, find_packages\n from setuptools.command.build_py import build_py as _build_py\n import os\n+import sys\n \n \n # https://packaging.python.org/guides/single-sourcing-package-version/\n@@ -69,6 +70,34 @@\n ssh = [\"paramiko>=2.4.1\"]\n all_remotes = gs + s3 + azure + ssh + oss\n \n+# Extra dependecies to run tests\n+tests_requirements = [\n+    \"PyInstaller==3.4\",\n+    \"wheel>=0.31.1\",\n+    \"pydot>=1.2.4\",\n+    # Test requirements:\n+    \"pytest>=4.4.0\",\n+    \"pytest-timeout>=1.3.3\",\n+    \"pytest-cov>=2.6.1\",\n+    \"pytest-xdist>=1.26.1\",\n+    \"pytest-mock>=1.10.4\",\n+    \"flaky>=3.5.3\",\n+    \"mock>=3.0.0\",\n+    \"xmltodict>=0.11.0\",\n+    \"awscli>=1.16.125\",\n+    \"google-compute-engine\",\n+    \"pywin32; sys_platform == 'win32'\",\n+    \"Pygments\",  # required by collective.checkdocs,\n+    \"collective.checkdocs\",\n+    \"flake8\",\n+    \"flake8-docstrings\",\n+    \"jaraco.windows==3.9.2\",\n+    \"mock-ssh-server>=0.5.0\",\n+]\n+\n+if (sys.version_info) >= (3, 6):\n+    tests_requirements.append(\"black==19.3b0\")\n+\n setup(\n     name=\"dvc\",\n     version=version,\n@@ -87,7 +116,8 @@\n         \"oss\": oss,\n         \"ssh\": ssh,\n         # NOTE: https://github.com/inveniosoftware/troubleshooting/issues/1\n-        ':python_version==\"2.7\"': [\"futures\", \"pathlib2\"],\n+        \":python_version=='2.7'\": [\"futures\", \"pathlib2\"],\n+        \"tests\": tests_requirements,\n     },\n     keywords=\"data science, data version control, machine learning\",\n     python_requires=\">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*\",\n", "issue": "dvc: unify requirements files and setup.py\nWe have duplication between `requirements.txt` and `setup.py` `install_requires`. We also use three `pip install` lines in docs to set things up. Ideally we would just say:\r\n```bash\r\npip install -e .[tests]\r\n# or\r\npip install -e .[all,tests]  # for all remotes\r\n```\r\nSo this contains several parts:\r\n- [ ] include `requirements.txt` in test requirements with `-r` syntax,\r\n- [ ] parse requirements files in `setup.py` or drop requirement files \r\n- [ ] update contributing docs\n", "before_files": [{"content": "from setuptools import setup, find_packages\nfrom setuptools.command.build_py import build_py as _build_py\nimport os\n\n\n# https://packaging.python.org/guides/single-sourcing-package-version/\npkg_dir = os.path.dirname(__file__)\n\n# This will define __version__ implicitly\nwith open(os.path.join(pkg_dir, \"dvc\", \"version.py\")) as fobj:\n    exec(fobj.read())\n\nversion = __version__  # noqa: F821\n\n\n# To achieve consistency between the build version and the one provided\n# by your package during runtime, you need to **pin** the build version.\n#\n# This custom class will replace the version.py module with a **static**\n# `__version__` that your package can read at runtime, assuring consistancy.\n#\n# References:\n#   - https://docs.python.org/3.7/distutils/extending.html\n#   - https://github.com/python/mypy\nclass build_py(_build_py):\n    def pin_version(self):\n        path = os.path.join(self.build_lib, \"dvc\")\n        self.mkpath(path)\n        with open(os.path.join(path, \"version.py\"), \"w\") as fobj:\n            fobj.write(\"# AUTOGENERATED at build time by setup.py\\n\")\n            fobj.write('__version__ = \"{}\"\\n'.format(version))\n\n    def run(self):\n        self.execute(self.pin_version, ())\n        _build_py.run(self)\n\n\ninstall_requires = [\n    \"ply>=3.9\",  # See https://github.com/pyinstaller/pyinstaller/issues/1945\n    \"configparser>=3.5.0\",\n    \"zc.lockfile>=1.2.1\",\n    \"future>=0.16.0\",\n    \"colorama>=0.3.9\",\n    \"configobj>=5.0.6\",\n    \"networkx>=2.1\",\n    \"gitpython>=2.1.8\",\n    \"setuptools>=34.0.0\",\n    \"nanotime>=0.5.2\",\n    \"pyasn1>=0.4.1\",\n    \"schema>=0.6.7\",\n    \"jsonpath-ng>=1.4.3\",\n    \"requests>=2.22.0\",\n    \"grandalf==0.6\",\n    \"asciimatics>=1.10.0\",\n    \"distro>=1.3.0\",\n    \"appdirs>=1.4.3\",\n    \"treelib>=1.5.5\",\n    \"inflect>=2.1.0\",\n    \"humanize>=0.5.1\",\n    \"dulwich>=0.19.11\",\n    \"ruamel.yaml>=0.15.91\",\n]\n\n# Extra dependencies for remote integrations\ngs = [\"google-cloud-storage==1.13.0\"]\ns3 = [\"boto3==1.9.115\"]\nazure = [\"azure-storage-blob==1.3.0\"]\noss = [\"oss2==2.6.1\"]\nssh = [\"paramiko>=2.4.1\"]\nall_remotes = gs + s3 + azure + ssh + oss\n\nsetup(\n    name=\"dvc\",\n    version=version,\n    description=\"Git for data scientists - manage your code and data together\",\n    long_description=open(\"README.rst\", \"r\").read(),\n    author=\"Dmitry Petrov\",\n    author_email=\"dmitry@dataversioncontrol.com\",\n    download_url=\"https://github.com/iterative/dvc\",\n    license=\"Apache License 2.0\",\n    install_requires=install_requires,\n    extras_require={\n        \"all\": all_remotes,\n        \"gs\": gs,\n        \"s3\": s3,\n        \"azure\": azure,\n        \"oss\": oss,\n        \"ssh\": ssh,\n        # NOTE: https://github.com/inveniosoftware/troubleshooting/issues/1\n        ':python_version==\"2.7\"': [\"futures\", \"pathlib2\"],\n    },\n    keywords=\"data science, data version control, machine learning\",\n    python_requires=\">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*\",\n    classifiers=[\n        \"Development Status :: 4 - Beta\",\n        \"Programming Language :: Python :: 2\",\n        \"Programming Language :: Python :: 2.7\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.5\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n    ],\n    packages=find_packages(exclude=[\"tests\"]),\n    include_package_data=True,\n    url=\"http://dataversioncontrol.com\",\n    entry_points={\"console_scripts\": [\"dvc = dvc.main:main\"]},\n    cmdclass={\"build_py\": build_py},\n    zip_safe=False,\n)\n", "path": "setup.py"}], "after_files": [{"content": "from setuptools import setup, find_packages\nfrom setuptools.command.build_py import build_py as _build_py\nimport os\nimport sys\n\n\n# https://packaging.python.org/guides/single-sourcing-package-version/\npkg_dir = os.path.dirname(__file__)\n\n# This will define __version__ implicitly\nwith open(os.path.join(pkg_dir, \"dvc\", \"version.py\")) as fobj:\n    exec(fobj.read())\n\nversion = __version__  # noqa: F821\n\n\n# To achieve consistency between the build version and the one provided\n# by your package during runtime, you need to **pin** the build version.\n#\n# This custom class will replace the version.py module with a **static**\n# `__version__` that your package can read at runtime, assuring consistancy.\n#\n# References:\n#   - https://docs.python.org/3.7/distutils/extending.html\n#   - https://github.com/python/mypy\nclass build_py(_build_py):\n    def pin_version(self):\n        path = os.path.join(self.build_lib, \"dvc\")\n        self.mkpath(path)\n        with open(os.path.join(path, \"version.py\"), \"w\") as fobj:\n            fobj.write(\"# AUTOGENERATED at build time by setup.py\\n\")\n            fobj.write('__version__ = \"{}\"\\n'.format(version))\n\n    def run(self):\n        self.execute(self.pin_version, ())\n        _build_py.run(self)\n\n\ninstall_requires = [\n    \"ply>=3.9\",  # See https://github.com/pyinstaller/pyinstaller/issues/1945\n    \"configparser>=3.5.0\",\n    \"zc.lockfile>=1.2.1\",\n    \"future>=0.16.0\",\n    \"colorama>=0.3.9\",\n    \"configobj>=5.0.6\",\n    \"networkx>=2.1\",\n    \"gitpython>=2.1.8\",\n    \"setuptools>=34.0.0\",\n    \"nanotime>=0.5.2\",\n    \"pyasn1>=0.4.1\",\n    \"schema>=0.6.7\",\n    \"jsonpath-ng>=1.4.3\",\n    \"requests>=2.22.0\",\n    \"grandalf==0.6\",\n    \"asciimatics>=1.10.0\",\n    \"distro>=1.3.0\",\n    \"appdirs>=1.4.3\",\n    \"treelib>=1.5.5\",\n    \"inflect>=2.1.0\",\n    \"humanize>=0.5.1\",\n    \"dulwich>=0.19.11\",\n    \"ruamel.yaml>=0.15.91\",\n]\n\n# Extra dependencies for remote integrations\ngs = [\"google-cloud-storage==1.13.0\"]\ns3 = [\"boto3==1.9.115\"]\nazure = [\"azure-storage-blob==1.3.0\"]\noss = [\"oss2==2.6.1\"]\nssh = [\"paramiko>=2.4.1\"]\nall_remotes = gs + s3 + azure + ssh + oss\n\n# Extra dependecies to run tests\ntests_requirements = [\n    \"PyInstaller==3.4\",\n    \"wheel>=0.31.1\",\n    \"pydot>=1.2.4\",\n    # Test requirements:\n    \"pytest>=4.4.0\",\n    \"pytest-timeout>=1.3.3\",\n    \"pytest-cov>=2.6.1\",\n    \"pytest-xdist>=1.26.1\",\n    \"pytest-mock>=1.10.4\",\n    \"flaky>=3.5.3\",\n    \"mock>=3.0.0\",\n    \"xmltodict>=0.11.0\",\n    \"awscli>=1.16.125\",\n    \"google-compute-engine\",\n    \"pywin32; sys_platform == 'win32'\",\n    \"Pygments\",  # required by collective.checkdocs,\n    \"collective.checkdocs\",\n    \"flake8\",\n    \"flake8-docstrings\",\n    \"jaraco.windows==3.9.2\",\n    \"mock-ssh-server>=0.5.0\",\n]\n\nif (sys.version_info) >= (3, 6):\n    tests_requirements.append(\"black==19.3b0\")\n\nsetup(\n    name=\"dvc\",\n    version=version,\n    description=\"Git for data scientists - manage your code and data together\",\n    long_description=open(\"README.rst\", \"r\").read(),\n    author=\"Dmitry Petrov\",\n    author_email=\"dmitry@dataversioncontrol.com\",\n    download_url=\"https://github.com/iterative/dvc\",\n    license=\"Apache License 2.0\",\n    install_requires=install_requires,\n    extras_require={\n        \"all\": all_remotes,\n        \"gs\": gs,\n        \"s3\": s3,\n        \"azure\": azure,\n        \"oss\": oss,\n        \"ssh\": ssh,\n        # NOTE: https://github.com/inveniosoftware/troubleshooting/issues/1\n        \":python_version=='2.7'\": [\"futures\", \"pathlib2\"],\n        \"tests\": tests_requirements,\n    },\n    keywords=\"data science, data version control, machine learning\",\n    python_requires=\">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*\",\n    classifiers=[\n        \"Development Status :: 4 - Beta\",\n        \"Programming Language :: Python :: 2\",\n        \"Programming Language :: Python :: 2.7\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.5\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n    ],\n    packages=find_packages(exclude=[\"tests\"]),\n    include_package_data=True,\n    url=\"http://dataversioncontrol.com\",\n    entry_points={\"console_scripts\": [\"dvc = dvc.main:main\"]},\n    cmdclass={\"build_py\": build_py},\n    zip_safe=False,\n)\n", "path": "setup.py"}]}