We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Support latest Pygments (for improved Haskell syntax, and more)
### Change Requested
The use of `Pygments==2.2.0` (or newer, potentially) to highlight code.

### Background
As part of a [syntax highlighting problem noted on Haskell-Servant](https://github.com/haskell-servant/servant/issues/359), @teh pushed a [PR for Pygments](https://bitbucket.org/birkenfeld/pygments-main/pull-requests/685/two-haskell-fixes/diff) that was merged a while ago. 

I've submitted [a Pygments dependency bump in the Servant codebase](https://github.com/haskell-servant/servant/compare/master...declension:359-upgrade-pygments) which works locally, but as we use https://readthedocs.org for actually hosting, it won't help solve the real problem unless Pygments is upgraded here too...

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `readthedocs/doc_builder/python_environments.py`
Content:
```
1 import logging
2 import os
3 import shutil
4 
5 from django.conf import settings
6 
7 from readthedocs.doc_builder.config import ConfigWrapper
8 from readthedocs.doc_builder.loader import get_builder_class
9 from readthedocs.projects.constants import LOG_TEMPLATE
10 
11 log = logging.getLogger(__name__)
12 
13 
14 class PythonEnvironment(object):
15 
16     def __init__(self, version, build_env, config=None):
17         self.version = version
18         self.project = version.project
19         self.build_env = build_env
20         if config:
21             self.config = config
22         else:
23             self.config = ConfigWrapper(version=version, yaml_config={})
24         # Compute here, since it's used a lot
25         self.checkout_path = self.project.checkout_path(self.version.slug)
26 
27     def _log(self, msg):
28         log.info(LOG_TEMPLATE
29                  .format(project=self.project.slug,
30                          version=self.version.slug,
31                          msg=msg))
32 
33     def delete_existing_build_dir(self):
34 
35         # Handle deleting old build dir
36         build_dir = os.path.join(
37             self.venv_path(),
38             'build')
39         if os.path.exists(build_dir):
40             self._log('Removing existing build directory')
41             shutil.rmtree(build_dir)
42 
43     def install_package(self):
44         setup_path = os.path.join(self.checkout_path, 'setup.py')
45         if os.path.isfile(setup_path) and self.config.install_project:
46             if self.config.pip_install or getattr(settings, 'USE_PIP_INSTALL', False):
47                 extra_req_param = ''
48                 if self.config.extra_requirements:
49                     extra_req_param = '[{0}]'.format(
50                         ','.join(self.config.extra_requirements))
51                 self.build_env.run(
52                     'python',
53                     self.venv_bin(filename='pip'),
54                     'install',
55                     '--ignore-installed',
56                     '--cache-dir',
57                     self.project.pip_cache_path,
58                     '.{0}'.format(extra_req_param),
59                     cwd=self.checkout_path,
60                     bin_path=self.venv_bin()
61                 )
62             else:
63                 self.build_env.run(
64                     'python',
65                     'setup.py',
66                     'install',
67                     '--force',
68                     cwd=self.checkout_path,
69                     bin_path=self.venv_bin()
70                 )
71 
72     def venv_bin(self, filename=None):
73         """Return path to the virtualenv bin path, or a specific binary
74 
75         :param filename: If specified, add this filename to the path return
76         :returns: Path to virtualenv bin or filename in virtualenv bin
77         """
78         parts = [self.venv_path(), 'bin']
79         if filename is not None:
80             parts.append(filename)
81         return os.path.join(*parts)
82 
83 
84 class Virtualenv(PythonEnvironment):
85 
86     def venv_path(self):
87         return os.path.join(self.project.doc_path, 'envs', self.version.slug)
88 
89     def setup_base(self):
90         site_packages = '--no-site-packages'
91         if self.config.use_system_site_packages:
92             site_packages = '--system-site-packages'
93         env_path = self.venv_path()
94         self.build_env.run(
95             self.config.python_interpreter,
96             '-mvirtualenv',
97             site_packages,
98             '--no-download',
99             env_path,
100             bin_path=None,  # Don't use virtualenv bin that doesn't exist yet
101         )
102 
103     def install_core_requirements(self):
104         requirements = [
105             'sphinx==1.5.3',
106             'Pygments==2.1.3',
107             'setuptools==28.8.0',
108             'docutils==0.13.1',
109             'mkdocs==0.15.0',
110             'mock==1.0.1',
111             'pillow==2.6.1',
112             ('git+https://github.com/rtfd/readthedocs-sphinx-ext.git'
113              '@0.6-alpha#egg=readthedocs-sphinx-ext'),
114             'sphinx-rtd-theme<0.3',
115             'alabaster>=0.7,<0.8,!=0.7.5',
116             'commonmark==0.5.4',
117             'recommonmark==0.4.0',
118         ]
119 
120         cmd = [
121             'python',
122             self.venv_bin(filename='pip'),
123             'install',
124             '--use-wheel',
125             '-U',
126             '--cache-dir',
127             self.project.pip_cache_path,
128         ]
129         if self.config.use_system_site_packages:
130             # Other code expects sphinx-build to be installed inside the
131             # virtualenv.  Using the -I option makes sure it gets installed
132             # even if it is already installed system-wide (and
133             # --system-site-packages is used)
134             cmd.append('-I')
135         cmd.extend(requirements)
136         self.build_env.run(
137             *cmd,
138             bin_path=self.venv_bin()
139         )
140 
141     def install_user_requirements(self):
142         requirements_file_path = self.config.requirements_file
143         if not requirements_file_path:
144             builder_class = get_builder_class(self.project.documentation_type)
145             docs_dir = (builder_class(build_env=self.build_env, python_env=self)
146                         .docs_dir())
147             for path in [docs_dir, '']:
148                 for req_file in ['pip_requirements.txt', 'requirements.txt']:
149                     test_path = os.path.join(self.checkout_path, path, req_file)
150                     if os.path.exists(test_path):
151                         requirements_file_path = test_path
152                         break
153 
154         if requirements_file_path:
155             self.build_env.run(
156                 'python',
157                 self.venv_bin(filename='pip'),
158                 'install',
159                 '--exists-action=w',
160                 '--cache-dir',
161                 self.project.pip_cache_path,
162                 '-r{0}'.format(requirements_file_path),
163                 cwd=self.checkout_path,
164                 bin_path=self.venv_bin()
165             )
166 
167 
168 class Conda(PythonEnvironment):
169 
170     def venv_path(self):
171         return os.path.join(self.project.doc_path, 'conda', self.version.slug)
172 
173     def setup_base(self):
174         conda_env_path = os.path.join(self.project.doc_path, 'conda')
175         version_path = os.path.join(conda_env_path, self.version.slug)
176 
177         if os.path.exists(version_path):
178             # Re-create conda directory each time to keep fresh state
179             self._log('Removing existing conda directory')
180             shutil.rmtree(version_path)
181         self.build_env.run(
182             'conda',
183             'env',
184             'create',
185             '--name',
186             self.version.slug,
187             '--file',
188             self.config.conda_file,
189             bin_path=None,  # Don't use conda bin that doesn't exist yet
190         )
191 
192     def install_core_requirements(self):
193 
194         # Use conda for requirements it packages
195         requirements = [
196             'sphinx==1.3.5',
197             'Pygments==2.1.1',
198             'docutils==0.12',
199             'mock',
200             'pillow==3.0.0',
201             'sphinx_rtd_theme==0.1.7',
202             'alabaster>=0.7,<0.8,!=0.7.5',
203         ]
204 
205         cmd = [
206             'conda',
207             'install',
208             '--yes',
209             '--name',
210             self.version.slug,
211         ]
212         cmd.extend(requirements)
213         self.build_env.run(
214             *cmd
215         )
216 
217         # Install pip-only things.
218         pip_requirements = [
219             'mkdocs==0.15.0',
220             ('git+https://github.com/rtfd/readthedocs-sphinx-ext.git'
221              '@0.6-alpha#egg=readthedocs-sphinx-ext'),
222             'commonmark==0.5.4',
223             'recommonmark==0.1.1',
224         ]
225 
226         pip_cmd = [
227             'python',
228             self.venv_bin(filename='pip'),
229             'install',
230             '-U',
231             '--cache-dir',
232             self.project.pip_cache_path,
233         ]
234         pip_cmd.extend(pip_requirements)
235         self.build_env.run(
236             *pip_cmd,
237             bin_path=self.venv_bin()
238         )
239 
240     def install_user_requirements(self):
241         self.build_env.run(
242             'conda',
243             'env',
244             'update',
245             '--name',
246             self.version.slug,
247             '--file',
248             self.config.conda_file,
249         )
250
```
--- 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()

```

diff --git a/readthedocs/doc_builder/python_environments.py b/readthedocs/doc_builder/python_environments.py
--- a/readthedocs/doc_builder/python_environments.py
+++ b/readthedocs/doc_builder/python_environments.py
@@ -103,7 +103,7 @@
     def install_core_requirements(self):
         requirements = [
             'sphinx==1.5.3',
-            'Pygments==2.1.3',
+            'Pygments==2.2.0',
             'setuptools==28.8.0',
             'docutils==0.13.1',
             'mkdocs==0.15.0',
@@ -194,7 +194,7 @@
         # Use conda for requirements it packages
         requirements = [
             'sphinx==1.3.5',
-            'Pygments==2.1.1',
+            'Pygments==2.2.0',
             'docutils==0.12',
             'mock',
             'pillow==3.0.0',

{"golden_diff": "diff --git a/readthedocs/doc_builder/python_environments.py b/readthedocs/doc_builder/python_environments.py\n--- a/readthedocs/doc_builder/python_environments.py\n+++ b/readthedocs/doc_builder/python_environments.py\n@@ -103,7 +103,7 @@\n     def install_core_requirements(self):\n         requirements = [\n             'sphinx==1.5.3',\n-            'Pygments==2.1.3',\n+            'Pygments==2.2.0',\n             'setuptools==28.8.0',\n             'docutils==0.13.1',\n             'mkdocs==0.15.0',\n@@ -194,7 +194,7 @@\n         # Use conda for requirements it packages\n         requirements = [\n             'sphinx==1.3.5',\n-            'Pygments==2.1.1',\n+            'Pygments==2.2.0',\n             'docutils==0.12',\n             'mock',\n             'pillow==3.0.0',\n", "issue": "Support latest Pygments (for improved Haskell syntax, and more)\n### Change Requested\r\nThe use of `Pygments==2.2.0` (or newer, potentially) to highlight code.\r\n\r\n### Background\r\nAs part of a [syntax highlighting problem noted on Haskell-Servant](https://github.com/haskell-servant/servant/issues/359), @teh pushed a [PR for Pygments](https://bitbucket.org/birkenfeld/pygments-main/pull-requests/685/two-haskell-fixes/diff) that was merged a while ago. \r\n\r\nI've submitted [a Pygments dependency bump in the Servant codebase](https://github.com/haskell-servant/servant/compare/master...declension:359-upgrade-pygments) which works locally, but as we use https://readthedocs.org for actually hosting, it won't help solve the real problem unless Pygments is upgraded here too...\n", "before_files": [{"content": "import logging\nimport os\nimport shutil\n\nfrom django.conf import settings\n\nfrom readthedocs.doc_builder.config import ConfigWrapper\nfrom readthedocs.doc_builder.loader import get_builder_class\nfrom readthedocs.projects.constants import LOG_TEMPLATE\n\nlog = logging.getLogger(__name__)\n\n\nclass PythonEnvironment(object):\n\n    def __init__(self, version, build_env, config=None):\n        self.version = version\n        self.project = version.project\n        self.build_env = build_env\n        if config:\n            self.config = config\n        else:\n            self.config = ConfigWrapper(version=version, yaml_config={})\n        # Compute here, since it's used a lot\n        self.checkout_path = self.project.checkout_path(self.version.slug)\n\n    def _log(self, msg):\n        log.info(LOG_TEMPLATE\n                 .format(project=self.project.slug,\n                         version=self.version.slug,\n                         msg=msg))\n\n    def delete_existing_build_dir(self):\n\n        # Handle deleting old build dir\n        build_dir = os.path.join(\n            self.venv_path(),\n            'build')\n        if os.path.exists(build_dir):\n            self._log('Removing existing build directory')\n            shutil.rmtree(build_dir)\n\n    def install_package(self):\n        setup_path = os.path.join(self.checkout_path, 'setup.py')\n        if os.path.isfile(setup_path) and self.config.install_project:\n            if self.config.pip_install or getattr(settings, 'USE_PIP_INSTALL', False):\n                extra_req_param = ''\n                if self.config.extra_requirements:\n                    extra_req_param = '[{0}]'.format(\n                        ','.join(self.config.extra_requirements))\n                self.build_env.run(\n                    'python',\n                    self.venv_bin(filename='pip'),\n                    'install',\n                    '--ignore-installed',\n                    '--cache-dir',\n                    self.project.pip_cache_path,\n                    '.{0}'.format(extra_req_param),\n                    cwd=self.checkout_path,\n                    bin_path=self.venv_bin()\n                )\n            else:\n                self.build_env.run(\n                    'python',\n                    'setup.py',\n                    'install',\n                    '--force',\n                    cwd=self.checkout_path,\n                    bin_path=self.venv_bin()\n                )\n\n    def venv_bin(self, filename=None):\n        \"\"\"Return path to the virtualenv bin path, or a specific binary\n\n        :param filename: If specified, add this filename to the path return\n        :returns: Path to virtualenv bin or filename in virtualenv bin\n        \"\"\"\n        parts = [self.venv_path(), 'bin']\n        if filename is not None:\n            parts.append(filename)\n        return os.path.join(*parts)\n\n\nclass Virtualenv(PythonEnvironment):\n\n    def venv_path(self):\n        return os.path.join(self.project.doc_path, 'envs', self.version.slug)\n\n    def setup_base(self):\n        site_packages = '--no-site-packages'\n        if self.config.use_system_site_packages:\n            site_packages = '--system-site-packages'\n        env_path = self.venv_path()\n        self.build_env.run(\n            self.config.python_interpreter,\n            '-mvirtualenv',\n            site_packages,\n            '--no-download',\n            env_path,\n            bin_path=None,  # Don't use virtualenv bin that doesn't exist yet\n        )\n\n    def install_core_requirements(self):\n        requirements = [\n            'sphinx==1.5.3',\n            'Pygments==2.1.3',\n            'setuptools==28.8.0',\n            'docutils==0.13.1',\n            'mkdocs==0.15.0',\n            'mock==1.0.1',\n            'pillow==2.6.1',\n            ('git+https://github.com/rtfd/readthedocs-sphinx-ext.git'\n             '@0.6-alpha#egg=readthedocs-sphinx-ext'),\n            'sphinx-rtd-theme<0.3',\n            'alabaster>=0.7,<0.8,!=0.7.5',\n            'commonmark==0.5.4',\n            'recommonmark==0.4.0',\n        ]\n\n        cmd = [\n            'python',\n            self.venv_bin(filename='pip'),\n            'install',\n            '--use-wheel',\n            '-U',\n            '--cache-dir',\n            self.project.pip_cache_path,\n        ]\n        if self.config.use_system_site_packages:\n            # Other code expects sphinx-build to be installed inside the\n            # virtualenv.  Using the -I option makes sure it gets installed\n            # even if it is already installed system-wide (and\n            # --system-site-packages is used)\n            cmd.append('-I')\n        cmd.extend(requirements)\n        self.build_env.run(\n            *cmd,\n            bin_path=self.venv_bin()\n        )\n\n    def install_user_requirements(self):\n        requirements_file_path = self.config.requirements_file\n        if not requirements_file_path:\n            builder_class = get_builder_class(self.project.documentation_type)\n            docs_dir = (builder_class(build_env=self.build_env, python_env=self)\n                        .docs_dir())\n            for path in [docs_dir, '']:\n                for req_file in ['pip_requirements.txt', 'requirements.txt']:\n                    test_path = os.path.join(self.checkout_path, path, req_file)\n                    if os.path.exists(test_path):\n                        requirements_file_path = test_path\n                        break\n\n        if requirements_file_path:\n            self.build_env.run(\n                'python',\n                self.venv_bin(filename='pip'),\n                'install',\n                '--exists-action=w',\n                '--cache-dir',\n                self.project.pip_cache_path,\n                '-r{0}'.format(requirements_file_path),\n                cwd=self.checkout_path,\n                bin_path=self.venv_bin()\n            )\n\n\nclass Conda(PythonEnvironment):\n\n    def venv_path(self):\n        return os.path.join(self.project.doc_path, 'conda', self.version.slug)\n\n    def setup_base(self):\n        conda_env_path = os.path.join(self.project.doc_path, 'conda')\n        version_path = os.path.join(conda_env_path, self.version.slug)\n\n        if os.path.exists(version_path):\n            # Re-create conda directory each time to keep fresh state\n            self._log('Removing existing conda directory')\n            shutil.rmtree(version_path)\n        self.build_env.run(\n            'conda',\n            'env',\n            'create',\n            '--name',\n            self.version.slug,\n            '--file',\n            self.config.conda_file,\n            bin_path=None,  # Don't use conda bin that doesn't exist yet\n        )\n\n    def install_core_requirements(self):\n\n        # Use conda for requirements it packages\n        requirements = [\n            'sphinx==1.3.5',\n            'Pygments==2.1.1',\n            'docutils==0.12',\n            'mock',\n            'pillow==3.0.0',\n            'sphinx_rtd_theme==0.1.7',\n            'alabaster>=0.7,<0.8,!=0.7.5',\n        ]\n\n        cmd = [\n            'conda',\n            'install',\n            '--yes',\n            '--name',\n            self.version.slug,\n        ]\n        cmd.extend(requirements)\n        self.build_env.run(\n            *cmd\n        )\n\n        # Install pip-only things.\n        pip_requirements = [\n            'mkdocs==0.15.0',\n            ('git+https://github.com/rtfd/readthedocs-sphinx-ext.git'\n             '@0.6-alpha#egg=readthedocs-sphinx-ext'),\n            'commonmark==0.5.4',\n            'recommonmark==0.1.1',\n        ]\n\n        pip_cmd = [\n            'python',\n            self.venv_bin(filename='pip'),\n            'install',\n            '-U',\n            '--cache-dir',\n            self.project.pip_cache_path,\n        ]\n        pip_cmd.extend(pip_requirements)\n        self.build_env.run(\n            *pip_cmd,\n            bin_path=self.venv_bin()\n        )\n\n    def install_user_requirements(self):\n        self.build_env.run(\n            'conda',\n            'env',\n            'update',\n            '--name',\n            self.version.slug,\n            '--file',\n            self.config.conda_file,\n        )\n", "path": "readthedocs/doc_builder/python_environments.py"}], "after_files": [{"content": "import logging\nimport os\nimport shutil\n\nfrom django.conf import settings\n\nfrom readthedocs.doc_builder.config import ConfigWrapper\nfrom readthedocs.doc_builder.loader import get_builder_class\nfrom readthedocs.projects.constants import LOG_TEMPLATE\n\nlog = logging.getLogger(__name__)\n\n\nclass PythonEnvironment(object):\n\n    def __init__(self, version, build_env, config=None):\n        self.version = version\n        self.project = version.project\n        self.build_env = build_env\n        if config:\n            self.config = config\n        else:\n            self.config = ConfigWrapper(version=version, yaml_config={})\n        # Compute here, since it's used a lot\n        self.checkout_path = self.project.checkout_path(self.version.slug)\n\n    def _log(self, msg):\n        log.info(LOG_TEMPLATE\n                 .format(project=self.project.slug,\n                         version=self.version.slug,\n                         msg=msg))\n\n    def delete_existing_build_dir(self):\n\n        # Handle deleting old build dir\n        build_dir = os.path.join(\n            self.venv_path(),\n            'build')\n        if os.path.exists(build_dir):\n            self._log('Removing existing build directory')\n            shutil.rmtree(build_dir)\n\n    def install_package(self):\n        setup_path = os.path.join(self.checkout_path, 'setup.py')\n        if os.path.isfile(setup_path) and self.config.install_project:\n            if self.config.pip_install or getattr(settings, 'USE_PIP_INSTALL', False):\n                extra_req_param = ''\n                if self.config.extra_requirements:\n                    extra_req_param = '[{0}]'.format(\n                        ','.join(self.config.extra_requirements))\n                self.build_env.run(\n                    'python',\n                    self.venv_bin(filename='pip'),\n                    'install',\n                    '--ignore-installed',\n                    '--cache-dir',\n                    self.project.pip_cache_path,\n                    '.{0}'.format(extra_req_param),\n                    cwd=self.checkout_path,\n                    bin_path=self.venv_bin()\n                )\n            else:\n                self.build_env.run(\n                    'python',\n                    'setup.py',\n                    'install',\n                    '--force',\n                    cwd=self.checkout_path,\n                    bin_path=self.venv_bin()\n                )\n\n    def venv_bin(self, filename=None):\n        \"\"\"Return path to the virtualenv bin path, or a specific binary\n\n        :param filename: If specified, add this filename to the path return\n        :returns: Path to virtualenv bin or filename in virtualenv bin\n        \"\"\"\n        parts = [self.venv_path(), 'bin']\n        if filename is not None:\n            parts.append(filename)\n        return os.path.join(*parts)\n\n\nclass Virtualenv(PythonEnvironment):\n\n    def venv_path(self):\n        return os.path.join(self.project.doc_path, 'envs', self.version.slug)\n\n    def setup_base(self):\n        site_packages = '--no-site-packages'\n        if self.config.use_system_site_packages:\n            site_packages = '--system-site-packages'\n        env_path = self.venv_path()\n        self.build_env.run(\n            self.config.python_interpreter,\n            '-mvirtualenv',\n            site_packages,\n            '--no-download',\n            env_path,\n            bin_path=None,  # Don't use virtualenv bin that doesn't exist yet\n        )\n\n    def install_core_requirements(self):\n        requirements = [\n            'sphinx==1.5.3',\n            'Pygments==2.2.0',\n            'setuptools==28.8.0',\n            'docutils==0.13.1',\n            'mkdocs==0.15.0',\n            'mock==1.0.1',\n            'pillow==2.6.1',\n            ('git+https://github.com/rtfd/readthedocs-sphinx-ext.git'\n             '@0.6-alpha#egg=readthedocs-sphinx-ext'),\n            'sphinx-rtd-theme<0.3',\n            'alabaster>=0.7,<0.8,!=0.7.5',\n            'commonmark==0.5.4',\n            'recommonmark==0.4.0',\n        ]\n\n        cmd = [\n            'python',\n            self.venv_bin(filename='pip'),\n            'install',\n            '--use-wheel',\n            '-U',\n            '--cache-dir',\n            self.project.pip_cache_path,\n        ]\n        if self.config.use_system_site_packages:\n            # Other code expects sphinx-build to be installed inside the\n            # virtualenv.  Using the -I option makes sure it gets installed\n            # even if it is already installed system-wide (and\n            # --system-site-packages is used)\n            cmd.append('-I')\n        cmd.extend(requirements)\n        self.build_env.run(\n            *cmd,\n            bin_path=self.venv_bin()\n        )\n\n    def install_user_requirements(self):\n        requirements_file_path = self.config.requirements_file\n        if not requirements_file_path:\n            builder_class = get_builder_class(self.project.documentation_type)\n            docs_dir = (builder_class(build_env=self.build_env, python_env=self)\n                        .docs_dir())\n            for path in [docs_dir, '']:\n                for req_file in ['pip_requirements.txt', 'requirements.txt']:\n                    test_path = os.path.join(self.checkout_path, path, req_file)\n                    if os.path.exists(test_path):\n                        requirements_file_path = test_path\n                        break\n\n        if requirements_file_path:\n            self.build_env.run(\n                'python',\n                self.venv_bin(filename='pip'),\n                'install',\n                '--exists-action=w',\n                '--cache-dir',\n                self.project.pip_cache_path,\n                '-r{0}'.format(requirements_file_path),\n                cwd=self.checkout_path,\n                bin_path=self.venv_bin()\n            )\n\n\nclass Conda(PythonEnvironment):\n\n    def venv_path(self):\n        return os.path.join(self.project.doc_path, 'conda', self.version.slug)\n\n    def setup_base(self):\n        conda_env_path = os.path.join(self.project.doc_path, 'conda')\n        version_path = os.path.join(conda_env_path, self.version.slug)\n\n        if os.path.exists(version_path):\n            # Re-create conda directory each time to keep fresh state\n            self._log('Removing existing conda directory')\n            shutil.rmtree(version_path)\n        self.build_env.run(\n            'conda',\n            'env',\n            'create',\n            '--name',\n            self.version.slug,\n            '--file',\n            self.config.conda_file,\n            bin_path=None,  # Don't use conda bin that doesn't exist yet\n        )\n\n    def install_core_requirements(self):\n\n        # Use conda for requirements it packages\n        requirements = [\n            'sphinx==1.3.5',\n            'Pygments==2.2.0',\n            'docutils==0.12',\n            'mock',\n            'pillow==3.0.0',\n            'sphinx_rtd_theme==0.1.7',\n            'alabaster>=0.7,<0.8,!=0.7.5',\n        ]\n\n        cmd = [\n            'conda',\n            'install',\n            '--yes',\n            '--name',\n            self.version.slug,\n        ]\n        cmd.extend(requirements)\n        self.build_env.run(\n            *cmd\n        )\n\n        # Install pip-only things.\n        pip_requirements = [\n            'mkdocs==0.15.0',\n            ('git+https://github.com/rtfd/readthedocs-sphinx-ext.git'\n             '@0.6-alpha#egg=readthedocs-sphinx-ext'),\n            'commonmark==0.5.4',\n            'recommonmark==0.1.1',\n        ]\n\n        pip_cmd = [\n            'python',\n            self.venv_bin(filename='pip'),\n            'install',\n            '-U',\n            '--cache-dir',\n            self.project.pip_cache_path,\n        ]\n        pip_cmd.extend(pip_requirements)\n        self.build_env.run(\n            *pip_cmd,\n            bin_path=self.venv_bin()\n        )\n\n    def install_user_requirements(self):\n        self.build_env.run(\n            'conda',\n            'env',\n            'update',\n            '--name',\n            self.version.slug,\n            '--file',\n            self.config.conda_file,\n        )\n", "path": "readthedocs/doc_builder/python_environments.py"}]}