We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Pin the pyright version
The environment variable `PYRIGHT_PYTHON_FORCE_VERSION` needs to be set when pyright is installed from pip. Ideally we can set this variable in the setup.py (e.g. `os.environ['PYRIGHT_PYTHON_FORCE_VERSION'] = '...'`); but if not, then it should be in the `.ci/Jenkinsfile`.

--- 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 # Copyright 2021 MosaicML. All Rights Reserved.
2 
3 import os
4 import site
5 import sys
6 import textwrap
7 
8 import setuptools
9 from setuptools import setup
10 from setuptools.command.develop import develop as develop_orig
11 
12 _IS_ROOT = os.getuid() == 0
13 _IS_USER = "--user" in sys.argv[1:]
14 _IS_VIRTUALENV = "VIRTUAL_ENV" in os.environ
15 
16 
17 # From https://stackoverflow.com/questions/51292333/how-to-tell-from-setup-py-if-the-module-is-being-installed-in-editable-mode
18 class develop(develop_orig):
19 
20     def run(self):
21         if _IS_ROOT and (not _IS_VIRTUALENV) and (not _IS_USER):
22             raise RuntimeError(
23                 textwrap.dedent("""\
24                     When installing in editable mode as root outside of a virtual environment,
25                     please specify `--user`. Editable installs as the root user outside of a virtual environment
26                     do not work without the `--user` flag. Please instead run something like: `pip install --user -e .`"""
27                                ))
28         super().run()
29 
30 
31 # From https://github.com/pypa/pip/issues/7953#issuecomment-645133255
32 site.ENABLE_USER_SITE = _IS_USER
33 
34 
35 def package_files(directory: str):
36     # from https://stackoverflow.com/a/36693250
37     paths = []
38     for (path, _, filenames) in os.walk(directory):
39         for filename in filenames:
40             paths.append(os.path.join('..', path, filename))
41     return paths
42 
43 
44 with open("README.md", "r", encoding="utf-8") as fh:
45     long_description = fh.read()
46 
47 install_requires = [
48     "pyyaml>=5.4.1",
49     "tqdm>=4.62.3",
50     "torchmetrics>=0.6.0",
51     "torch_optimizer==0.1.0",
52     "torchvision>=0.9.0",
53     "torch>=1.9",
54     "yahp>=0.0.14",
55     "requests>=2.26.0",
56     "numpy==1.21.5",
57     "apache-libcloud>=3.3.1",
58     "psutil>=5.8.0",
59 ]
60 extra_deps = {}
61 
62 extra_deps['base'] = []
63 
64 extra_deps['dev'] = [
65     # Imports for docs builds and running tests
66     "custom_inherit==2.3.2",
67     'junitparser>=2.1.1',
68     'coverage[toml]>=6.1.1',
69     'fasteners>=0.16.3',  # run_directory_uploader tests require fasteners
70     'pytest>=7.0.0',
71     'toml>=0.10.2',
72     'yapf>=0.32.0',
73     'isort>=5.9.3',
74     'ipython>=7.29.0',
75     'ipykernel>=6.5.0',
76     'jupyter>=1.0.0',
77     'yamllint>=1.26.2',
78     'pytest-timeout>=1.4.2',
79     'pyright==1.1.224.post1',
80     'recommonmark>=0.7.1',
81     'sphinx>=4.2.0',
82     'sphinx_copybutton>=0.4.0',
83     'sphinx_markdown_tables>=0.0.15',
84     'sphinx-argparse>=0.3.1',
85     'sphinxcontrib.katex>=0.8.6',
86     'sphinxext.opengraph>=0.4.2',
87     'sphinxemoji>=0.2.0',
88     'furo>=2022.1.2',
89     'sphinx-copybutton>=0.4.0',
90     'testbook>=0.4.2',
91     'myst-parser==0.16.1',
92     'pylint>=2.12.2',
93     'docformatter>=1.4',
94     'sphinx_panels>=0.6.0',
95 ]
96 
97 extra_deps["deepspeed"] = [
98     'deepspeed>=0.5.5',
99 ]
100 
101 extra_deps["wandb"] = [
102     'wandb>=0.12.2',
103 ]
104 
105 extra_deps["unet"] = [
106     'monai>=0.7.0',
107     'scikit-learn>=1.0.1',
108 ]
109 
110 extra_deps["timm"] = [
111     'timm>=0.5.4',
112 ]
113 
114 extra_deps["nlp"] = [
115     'transformers>=4.11',
116     'datasets>=1.14',
117 ]
118 
119 extra_deps['all'] = set(dep for deps in extra_deps.values() for dep in deps)
120 
121 setup(name="mosaicml",
122       version="0.3.1",
123       author="MosaicML",
124       author_email="team@mosaicml.com",
125       description="composing methods for ML training efficiency",
126       long_description=long_description,
127       long_description_content_type="text/markdown",
128       url="https://github.com/mosaicml/composer",
129       include_package_data=True,
130       package_data={
131           "composer": ['py.typed'],
132           "": package_files('composer/yamls'),
133           "": package_files('composer/algorithms')
134       },
135       packages=setuptools.find_packages(exclude=["tests*"]),
136       classifiers=[
137           "Programming Language :: Python :: 3",
138           "Programming Language :: Python :: 3.7",
139           "Programming Language :: Python :: 3.8",
140           "Programming Language :: Python :: 3.9",
141       ],
142       install_requires=install_requires,
143       entry_points={
144           'console_scripts': ['composer = composer.cli.launcher:main',],
145       },
146       extras_require=extra_deps,
147       dependency_links=['https://developer.download.nvidia.com/compute/redist'],
148       python_requires='>=3.7',
149       ext_package="composer",
150       cmdclass={'develop': develop})
151 
152 # only visible if user installs with verbose -v flag
153 # Printing to stdout as not to interfere with setup.py CLI flags (e.g. --version)
154 print("*" * 20, file=sys.stderr)
155 print(textwrap.dedent("""\
156     NOTE: For best performance, we recommend installing Pillow-SIMD
157     for accelerated image processing operations. To install:
158     \t pip uninstall pillow && pip install pillow-simd"""),
159       file=sys.stderr)
160 print("*" * 20, file=sys.stderr)
161
```
--- 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/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -66,10 +66,10 @@
     "custom_inherit==2.3.2",
     'junitparser>=2.1.1',
     'coverage[toml]>=6.1.1',
-    'fasteners>=0.16.3',  # run_directory_uploader tests require fasteners
+    'fasteners==0.17.3',  # run_directory_uploader tests require fasteners
     'pytest>=7.0.0',
-    'toml>=0.10.2',
-    'yapf>=0.32.0',
+    'toml==0.10.2',
+    'yapf==0.32.0',
     'isort>=5.9.3',
     'ipython>=7.29.0',
     'ipykernel>=6.5.0',
@@ -77,38 +77,38 @@
     'yamllint>=1.26.2',
     'pytest-timeout>=1.4.2',
     'pyright==1.1.224.post1',
-    'recommonmark>=0.7.1',
+    'recommonmark==0.7.1',
     'sphinx>=4.2.0',
-    'sphinx_copybutton>=0.4.0',
-    'sphinx_markdown_tables>=0.0.15',
-    'sphinx-argparse>=0.3.1',
-    'sphinxcontrib.katex>=0.8.6',
-    'sphinxext.opengraph>=0.4.2',
-    'sphinxemoji>=0.2.0',
+    'sphinx_copybutton==0.5.0',
+    'sphinx_markdown_tables==0.0.15',
+    'sphinx-argparse==0.3.1',
+    'sphinxcontrib.katex==0.8.6',
+    'sphinxext.opengraph==0.6.1',
+    'sphinxemoji==0.2.0',
     'furo>=2022.1.2',
-    'sphinx-copybutton>=0.4.0',
-    'testbook>=0.4.2',
+    'sphinx-copybutton==0.5.0',
+    'testbook==0.4.2',
     'myst-parser==0.16.1',
     'pylint>=2.12.2',
     'docformatter>=1.4',
-    'sphinx_panels>=0.6.0',
+    'sphinx_panels==0.6.0',
 ]
 
 extra_deps["deepspeed"] = [
-    'deepspeed>=0.5.5',
+    'deepspeed==0.5.10',
 ]
 
 extra_deps["wandb"] = [
-    'wandb>=0.12.2',
+    'wandb==0.12.10',
 ]
 
 extra_deps["unet"] = [
-    'monai>=0.7.0',
+    'monai==0.8.1',
     'scikit-learn>=1.0.1',
 ]
 
 extra_deps["timm"] = [
-    'timm>=0.5.4',
+    'timm==0.5.4',
 ]
 
 extra_deps["nlp"] = [

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -66,10 +66,10 @@\n     \"custom_inherit==2.3.2\",\n     'junitparser>=2.1.1',\n     'coverage[toml]>=6.1.1',\n-    'fasteners>=0.16.3',  # run_directory_uploader tests require fasteners\n+    'fasteners==0.17.3',  # run_directory_uploader tests require fasteners\n     'pytest>=7.0.0',\n-    'toml>=0.10.2',\n-    'yapf>=0.32.0',\n+    'toml==0.10.2',\n+    'yapf==0.32.0',\n     'isort>=5.9.3',\n     'ipython>=7.29.0',\n     'ipykernel>=6.5.0',\n@@ -77,38 +77,38 @@\n     'yamllint>=1.26.2',\n     'pytest-timeout>=1.4.2',\n     'pyright==1.1.224.post1',\n-    'recommonmark>=0.7.1',\n+    'recommonmark==0.7.1',\n     'sphinx>=4.2.0',\n-    'sphinx_copybutton>=0.4.0',\n-    'sphinx_markdown_tables>=0.0.15',\n-    'sphinx-argparse>=0.3.1',\n-    'sphinxcontrib.katex>=0.8.6',\n-    'sphinxext.opengraph>=0.4.2',\n-    'sphinxemoji>=0.2.0',\n+    'sphinx_copybutton==0.5.0',\n+    'sphinx_markdown_tables==0.0.15',\n+    'sphinx-argparse==0.3.1',\n+    'sphinxcontrib.katex==0.8.6',\n+    'sphinxext.opengraph==0.6.1',\n+    'sphinxemoji==0.2.0',\n     'furo>=2022.1.2',\n-    'sphinx-copybutton>=0.4.0',\n-    'testbook>=0.4.2',\n+    'sphinx-copybutton==0.5.0',\n+    'testbook==0.4.2',\n     'myst-parser==0.16.1',\n     'pylint>=2.12.2',\n     'docformatter>=1.4',\n-    'sphinx_panels>=0.6.0',\n+    'sphinx_panels==0.6.0',\n ]\n \n extra_deps[\"deepspeed\"] = [\n-    'deepspeed>=0.5.5',\n+    'deepspeed==0.5.10',\n ]\n \n extra_deps[\"wandb\"] = [\n-    'wandb>=0.12.2',\n+    'wandb==0.12.10',\n ]\n \n extra_deps[\"unet\"] = [\n-    'monai>=0.7.0',\n+    'monai==0.8.1',\n     'scikit-learn>=1.0.1',\n ]\n \n extra_deps[\"timm\"] = [\n-    'timm>=0.5.4',\n+    'timm==0.5.4',\n ]\n \n extra_deps[\"nlp\"] = [\n", "issue": "Pin the pyright version\nThe environment variable `PYRIGHT_PYTHON_FORCE_VERSION` needs to be set when pyright is installed from pip. Ideally we can set this variable in the setup.py (e.g. `os.environ['PYRIGHT_PYTHON_FORCE_VERSION'] = '...'`); but if not, then it should be in the `.ci/Jenkinsfile`.\n", "before_files": [{"content": "# Copyright 2021 MosaicML. All Rights Reserved.\n\nimport os\nimport site\nimport sys\nimport textwrap\n\nimport setuptools\nfrom setuptools import setup\nfrom setuptools.command.develop import develop as develop_orig\n\n_IS_ROOT = os.getuid() == 0\n_IS_USER = \"--user\" in sys.argv[1:]\n_IS_VIRTUALENV = \"VIRTUAL_ENV\" in os.environ\n\n\n# From https://stackoverflow.com/questions/51292333/how-to-tell-from-setup-py-if-the-module-is-being-installed-in-editable-mode\nclass develop(develop_orig):\n\n    def run(self):\n        if _IS_ROOT and (not _IS_VIRTUALENV) and (not _IS_USER):\n            raise RuntimeError(\n                textwrap.dedent(\"\"\"\\\n                    When installing in editable mode as root outside of a virtual environment,\n                    please specify `--user`. Editable installs as the root user outside of a virtual environment\n                    do not work without the `--user` flag. Please instead run something like: `pip install --user -e .`\"\"\"\n                               ))\n        super().run()\n\n\n# From https://github.com/pypa/pip/issues/7953#issuecomment-645133255\nsite.ENABLE_USER_SITE = _IS_USER\n\n\ndef package_files(directory: str):\n    # from https://stackoverflow.com/a/36693250\n    paths = []\n    for (path, _, filenames) in os.walk(directory):\n        for filename in filenames:\n            paths.append(os.path.join('..', path, filename))\n    return paths\n\n\nwith open(\"README.md\", \"r\", encoding=\"utf-8\") as fh:\n    long_description = fh.read()\n\ninstall_requires = [\n    \"pyyaml>=5.4.1\",\n    \"tqdm>=4.62.3\",\n    \"torchmetrics>=0.6.0\",\n    \"torch_optimizer==0.1.0\",\n    \"torchvision>=0.9.0\",\n    \"torch>=1.9\",\n    \"yahp>=0.0.14\",\n    \"requests>=2.26.0\",\n    \"numpy==1.21.5\",\n    \"apache-libcloud>=3.3.1\",\n    \"psutil>=5.8.0\",\n]\nextra_deps = {}\n\nextra_deps['base'] = []\n\nextra_deps['dev'] = [\n    # Imports for docs builds and running tests\n    \"custom_inherit==2.3.2\",\n    'junitparser>=2.1.1',\n    'coverage[toml]>=6.1.1',\n    'fasteners>=0.16.3',  # run_directory_uploader tests require fasteners\n    'pytest>=7.0.0',\n    'toml>=0.10.2',\n    'yapf>=0.32.0',\n    'isort>=5.9.3',\n    'ipython>=7.29.0',\n    'ipykernel>=6.5.0',\n    'jupyter>=1.0.0',\n    'yamllint>=1.26.2',\n    'pytest-timeout>=1.4.2',\n    'pyright==1.1.224.post1',\n    'recommonmark>=0.7.1',\n    'sphinx>=4.2.0',\n    'sphinx_copybutton>=0.4.0',\n    'sphinx_markdown_tables>=0.0.15',\n    'sphinx-argparse>=0.3.1',\n    'sphinxcontrib.katex>=0.8.6',\n    'sphinxext.opengraph>=0.4.2',\n    'sphinxemoji>=0.2.0',\n    'furo>=2022.1.2',\n    'sphinx-copybutton>=0.4.0',\n    'testbook>=0.4.2',\n    'myst-parser==0.16.1',\n    'pylint>=2.12.2',\n    'docformatter>=1.4',\n    'sphinx_panels>=0.6.0',\n]\n\nextra_deps[\"deepspeed\"] = [\n    'deepspeed>=0.5.5',\n]\n\nextra_deps[\"wandb\"] = [\n    'wandb>=0.12.2',\n]\n\nextra_deps[\"unet\"] = [\n    'monai>=0.7.0',\n    'scikit-learn>=1.0.1',\n]\n\nextra_deps[\"timm\"] = [\n    'timm>=0.5.4',\n]\n\nextra_deps[\"nlp\"] = [\n    'transformers>=4.11',\n    'datasets>=1.14',\n]\n\nextra_deps['all'] = set(dep for deps in extra_deps.values() for dep in deps)\n\nsetup(name=\"mosaicml\",\n      version=\"0.3.1\",\n      author=\"MosaicML\",\n      author_email=\"team@mosaicml.com\",\n      description=\"composing methods for ML training efficiency\",\n      long_description=long_description,\n      long_description_content_type=\"text/markdown\",\n      url=\"https://github.com/mosaicml/composer\",\n      include_package_data=True,\n      package_data={\n          \"composer\": ['py.typed'],\n          \"\": package_files('composer/yamls'),\n          \"\": package_files('composer/algorithms')\n      },\n      packages=setuptools.find_packages(exclude=[\"tests*\"]),\n      classifiers=[\n          \"Programming Language :: Python :: 3\",\n          \"Programming Language :: Python :: 3.7\",\n          \"Programming Language :: Python :: 3.8\",\n          \"Programming Language :: Python :: 3.9\",\n      ],\n      install_requires=install_requires,\n      entry_points={\n          'console_scripts': ['composer = composer.cli.launcher:main',],\n      },\n      extras_require=extra_deps,\n      dependency_links=['https://developer.download.nvidia.com/compute/redist'],\n      python_requires='>=3.7',\n      ext_package=\"composer\",\n      cmdclass={'develop': develop})\n\n# only visible if user installs with verbose -v flag\n# Printing to stdout as not to interfere with setup.py CLI flags (e.g. --version)\nprint(\"*\" * 20, file=sys.stderr)\nprint(textwrap.dedent(\"\"\"\\\n    NOTE: For best performance, we recommend installing Pillow-SIMD\n    for accelerated image processing operations. To install:\n    \\t pip uninstall pillow && pip install pillow-simd\"\"\"),\n      file=sys.stderr)\nprint(\"*\" * 20, file=sys.stderr)\n", "path": "setup.py"}], "after_files": [{"content": "# Copyright 2021 MosaicML. All Rights Reserved.\n\nimport os\nimport site\nimport sys\nimport textwrap\n\nimport setuptools\nfrom setuptools import setup\nfrom setuptools.command.develop import develop as develop_orig\n\n_IS_ROOT = os.getuid() == 0\n_IS_USER = \"--user\" in sys.argv[1:]\n_IS_VIRTUALENV = \"VIRTUAL_ENV\" in os.environ\n\n\n# From https://stackoverflow.com/questions/51292333/how-to-tell-from-setup-py-if-the-module-is-being-installed-in-editable-mode\nclass develop(develop_orig):\n\n    def run(self):\n        if _IS_ROOT and (not _IS_VIRTUALENV) and (not _IS_USER):\n            raise RuntimeError(\n                textwrap.dedent(\"\"\"\\\n                    When installing in editable mode as root outside of a virtual environment,\n                    please specify `--user`. Editable installs as the root user outside of a virtual environment\n                    do not work without the `--user` flag. Please instead run something like: `pip install --user -e .`\"\"\"\n                               ))\n        super().run()\n\n\n# From https://github.com/pypa/pip/issues/7953#issuecomment-645133255\nsite.ENABLE_USER_SITE = _IS_USER\n\n\ndef package_files(directory: str):\n    # from https://stackoverflow.com/a/36693250\n    paths = []\n    for (path, _, filenames) in os.walk(directory):\n        for filename in filenames:\n            paths.append(os.path.join('..', path, filename))\n    return paths\n\n\nwith open(\"README.md\", \"r\", encoding=\"utf-8\") as fh:\n    long_description = fh.read()\n\ninstall_requires = [\n    \"pyyaml>=5.4.1\",\n    \"tqdm>=4.62.3\",\n    \"torchmetrics>=0.6.0\",\n    \"torch_optimizer==0.1.0\",\n    \"torchvision>=0.9.0\",\n    \"torch>=1.9\",\n    \"yahp>=0.0.14\",\n    \"requests>=2.26.0\",\n    \"numpy==1.21.5\",\n    \"apache-libcloud>=3.3.1\",\n    \"psutil>=5.8.0\",\n]\nextra_deps = {}\n\nextra_deps['base'] = []\n\nextra_deps['dev'] = [\n    # Imports for docs builds and running tests\n    \"custom_inherit==2.3.2\",\n    'junitparser>=2.1.1',\n    'coverage[toml]>=6.1.1',\n    'fasteners==0.17.3',  # run_directory_uploader tests require fasteners\n    'pytest>=7.0.0',\n    'toml==0.10.2',\n    'yapf==0.32.0',\n    'isort>=5.9.3',\n    'ipython>=7.29.0',\n    'ipykernel>=6.5.0',\n    'jupyter>=1.0.0',\n    'yamllint>=1.26.2',\n    'pytest-timeout>=1.4.2',\n    'pyright==1.1.224.post1',\n    'recommonmark==0.7.1',\n    'sphinx>=4.2.0',\n    'sphinx_copybutton==0.5.0',\n    'sphinx_markdown_tables==0.0.15',\n    'sphinx-argparse==0.3.1',\n    'sphinxcontrib.katex==0.8.6',\n    'sphinxext.opengraph==0.6.1',\n    'sphinxemoji==0.2.0',\n    'furo>=2022.1.2',\n    'sphinx-copybutton==0.5.0',\n    'testbook==0.4.2',\n    'myst-parser==0.16.1',\n    'pylint>=2.12.2',\n    'docformatter>=1.4',\n    'sphinx_panels==0.6.0',\n]\n\nextra_deps[\"deepspeed\"] = [\n    'deepspeed==0.5.10',\n]\n\nextra_deps[\"wandb\"] = [\n    'wandb==0.12.10',\n]\n\nextra_deps[\"unet\"] = [\n    'monai==0.8.1',\n    'scikit-learn>=1.0.1',\n]\n\nextra_deps[\"timm\"] = [\n    'timm==0.5.4',\n]\n\nextra_deps[\"nlp\"] = [\n    'transformers>=4.11',\n    'datasets>=1.14',\n]\n\nextra_deps['all'] = set(dep for deps in extra_deps.values() for dep in deps)\n\nsetup(name=\"mosaicml\",\n      version=\"0.3.1\",\n      author=\"MosaicML\",\n      author_email=\"team@mosaicml.com\",\n      description=\"composing methods for ML training efficiency\",\n      long_description=long_description,\n      long_description_content_type=\"text/markdown\",\n      url=\"https://github.com/mosaicml/composer\",\n      include_package_data=True,\n      package_data={\n          \"composer\": ['py.typed'],\n          \"\": package_files('composer/yamls'),\n          \"\": package_files('composer/algorithms')\n      },\n      packages=setuptools.find_packages(exclude=[\"tests*\"]),\n      classifiers=[\n          \"Programming Language :: Python :: 3\",\n          \"Programming Language :: Python :: 3.7\",\n          \"Programming Language :: Python :: 3.8\",\n          \"Programming Language :: Python :: 3.9\",\n      ],\n      install_requires=install_requires,\n      entry_points={\n          'console_scripts': ['composer = composer.cli.launcher:main',],\n      },\n      extras_require=extra_deps,\n      dependency_links=['https://developer.download.nvidia.com/compute/redist'],\n      python_requires='>=3.7',\n      ext_package=\"composer\",\n      cmdclass={'develop': develop})\n\n# only visible if user installs with verbose -v flag\n# Printing to stdout as not to interfere with setup.py CLI flags (e.g. --version)\nprint(\"*\" * 20, file=sys.stderr)\nprint(textwrap.dedent(\"\"\"\\\n    NOTE: For best performance, we recommend installing Pillow-SIMD\n    for accelerated image processing operations. To install:\n    \\t pip uninstall pillow && pip install pillow-simd\"\"\"),\n      file=sys.stderr)\nprint(\"*\" * 20, file=sys.stderr)\n", "path": "setup.py"}]}