prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Setup adds files directly to the root of sys.prefix
  The arguments to `setup.py` add files directly to the root of `sys.prefix`, instead of in a nevergrad-specific subsubdirectory.
  
  ## Steps to reproduce
  
  ```console
  jwnimmer@call-cc:~/issue$ python3 -m virtualenv --python python3 scratch
  Already using interpreter /usr/bin/python3
  Using base prefix '/usr'
  New python executable in /home/jwnimmer/issue/scratch/bin/python3
  Also creating executable in /home/jwnimmer/issue/scratch/bin/python
  Installing setuptools, pkg_resources, pip, wheel...done.
  
  jwnimmer@call-cc:~/issue$ scratch/bin/pip install 'nevergrad == 0.2.2'
  Collecting nevergrad==0.2.2
    Downloading https://files.pythonhosted.org/packages/46/04/b2f4673771fbd2fd07143f44a4f2880f8cbaa08a0cc32bdf287eef99c1d7/nevergrad-0.2.2-py3-none-any.whl (170kB)
  ... etc ...
  ... etc ...
  Installing collected packages: typing-extensions, numpy, scipy, joblib, scikit-learn, bayesian-optimization, cma, six, python-dateutil, pytz, pandas, nevergrad
  Successfully installed bayesian-optimization-1.0.1 cma-2.7.0 joblib-0.13.2 nevergrad-0.2.2 numpy-1.16.4 pandas-0.24.2 python-dateutil-2.8.0 pytz-2019.1 scikit-learn-0.21.2 scipy-1.3.0 six-1.12.0 typing-extensions-3.7.4
  
  jwnimmer@call-cc:~/issue$ ls -l scratch
  total 80
  -rw-rw-r-- 1 jwnimmer jwnimmer   84 Jul 23 14:08 bench.txt
  drwxrwxr-x 2 jwnimmer jwnimmer 4096 Jul 23 14:08 bin
  -rw-rw-r-- 1 jwnimmer jwnimmer  102 Jul 23 14:08 dev.txt
  drwxrwxr-x 2 jwnimmer jwnimmer 4096 Jul 23 14:07 include
  drwxrwxr-x 3 jwnimmer jwnimmer 4096 Jul 23 14:07 lib
  -rw-rw-r-- 1 jwnimmer jwnimmer 1086 Jul 23 14:08 LICENSE
  -rw-rw-r-- 1 jwnimmer jwnimmer   94 Jul 23 14:08 main.txt
  drwxrwxr-x 3 jwnimmer jwnimmer 4096 Jul 23 14:08 nevergrad
  -rw-rw-r-- 1 jwnimmer jwnimmer   59 Jul 23 14:07 pip-selfcheck.json
  drwxrwxr-x 3 jwnimmer jwnimmer 4096 Jul 23 14:07 share
  ```
  
  ## Observed Results
  
  The `sys.prefix` contains spurious files:
  ```
  LICENSE
  bench.txt
  dev.txt
  main.txt
  nevergrad/*
  ```
  
  ## Expected Results
  
  Only standardized files and folders (bin, lib, share, ...) exist in the root of `sys.prefix`.
  
  ## Relevant Code
  
  https://github.com/facebookresearch/nevergrad/blob/aabb4475b04fc10e668cd1ed6783d24107c72390/setup.py#L68-L70
  
  ## Additional thoughts
  
  I am sure why the `LICENSE` or `*.txt` files are being explicitly installed in the first place.  I believe that information is already available in the metadata.  If they are to be installed, they should be in a nevergrad-specific subfolder.
  
  I suspect the nevergrad examples are probably better installed using `packages=` or `package_data=` argument, not `data_files=`.
  
  --- 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 #!/usr/bin/env python
  2 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  3 #
  4 # This source code is licensed under the MIT license found in the
  5 # LICENSE file in the root directory of this source tree.
  6 
  7 import re
  8 from pathlib import Path
  9 from typing import Dict, List, Match
  10 from setuptools import setup
  11 from setuptools import find_packages
  12 
  13 
  14 # read requirements
  15 
  16 requirements: Dict[str, List[str]] = {}
  17 for extra in ["dev", "bench", "main"]:
  18     requirements[extra] = Path(f"requirements/{extra}.txt").read_text().splitlines()
  19 
  20 
  21 # build long description
  22 
  23 with open("README.md", "r", encoding="utf-8") as fh:
  24     long_description = fh.read()
  25 
  26 
  27 def _replace_relative_links(regex: Match[str]) -> str:
  28     """Converts relative links into links to master
  29     """
  30     string = regex.group()
  31     link = regex.group("link")
  32     name = regex.group("name")
  33     if not link.startswith("http") and Path(link).exists():
  34         githuburl = ("github.com/facebookresearch/nevergrad/blob/master" if not link.endswith(".gif") else
  35                      "raw.githubusercontent.com/facebookresearch/nevergrad/master")
  36         string = f"[{name}](https://{githuburl}/{link})"
  37     return string
  38 
  39 
  40 pattern = re.compile(r"\[(?P<name>.+?)\]\((?P<link>\S+?)\)")
  41 long_description = re.sub(pattern, _replace_relative_links, long_description)
  42 
  43 
  44 # find version
  45 
  46 init_str = Path("nevergrad/__init__.py").read_text()
  47 match = re.search(r"^__version__ = \"(?P<version>[\w\.]+?)\"$", init_str, re.MULTILINE)
  48 assert match is not None, "Could not find version in nevergrad/__init__.py"
  49 version = match.group("version")
  50 
  51 
  52 # setup
  53 
  54 setup(
  55     name="nevergrad",
  56     version=version,
  57     license="MIT",
  58     description="A Python toolbox for performing gradient-free optimization",
  59     long_description=long_description,
  60     long_description_content_type="text/markdown",
  61     author="Facebook AI Research",
  62     url="https://github.com/facebookresearch/nevergrad",
  63     packages=find_packages(),
  64     classifiers=["License :: OSI Approved :: MIT License",
  65                  "Intended Audience :: Science/Research",
  66                  "Topic :: Scientific/Engineering",
  67                  "Programming Language :: Python"],
  68     data_files=[("", ["LICENSE", "requirements/main.txt", "requirements/dev.txt", "requirements/bench.txt"]),
  69                 ("nevergrad", ["nevergrad/benchmark/additional/example.py",
  70                                "nevergrad/instrumentation/examples/script.py"])],
  71     install_requires=requirements["main"],
  72     extras_require={"all": requirements["dev"] + requirements["bench"],
  73                     "dev": requirements["dev"],
  74                     "benchmark": requirements["bench"]}
  75 )
  76
  ```
  --- 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
  @@ -65,11 +65,9 @@
                    "Intended Audience :: Science/Research",
                    "Topic :: Scientific/Engineering",
                    "Programming Language :: Python"],
  -    data_files=[("", ["LICENSE", "requirements/main.txt", "requirements/dev.txt", "requirements/bench.txt"]),
  -                ("nevergrad", ["nevergrad/benchmark/additional/example.py",
  -                               "nevergrad/instrumentation/examples/script.py"])],
       install_requires=requirements["main"],
       extras_require={"all": requirements["dev"] + requirements["bench"],
                       "dev": requirements["dev"],
  -                    "benchmark": requirements["bench"]}
  +                    "benchmark": requirements["bench"]},
  +    package_data={"nevergrad": ["py.typed", "*.csv", "*.py", "functions/photonics/src/*"]},
   )
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -65,11 +65,9 @@\n                  \"Intended Audience :: Science/Research\",\n                  \"Topic :: Scientific/Engineering\",\n                  \"Programming Language :: Python\"],\n-    data_files=[(\"\", [\"LICENSE\", \"requirements/main.txt\", \"requirements/dev.txt\", \"requirements/bench.txt\"]),\n-                (\"nevergrad\", [\"nevergrad/benchmark/additional/example.py\",\n-                               \"nevergrad/instrumentation/examples/script.py\"])],\n     install_requires=requirements[\"main\"],\n     extras_require={\"all\": requirements[\"dev\"] + requirements[\"bench\"],\n                     \"dev\": requirements[\"dev\"],\n-                    \"benchmark\": requirements[\"bench\"]}\n+                    \"benchmark\": requirements[\"bench\"]},\n+    package_data={\"nevergrad\": [\"py.typed\", \"*.csv\", \"*.py\", \"functions/photonics/src/*\"]},\n )\n", "issue": "Setup adds files directly to the root of sys.prefix\nThe arguments to `setup.py` add files directly to the root of `sys.prefix`, instead of in a nevergrad-specific subsubdirectory.\r\n\r\n## Steps to reproduce\r\n\r\n```console\r\njwnimmer@call-cc:~/issue$ python3 -m virtualenv --python python3 scratch\r\nAlready using interpreter /usr/bin/python3\r\nUsing base prefix '/usr'\r\nNew python executable in /home/jwnimmer/issue/scratch/bin/python3\r\nAlso creating executable in /home/jwnimmer/issue/scratch/bin/python\r\nInstalling setuptools, pkg_resources, pip, wheel...done.\r\n\r\njwnimmer@call-cc:~/issue$ scratch/bin/pip install 'nevergrad == 0.2.2'\r\nCollecting nevergrad==0.2.2\r\n  Downloading https://files.pythonhosted.org/packages/46/04/b2f4673771fbd2fd07143f44a4f2880f8cbaa08a0cc32bdf287eef99c1d7/nevergrad-0.2.2-py3-none-any.whl (170kB)\r\n... etc ...\r\n... etc ...\r\nInstalling collected packages: typing-extensions, numpy, scipy, joblib, scikit-learn, bayesian-optimization, cma, six, python-dateutil, pytz, pandas, nevergrad\r\nSuccessfully installed bayesian-optimization-1.0.1 cma-2.7.0 joblib-0.13.2 nevergrad-0.2.2 numpy-1.16.4 pandas-0.24.2 python-dateutil-2.8.0 pytz-2019.1 scikit-learn-0.21.2 scipy-1.3.0 six-1.12.0 typing-extensions-3.7.4\r\n\r\njwnimmer@call-cc:~/issue$ ls -l scratch\r\ntotal 80\r\n-rw-rw-r-- 1 jwnimmer jwnimmer   84 Jul 23 14:08 bench.txt\r\ndrwxrwxr-x 2 jwnimmer jwnimmer 4096 Jul 23 14:08 bin\r\n-rw-rw-r-- 1 jwnimmer jwnimmer  102 Jul 23 14:08 dev.txt\r\ndrwxrwxr-x 2 jwnimmer jwnimmer 4096 Jul 23 14:07 include\r\ndrwxrwxr-x 3 jwnimmer jwnimmer 4096 Jul 23 14:07 lib\r\n-rw-rw-r-- 1 jwnimmer jwnimmer 1086 Jul 23 14:08 LICENSE\r\n-rw-rw-r-- 1 jwnimmer jwnimmer   94 Jul 23 14:08 main.txt\r\ndrwxrwxr-x 3 jwnimmer jwnimmer 4096 Jul 23 14:08 nevergrad\r\n-rw-rw-r-- 1 jwnimmer jwnimmer   59 Jul 23 14:07 pip-selfcheck.json\r\ndrwxrwxr-x 3 jwnimmer jwnimmer 4096 Jul 23 14:07 share\r\n```\r\n\r\n## Observed Results\r\n\r\nThe `sys.prefix` contains spurious files:\r\n```\r\nLICENSE\r\nbench.txt\r\ndev.txt\r\nmain.txt\r\nnevergrad/*\r\n```\r\n\r\n## Expected Results\r\n\r\nOnly standardized files and folders (bin, lib, share, ...) exist in the root of `sys.prefix`.\r\n\r\n## Relevant Code\r\n\r\nhttps://github.com/facebookresearch/nevergrad/blob/aabb4475b04fc10e668cd1ed6783d24107c72390/setup.py#L68-L70\r\n\r\n## Additional thoughts\r\n\r\nI am sure why the `LICENSE` or `*.txt` files are being explicitly installed in the first place.  I believe that information is already available in the metadata.  If they are to be installed, they should be in a nevergrad-specific subfolder.\r\n\r\nI suspect the nevergrad examples are probably better installed using `packages=` or `package_data=` argument, not `data_files=`.\n", "before_files": [{"content": "#!/usr/bin/env python\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n#\n# This source code is licensed under the MIT license found in the\n# LICENSE file in the root directory of this source tree.\n\nimport re\nfrom pathlib import Path\nfrom typing import Dict, List, Match\nfrom setuptools import setup\nfrom setuptools import find_packages\n\n\n# read requirements\n\nrequirements: Dict[str, List[str]] = {}\nfor extra in [\"dev\", \"bench\", \"main\"]:\n    requirements[extra] = Path(f\"requirements/{extra}.txt\").read_text().splitlines()\n\n\n# build long description\n\nwith open(\"README.md\", \"r\", encoding=\"utf-8\") as fh:\n    long_description = fh.read()\n\n\ndef _replace_relative_links(regex: Match[str]) -> str:\n    \"\"\"Converts relative links into links to master\n    \"\"\"\n    string = regex.group()\n    link = regex.group(\"link\")\n    name = regex.group(\"name\")\n    if not link.startswith(\"http\") and Path(link).exists():\n        githuburl = (\"github.com/facebookresearch/nevergrad/blob/master\" if not link.endswith(\".gif\") else\n                     \"raw.githubusercontent.com/facebookresearch/nevergrad/master\")\n        string = f\"[{name}](https://{githuburl}/{link})\"\n    return string\n\n\npattern = re.compile(r\"\\[(?P<name>.+?)\\]\\((?P<link>\\S+?)\\)\")\nlong_description = re.sub(pattern, _replace_relative_links, long_description)\n\n\n# find version\n\ninit_str = Path(\"nevergrad/__init__.py\").read_text()\nmatch = re.search(r\"^__version__ = \\\"(?P<version>[\\w\\.]+?)\\\"$\", init_str, re.MULTILINE)\nassert match is not None, \"Could not find version in nevergrad/__init__.py\"\nversion = match.group(\"version\")\n\n\n# setup\n\nsetup(\n    name=\"nevergrad\",\n    version=version,\n    license=\"MIT\",\n    description=\"A Python toolbox for performing gradient-free optimization\",\n    long_description=long_description,\n    long_description_content_type=\"text/markdown\",\n    author=\"Facebook AI Research\",\n    url=\"https://github.com/facebookresearch/nevergrad\",\n    packages=find_packages(),\n    classifiers=[\"License :: OSI Approved :: MIT License\",\n                 \"Intended Audience :: Science/Research\",\n                 \"Topic :: Scientific/Engineering\",\n                 \"Programming Language :: Python\"],\n    data_files=[(\"\", [\"LICENSE\", \"requirements/main.txt\", \"requirements/dev.txt\", \"requirements/bench.txt\"]),\n                (\"nevergrad\", [\"nevergrad/benchmark/additional/example.py\",\n                               \"nevergrad/instrumentation/examples/script.py\"])],\n    install_requires=requirements[\"main\"],\n    extras_require={\"all\": requirements[\"dev\"] + requirements[\"bench\"],\n                    \"dev\": requirements[\"dev\"],\n                    \"benchmark\": requirements[\"bench\"]}\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n#\n# This source code is licensed under the MIT license found in the\n# LICENSE file in the root directory of this source tree.\n\nimport re\nfrom pathlib import Path\nfrom typing import Dict, List, Match\nfrom setuptools import setup\nfrom setuptools import find_packages\n\n\n# read requirements\n\nrequirements: Dict[str, List[str]] = {}\nfor extra in [\"dev\", \"bench\", \"main\"]:\n    requirements[extra] = Path(f\"requirements/{extra}.txt\").read_text().splitlines()\n\n\n# build long description\n\nwith open(\"README.md\", \"r\", encoding=\"utf-8\") as fh:\n    long_description = fh.read()\n\n\ndef _replace_relative_links(regex: Match[str]) -> str:\n    \"\"\"Converts relative links into links to master\n    \"\"\"\n    string = regex.group()\n    link = regex.group(\"link\")\n    name = regex.group(\"name\")\n    if not link.startswith(\"http\") and Path(link).exists():\n        githuburl = (\"github.com/facebookresearch/nevergrad/blob/master\" if not link.endswith(\".gif\") else\n                     \"raw.githubusercontent.com/facebookresearch/nevergrad/master\")\n        string = f\"[{name}](https://{githuburl}/{link})\"\n    return string\n\n\npattern = re.compile(r\"\\[(?P<name>.+?)\\]\\((?P<link>\\S+?)\\)\")\nlong_description = re.sub(pattern, _replace_relative_links, long_description)\n\n\n# find version\n\ninit_str = Path(\"nevergrad/__init__.py\").read_text()\nmatch = re.search(r\"^__version__ = \\\"(?P<version>[\\w\\.]+?)\\\"$\", init_str, re.MULTILINE)\nassert match is not None, \"Could not find version in nevergrad/__init__.py\"\nversion = match.group(\"version\")\n\n\n# setup\n\nsetup(\n    name=\"nevergrad\",\n    version=version,\n    license=\"MIT\",\n    description=\"A Python toolbox for performing gradient-free optimization\",\n    long_description=long_description,\n    long_description_content_type=\"text/markdown\",\n    author=\"Facebook AI Research\",\n    url=\"https://github.com/facebookresearch/nevergrad\",\n    packages=find_packages(),\n    classifiers=[\"License :: OSI Approved :: MIT License\",\n                 \"Intended Audience :: Science/Research\",\n                 \"Topic :: Scientific/Engineering\",\n                 \"Programming Language :: Python\"],\n    install_requires=requirements[\"main\"],\n    extras_require={\"all\": requirements[\"dev\"] + requirements[\"bench\"],\n                    \"dev\": requirements[\"dev\"],\n                    \"benchmark\": requirements[\"bench\"]},\n    package_data={\"nevergrad\": [\"py.typed\", \"*.csv\", \"*.py\", \"functions/photonics/src/*\"]},\n)\n", "path": "setup.py"}]}