We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Less strict numpy version pinning
## 🚀 Feature Request
Allow for newer numpy versions than `<1.23.0`.

## Motivation

Currently, composer fixes numpy to be `'numpy>=1.21.5,<1.23.0'`. This is unfortunate, because other requirements that we use need numpy > 1.23.0, creating an incompatibility.

This was set in #1345 in reaction to a build failure because scipy need(ed) `<1.23.0`. Scipy itself is apparently pulled from `torch-metrics`. 

I don't believe this is current anymore:
- composer pulls in `torchmetrics>=0.10.0,<0.11.4`
- torchmetrics 0.11.3 pulls in `scipy >1.0.0, <=1.10.0` [(requirements)](https://github.com/Lightning-AI/metrics/blob/v0.11.3/requirements/image.txt#LL4C23-L4C23)
- scipy 1.10.0 sets `np_maxversion = '1.27.0'` [(setup.py)](https://github.com/scipy/scipy/blob/v1.10.0/setup.py#L453)

Indeed, scipy has https://github.com/scipy/scipy/issues/16964, which was fixed in https://github.com/scipy/scipy/pull/16966 in September of 2022, while #1345 above was noted in August.

Accordingly, it looks like relaxing the numpy maxversion should have a valid requirements path. 

The closed PR https://github.com/mosaicml/composer/pull/1835 would already implement this.

--- 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 2022 MosaicML Composer authors
2 # SPDX-License-Identifier: Apache-2.0
3 
4 """Composer package setup."""
5 
6 import os
7 import site
8 import sys
9 import textwrap
10 
11 import setuptools
12 from setuptools import setup
13 from setuptools.command.develop import develop as develop_orig
14 
15 # Read the composer version
16 # Cannot import from `composer.__version__` since that will not be available when building or installing the package
17 with open(os.path.join(os.path.dirname(__file__), 'composer', '_version.py')) as f:
18     version_globals = {}
19     version_locals = {}
20     exec(f.read(), version_globals, version_locals)
21     composer_version = version_locals['__version__']
22 
23 _IS_ROOT = os.getuid() == 0
24 _IS_USER = '--user' in sys.argv[1:]
25 _IS_VIRTUALENV = 'VIRTUAL_ENV' in os.environ
26 
27 
28 # From https://stackoverflow.com/questions/51292333/how-to-tell-from-setup-py-if-the-module-is-being-installed-in-editable-mode
29 class develop(develop_orig):
30     """Override the ``develop`` class to error if attempting an editable install as root."""
31 
32     def run(self):
33         if _IS_ROOT and (not _IS_VIRTUALENV) and (not _IS_USER):
34             raise RuntimeError(
35                 textwrap.dedent("""\
36                     When installing in editable mode as root outside of a virtual environment,
37                     please specify `--user`. Editable installs as the root user outside of a virtual environment
38                     do not work without the `--user` flag. Please instead run something like: `pip install --user -e .`"""
39                                ))
40         super().run()
41 
42 
43 # From https://github.com/pypa/pip/issues/7953#issuecomment-645133255
44 site.ENABLE_USER_SITE = _IS_USER
45 
46 
47 def package_files(prefix: str, directory: str, extension: str):
48     """Get all the files to package."""
49     # from https://stackoverflow.com/a/36693250
50     paths = []
51     for (path, _, filenames) in os.walk(os.path.join(prefix, directory)):
52         for filename in filenames:
53             if filename.endswith(extension):
54                 paths.append(os.path.relpath(os.path.join(path, filename), prefix))
55     return paths
56 
57 
58 with open('README.md', 'r', encoding='utf-8') as fh:
59     long_description = fh.read()
60 
61 # Hide the content between <!-- SETUPTOOLS_LONG_DESCRIPTION_HIDE_BEGIN --> and
62 # <!-- SETUPTOOLS_LONG_DESCRIPTION_HIDE_END --> tags in the README
63 while True:
64     start_tag = '<!-- SETUPTOOLS_LONG_DESCRIPTION_HIDE_BEGIN -->'
65     end_tag = '<!-- SETUPTOOLS_LONG_DESCRIPTION_HIDE_END -->'
66     start = long_description.find(start_tag)
67     end = long_description.find(end_tag)
68     if start == -1:
69         assert end == -1, 'there should be a balanced number of start and ends'
70         break
71     else:
72         assert end != -1, 'there should be a balanced number of start and ends'
73         long_description = long_description[:start] + long_description[end + len(end_tag):]
74 
75 install_requires = [
76     'pyyaml>=6.0,<7',
77     'tqdm>=4.62.3,<5',
78     'torchmetrics>=0.10.0,<0.11.4',
79     'torch_optimizer>=0.3.0,<0.4',
80     'torchvision>=0.11.0,<0.15',
81     'torch>=1.10.0,<1.14',
82     'requests>=2.26.0,<3',
83     'numpy>=1.21.5,<1.23.0',
84     'psutil>=5.8.0,<6',
85     'coolname>=1.1.0,<3',
86     'tabulate==0.9.0',  # for auto-generating tables
87     'py-cpuinfo>=8.0.0,<10',
88     'packaging>=21.3.0,<23',
89     'importlib-metadata>=5.0.0,<7',
90 ]
91 extra_deps = {}
92 
93 extra_deps['base'] = []
94 
95 extra_deps['dev'] = [
96     # Imports for docs builds and running tests
97     # Pinning versions strictly to avoid random test failures.
98     # Should manually update dependency versions occassionally.
99     'custom_inherit==2.4.1',
100     'junitparser==2.8.0',
101     'coverage[toml]==7.2.2',
102     'fasteners==0.18',  # object store tests require fasteners
103     'pytest==7.2.2',
104     'toml==0.10.2',
105     'ipython==8.11.0',
106     'ipykernel==6.20.1',
107     'jupyter==1.0.0',
108     'yamllint==1.30.0',
109     'recommonmark==0.7.1',
110     'sphinx==4.4.0',
111     'pre-commit>=2.18.1,<3',
112     # embedding md in rst require docutils>=0.17. See
113     # https://myst-parser.readthedocs.io/en/latest/sphinx/use.html?highlight=parser#include-markdown-files-into-an-rst-file
114     'docutils==0.17.1',
115     'sphinx_markdown_tables==0.0.17',
116     'sphinx-argparse==0.4.0',
117     'sphinxcontrib.katex==0.9.4',
118     'sphinxext.opengraph==0.7.4',
119     'sphinxemoji==0.2.0',
120     'furo==2022.9.29',
121     'sphinx-copybutton==0.5.0',
122     'testbook==0.4.2',
123     'myst-parser==0.16.1',
124     'sphinx_panels==0.6.0',
125     'sphinxcontrib-images==0.9.4',
126     'pytest_codeblocks==0.16.1',
127     'traitlets==5.9.0',
128     'nbsphinx==0.8.12',
129     'pandoc==2.3',
130     'pypandoc==1.11',
131     'GitPython==3.1.31',
132     'moto[s3]>=4.0.1,<5',
133     'mock-ssh-server==0.9.1',
134     'cryptography==38.0.4',
135     'pytest-httpserver>=1.0.4,<1.1',
136     'setuptools<=59.5.0',
137 ]
138 
139 extra_deps['health_checker'] = {
140     'pynvml>=11.5.0,<12',
141     'slack_sdk>=3.19.5,<4',
142 }
143 
144 extra_deps['deepspeed'] = [
145     'deepspeed==0.7.7',
146 ]
147 
148 extra_deps['wandb'] = [
149     'wandb>=0.13.2,<0.14',
150 ]
151 
152 extra_deps['comet_ml'] = [
153     'comet_ml>=3.31.12,<4.0.0',
154 ]
155 
156 extra_deps['tensorboard'] = [
157     'tensorboard>=2.9.1,<3.0.0',
158 ]
159 
160 extra_deps['unet'] = [
161     'monai>=0.9.1,<1.2',
162     'scikit-learn>=1.0.1,<2',
163 ]
164 
165 extra_deps['vit'] = [
166     'vit_pytorch==0.35.8',
167 ]
168 
169 extra_deps['timm'] = [
170     'timm>=0.5.4,<0.6',
171 ]
172 
173 extra_deps['coco'] = [
174     'pycocotools>=2.0.4,<3',
175 ]
176 
177 extra_deps['nlp'] = [
178     'transformers>=4.11,<4.27.5',
179     'datasets>=2.4,<3',
180 ]
181 
182 extra_deps['sentencepiece'] = ['sentencepiece==0.1.97']
183 
184 extra_deps['mlperf'] = [
185     # TODO: use pip when available: https://github.com/mlcommons/logging/issues/218
186     # "mlperf_logging @ git+https://github.com/mlperf/logging.git",
187     'py-cpuinfo>=8.0.0,<10',
188 ]
189 
190 extra_deps['streaming'] = [
191     'mosaicml-streaming<0.4',
192     'boto3>=1.21.45,<2',
193     'paramiko>=2.11.0,<3',
194 ]
195 
196 extra_deps['libcloud'] = [
197     'apache-libcloud>=3.3.1,<4',
198 ]
199 
200 extra_deps['oci'] = [
201     'oci>=2.88.2,<3.0.0',
202 ]
203 
204 extra_deps['onnx'] = [
205     'onnx>=1.12.0,<2',
206     'onnxruntime>=1.12.1,<2',
207 ]
208 
209 extra_deps['mlflow'] = ['mlflow>=2.0.1,<3.0']
210 
211 extra_deps['all'] = set(dep for deps in extra_deps.values() for dep in deps)
212 
213 composer_data_files = ['py.typed']
214 composer_data_files += package_files('composer', 'yamls', '.yaml')
215 composer_data_files += package_files('composer', 'algorithms', '.json')
216 
217 package_name = os.environ.get('COMPOSER_PACKAGE_NAME', 'mosaicml')
218 
219 if package_name != 'mosaicml':
220     print(f'`Building composer as `{package_name}`)', file=sys.stderr)
221 
222 setup(name=package_name,
223       version=composer_version,
224       author='MosaicML',
225       author_email='team@mosaicml.com',
226       description=('Composer is a PyTorch library that enables you to train ' +
227                    'neural networks faster, at lower cost, and to higher accuracy.'),
228       long_description=long_description,
229       long_description_content_type='text/markdown',
230       url='https://github.com/mosaicml/composer',
231       include_package_data=True,
232       package_data={
233           'composer': composer_data_files,
234       },
235       packages=setuptools.find_packages(exclude=['docker*', 'examples*', 'scripts*', 'tests*']),
236       classifiers=[
237           'Programming Language :: Python :: 3',
238           'Programming Language :: Python :: 3.8',
239           'Programming Language :: Python :: 3.9',
240           'Programming Language :: Python :: 3.10',
241       ],
242       install_requires=install_requires,
243       entry_points={
244           'console_scripts': [
245               'composer = composer.cli.launcher:main',
246               'composer_collect_env = composer.utils.collect_env:main',
247           ],
248       },
249       extras_require=extra_deps,
250       dependency_links=['https://developer.download.nvidia.com/compute/redist'],
251       python_requires='>=3.8',
252       ext_package='composer',
253       cmdclass={'develop': develop})
254 
255 # only visible if user installs with verbose -v flag
256 # Printing to stdout as not to interfere with setup.py CLI flags (e.g. --version)
257 print('*' * 20, file=sys.stderr)
258 print(textwrap.dedent("""\
259     NOTE: For best performance, we recommend installing Pillow-SIMD
260     for accelerated image processing operations. To install:
261     \t pip uninstall pillow && pip install pillow-simd"""),
262       file=sys.stderr)
263 print('*' * 20, file=sys.stderr)
264
```
--- 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
@@ -80,7 +80,7 @@
     'torchvision>=0.11.0,<0.15',
     'torch>=1.10.0,<1.14',
     'requests>=2.26.0,<3',
-    'numpy>=1.21.5,<1.23.0',
+    'numpy>=1.21.5,<1.25.0',
     'psutil>=5.8.0,<6',
     'coolname>=1.1.0,<3',
     'tabulate==0.9.0',  # for auto-generating tables

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -80,7 +80,7 @@\n     'torchvision>=0.11.0,<0.15',\n     'torch>=1.10.0,<1.14',\n     'requests>=2.26.0,<3',\n-    'numpy>=1.21.5,<1.23.0',\n+    'numpy>=1.21.5,<1.25.0',\n     'psutil>=5.8.0,<6',\n     'coolname>=1.1.0,<3',\n     'tabulate==0.9.0',  # for auto-generating tables\n", "issue": "Less strict numpy version pinning\n## \ud83d\ude80 Feature Request\r\nAllow for newer numpy versions than `<1.23.0`.\r\n\r\n## Motivation\r\n\r\nCurrently, composer fixes numpy to be `'numpy>=1.21.5,<1.23.0'`. This is unfortunate, because other requirements that we use need numpy > 1.23.0, creating an incompatibility.\r\n\r\nThis was set in #1345 in reaction to a build failure because scipy need(ed) `<1.23.0`. Scipy itself is apparently pulled from `torch-metrics`. \r\n\r\nI don't believe this is current anymore:\r\n- composer pulls in `torchmetrics>=0.10.0,<0.11.4`\r\n- torchmetrics 0.11.3 pulls in `scipy >1.0.0, <=1.10.0` [(requirements)](https://github.com/Lightning-AI/metrics/blob/v0.11.3/requirements/image.txt#LL4C23-L4C23)\r\n- scipy 1.10.0 sets `np_maxversion = '1.27.0'` [(setup.py)](https://github.com/scipy/scipy/blob/v1.10.0/setup.py#L453)\r\n\r\nIndeed, scipy has https://github.com/scipy/scipy/issues/16964, which was fixed in https://github.com/scipy/scipy/pull/16966 in September of 2022, while #1345 above was noted in August.\r\n\r\nAccordingly, it looks like relaxing the numpy maxversion should have a valid requirements path. \r\n\r\nThe closed PR https://github.com/mosaicml/composer/pull/1835 would already implement this.\n", "before_files": [{"content": "# Copyright 2022 MosaicML Composer authors\n# SPDX-License-Identifier: Apache-2.0\n\n\"\"\"Composer package setup.\"\"\"\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# Read the composer version\n# Cannot import from `composer.__version__` since that will not be available when building or installing the package\nwith open(os.path.join(os.path.dirname(__file__), 'composer', '_version.py')) as f:\n    version_globals = {}\n    version_locals = {}\n    exec(f.read(), version_globals, version_locals)\n    composer_version = version_locals['__version__']\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    \"\"\"Override the ``develop`` class to error if attempting an editable install as root.\"\"\"\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(prefix: str, directory: str, extension: str):\n    \"\"\"Get all the files to package.\"\"\"\n    # from https://stackoverflow.com/a/36693250\n    paths = []\n    for (path, _, filenames) in os.walk(os.path.join(prefix, directory)):\n        for filename in filenames:\n            if filename.endswith(extension):\n                paths.append(os.path.relpath(os.path.join(path, filename), prefix))\n    return paths\n\n\nwith open('README.md', 'r', encoding='utf-8') as fh:\n    long_description = fh.read()\n\n# Hide the content between <!-- SETUPTOOLS_LONG_DESCRIPTION_HIDE_BEGIN --> and\n# <!-- SETUPTOOLS_LONG_DESCRIPTION_HIDE_END --> tags in the README\nwhile True:\n    start_tag = '<!-- SETUPTOOLS_LONG_DESCRIPTION_HIDE_BEGIN -->'\n    end_tag = '<!-- SETUPTOOLS_LONG_DESCRIPTION_HIDE_END -->'\n    start = long_description.find(start_tag)\n    end = long_description.find(end_tag)\n    if start == -1:\n        assert end == -1, 'there should be a balanced number of start and ends'\n        break\n    else:\n        assert end != -1, 'there should be a balanced number of start and ends'\n        long_description = long_description[:start] + long_description[end + len(end_tag):]\n\ninstall_requires = [\n    'pyyaml>=6.0,<7',\n    'tqdm>=4.62.3,<5',\n    'torchmetrics>=0.10.0,<0.11.4',\n    'torch_optimizer>=0.3.0,<0.4',\n    'torchvision>=0.11.0,<0.15',\n    'torch>=1.10.0,<1.14',\n    'requests>=2.26.0,<3',\n    'numpy>=1.21.5,<1.23.0',\n    'psutil>=5.8.0,<6',\n    'coolname>=1.1.0,<3',\n    'tabulate==0.9.0',  # for auto-generating tables\n    'py-cpuinfo>=8.0.0,<10',\n    'packaging>=21.3.0,<23',\n    'importlib-metadata>=5.0.0,<7',\n]\nextra_deps = {}\n\nextra_deps['base'] = []\n\nextra_deps['dev'] = [\n    # Imports for docs builds and running tests\n    # Pinning versions strictly to avoid random test failures.\n    # Should manually update dependency versions occassionally.\n    'custom_inherit==2.4.1',\n    'junitparser==2.8.0',\n    'coverage[toml]==7.2.2',\n    'fasteners==0.18',  # object store tests require fasteners\n    'pytest==7.2.2',\n    'toml==0.10.2',\n    'ipython==8.11.0',\n    'ipykernel==6.20.1',\n    'jupyter==1.0.0',\n    'yamllint==1.30.0',\n    'recommonmark==0.7.1',\n    'sphinx==4.4.0',\n    'pre-commit>=2.18.1,<3',\n    # embedding md in rst require docutils>=0.17. See\n    # https://myst-parser.readthedocs.io/en/latest/sphinx/use.html?highlight=parser#include-markdown-files-into-an-rst-file\n    'docutils==0.17.1',\n    'sphinx_markdown_tables==0.0.17',\n    'sphinx-argparse==0.4.0',\n    'sphinxcontrib.katex==0.9.4',\n    'sphinxext.opengraph==0.7.4',\n    'sphinxemoji==0.2.0',\n    'furo==2022.9.29',\n    'sphinx-copybutton==0.5.0',\n    'testbook==0.4.2',\n    'myst-parser==0.16.1',\n    'sphinx_panels==0.6.0',\n    'sphinxcontrib-images==0.9.4',\n    'pytest_codeblocks==0.16.1',\n    'traitlets==5.9.0',\n    'nbsphinx==0.8.12',\n    'pandoc==2.3',\n    'pypandoc==1.11',\n    'GitPython==3.1.31',\n    'moto[s3]>=4.0.1,<5',\n    'mock-ssh-server==0.9.1',\n    'cryptography==38.0.4',\n    'pytest-httpserver>=1.0.4,<1.1',\n    'setuptools<=59.5.0',\n]\n\nextra_deps['health_checker'] = {\n    'pynvml>=11.5.0,<12',\n    'slack_sdk>=3.19.5,<4',\n}\n\nextra_deps['deepspeed'] = [\n    'deepspeed==0.7.7',\n]\n\nextra_deps['wandb'] = [\n    'wandb>=0.13.2,<0.14',\n]\n\nextra_deps['comet_ml'] = [\n    'comet_ml>=3.31.12,<4.0.0',\n]\n\nextra_deps['tensorboard'] = [\n    'tensorboard>=2.9.1,<3.0.0',\n]\n\nextra_deps['unet'] = [\n    'monai>=0.9.1,<1.2',\n    'scikit-learn>=1.0.1,<2',\n]\n\nextra_deps['vit'] = [\n    'vit_pytorch==0.35.8',\n]\n\nextra_deps['timm'] = [\n    'timm>=0.5.4,<0.6',\n]\n\nextra_deps['coco'] = [\n    'pycocotools>=2.0.4,<3',\n]\n\nextra_deps['nlp'] = [\n    'transformers>=4.11,<4.27.5',\n    'datasets>=2.4,<3',\n]\n\nextra_deps['sentencepiece'] = ['sentencepiece==0.1.97']\n\nextra_deps['mlperf'] = [\n    # TODO: use pip when available: https://github.com/mlcommons/logging/issues/218\n    # \"mlperf_logging @ git+https://github.com/mlperf/logging.git\",\n    'py-cpuinfo>=8.0.0,<10',\n]\n\nextra_deps['streaming'] = [\n    'mosaicml-streaming<0.4',\n    'boto3>=1.21.45,<2',\n    'paramiko>=2.11.0,<3',\n]\n\nextra_deps['libcloud'] = [\n    'apache-libcloud>=3.3.1,<4',\n]\n\nextra_deps['oci'] = [\n    'oci>=2.88.2,<3.0.0',\n]\n\nextra_deps['onnx'] = [\n    'onnx>=1.12.0,<2',\n    'onnxruntime>=1.12.1,<2',\n]\n\nextra_deps['mlflow'] = ['mlflow>=2.0.1,<3.0']\n\nextra_deps['all'] = set(dep for deps in extra_deps.values() for dep in deps)\n\ncomposer_data_files = ['py.typed']\ncomposer_data_files += package_files('composer', 'yamls', '.yaml')\ncomposer_data_files += package_files('composer', 'algorithms', '.json')\n\npackage_name = os.environ.get('COMPOSER_PACKAGE_NAME', 'mosaicml')\n\nif package_name != 'mosaicml':\n    print(f'`Building composer as `{package_name}`)', file=sys.stderr)\n\nsetup(name=package_name,\n      version=composer_version,\n      author='MosaicML',\n      author_email='team@mosaicml.com',\n      description=('Composer is a PyTorch library that enables you to train ' +\n                   'neural networks faster, at lower cost, and to higher accuracy.'),\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': composer_data_files,\n      },\n      packages=setuptools.find_packages(exclude=['docker*', 'examples*', 'scripts*', 'tests*']),\n      classifiers=[\n          'Programming Language :: Python :: 3',\n          'Programming Language :: Python :: 3.8',\n          'Programming Language :: Python :: 3.9',\n          'Programming Language :: Python :: 3.10',\n      ],\n      install_requires=install_requires,\n      entry_points={\n          'console_scripts': [\n              'composer = composer.cli.launcher:main',\n              'composer_collect_env = composer.utils.collect_env:main',\n          ],\n      },\n      extras_require=extra_deps,\n      dependency_links=['https://developer.download.nvidia.com/compute/redist'],\n      python_requires='>=3.8',\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 2022 MosaicML Composer authors\n# SPDX-License-Identifier: Apache-2.0\n\n\"\"\"Composer package setup.\"\"\"\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# Read the composer version\n# Cannot import from `composer.__version__` since that will not be available when building or installing the package\nwith open(os.path.join(os.path.dirname(__file__), 'composer', '_version.py')) as f:\n    version_globals = {}\n    version_locals = {}\n    exec(f.read(), version_globals, version_locals)\n    composer_version = version_locals['__version__']\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    \"\"\"Override the ``develop`` class to error if attempting an editable install as root.\"\"\"\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(prefix: str, directory: str, extension: str):\n    \"\"\"Get all the files to package.\"\"\"\n    # from https://stackoverflow.com/a/36693250\n    paths = []\n    for (path, _, filenames) in os.walk(os.path.join(prefix, directory)):\n        for filename in filenames:\n            if filename.endswith(extension):\n                paths.append(os.path.relpath(os.path.join(path, filename), prefix))\n    return paths\n\n\nwith open('README.md', 'r', encoding='utf-8') as fh:\n    long_description = fh.read()\n\n# Hide the content between <!-- SETUPTOOLS_LONG_DESCRIPTION_HIDE_BEGIN --> and\n# <!-- SETUPTOOLS_LONG_DESCRIPTION_HIDE_END --> tags in the README\nwhile True:\n    start_tag = '<!-- SETUPTOOLS_LONG_DESCRIPTION_HIDE_BEGIN -->'\n    end_tag = '<!-- SETUPTOOLS_LONG_DESCRIPTION_HIDE_END -->'\n    start = long_description.find(start_tag)\n    end = long_description.find(end_tag)\n    if start == -1:\n        assert end == -1, 'there should be a balanced number of start and ends'\n        break\n    else:\n        assert end != -1, 'there should be a balanced number of start and ends'\n        long_description = long_description[:start] + long_description[end + len(end_tag):]\n\ninstall_requires = [\n    'pyyaml>=6.0,<7',\n    'tqdm>=4.62.3,<5',\n    'torchmetrics>=0.10.0,<0.11.4',\n    'torch_optimizer>=0.3.0,<0.4',\n    'torchvision>=0.11.0,<0.15',\n    'torch>=1.10.0,<1.14',\n    'requests>=2.26.0,<3',\n    'numpy>=1.21.5,<1.25.0',\n    'psutil>=5.8.0,<6',\n    'coolname>=1.1.0,<3',\n    'tabulate==0.9.0',  # for auto-generating tables\n    'py-cpuinfo>=8.0.0,<10',\n    'packaging>=21.3.0,<23',\n    'importlib-metadata>=5.0.0,<7',\n]\nextra_deps = {}\n\nextra_deps['base'] = []\n\nextra_deps['dev'] = [\n    # Imports for docs builds and running tests\n    # Pinning versions strictly to avoid random test failures.\n    # Should manually update dependency versions occassionally.\n    'custom_inherit==2.4.1',\n    'junitparser==2.8.0',\n    'coverage[toml]==7.2.2',\n    'fasteners==0.18',  # object store tests require fasteners\n    'pytest==7.2.2',\n    'toml==0.10.2',\n    'ipython==8.11.0',\n    'ipykernel==6.20.1',\n    'jupyter==1.0.0',\n    'yamllint==1.30.0',\n    'recommonmark==0.7.1',\n    'sphinx==4.4.0',\n    'pre-commit>=2.18.1,<3',\n    # embedding md in rst require docutils>=0.17. See\n    # https://myst-parser.readthedocs.io/en/latest/sphinx/use.html?highlight=parser#include-markdown-files-into-an-rst-file\n    'docutils==0.17.1',\n    'sphinx_markdown_tables==0.0.17',\n    'sphinx-argparse==0.4.0',\n    'sphinxcontrib.katex==0.9.4',\n    'sphinxext.opengraph==0.7.4',\n    'sphinxemoji==0.2.0',\n    'furo==2022.9.29',\n    'sphinx-copybutton==0.5.0',\n    'testbook==0.4.2',\n    'myst-parser==0.16.1',\n    'sphinx_panels==0.6.0',\n    'sphinxcontrib-images==0.9.4',\n    'pytest_codeblocks==0.16.1',\n    'traitlets==5.9.0',\n    'nbsphinx==0.8.12',\n    'pandoc==2.3',\n    'pypandoc==1.11',\n    'GitPython==3.1.31',\n    'moto[s3]>=4.0.1,<5',\n    'mock-ssh-server==0.9.1',\n    'cryptography==38.0.4',\n    'pytest-httpserver>=1.0.4,<1.1',\n    'setuptools<=59.5.0',\n]\n\nextra_deps['health_checker'] = {\n    'pynvml>=11.5.0,<12',\n    'slack_sdk>=3.19.5,<4',\n}\n\nextra_deps['deepspeed'] = [\n    'deepspeed==0.7.7',\n]\n\nextra_deps['wandb'] = [\n    'wandb>=0.13.2,<0.14',\n]\n\nextra_deps['comet_ml'] = [\n    'comet_ml>=3.31.12,<4.0.0',\n]\n\nextra_deps['tensorboard'] = [\n    'tensorboard>=2.9.1,<3.0.0',\n]\n\nextra_deps['unet'] = [\n    'monai>=0.9.1,<1.2',\n    'scikit-learn>=1.0.1,<2',\n]\n\nextra_deps['vit'] = [\n    'vit_pytorch==0.35.8',\n]\n\nextra_deps['timm'] = [\n    'timm>=0.5.4,<0.6',\n]\n\nextra_deps['coco'] = [\n    'pycocotools>=2.0.4,<3',\n]\n\nextra_deps['nlp'] = [\n    'transformers>=4.11,<4.27.5',\n    'datasets>=2.4,<3',\n]\n\nextra_deps['sentencepiece'] = ['sentencepiece==0.1.97']\n\nextra_deps['mlperf'] = [\n    # TODO: use pip when available: https://github.com/mlcommons/logging/issues/218\n    # \"mlperf_logging @ git+https://github.com/mlperf/logging.git\",\n    'py-cpuinfo>=8.0.0,<10',\n]\n\nextra_deps['streaming'] = [\n    'mosaicml-streaming<0.4',\n    'boto3>=1.21.45,<2',\n    'paramiko>=2.11.0,<3',\n]\n\nextra_deps['libcloud'] = [\n    'apache-libcloud>=3.3.1,<4',\n]\n\nextra_deps['oci'] = [\n    'oci>=2.88.2,<3.0.0',\n]\n\nextra_deps['onnx'] = [\n    'onnx>=1.12.0,<2',\n    'onnxruntime>=1.12.1,<2',\n]\n\nextra_deps['mlflow'] = ['mlflow>=2.0.1,<3.0']\n\nextra_deps['all'] = set(dep for deps in extra_deps.values() for dep in deps)\n\ncomposer_data_files = ['py.typed']\ncomposer_data_files += package_files('composer', 'yamls', '.yaml')\ncomposer_data_files += package_files('composer', 'algorithms', '.json')\n\npackage_name = os.environ.get('COMPOSER_PACKAGE_NAME', 'mosaicml')\n\nif package_name != 'mosaicml':\n    print(f'`Building composer as `{package_name}`)', file=sys.stderr)\n\nsetup(name=package_name,\n      version=composer_version,\n      author='MosaicML',\n      author_email='team@mosaicml.com',\n      description=('Composer is a PyTorch library that enables you to train ' +\n                   'neural networks faster, at lower cost, and to higher accuracy.'),\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': composer_data_files,\n      },\n      packages=setuptools.find_packages(exclude=['docker*', 'examples*', 'scripts*', 'tests*']),\n      classifiers=[\n          'Programming Language :: Python :: 3',\n          'Programming Language :: Python :: 3.8',\n          'Programming Language :: Python :: 3.9',\n          'Programming Language :: Python :: 3.10',\n      ],\n      install_requires=install_requires,\n      entry_points={\n          'console_scripts': [\n              'composer = composer.cli.launcher:main',\n              'composer_collect_env = composer.utils.collect_env:main',\n          ],\n      },\n      extras_require=extra_deps,\n      dependency_links=['https://developer.download.nvidia.com/compute/redist'],\n      python_requires='>=3.8',\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"}]}