We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Black specifies a requirement for click>=7.1.2 but actually requires click>=8.0
**Describe the bug**

Installing `black` from the head of the `main` branch and `click<8.0` results in a stack trace whenever the tool is run.

**To Reproduce**

```bash
python3 -m venv black-click-compat-bug
source black-click-compat-bug/bin/activate
python -m pip install \
  "click<8.0" \
  git+https://github.com/psf/black
black --help
```

Resulting traceback:

```
Traceback (most recent call last):
  File "/home/enpaul/black-click-compat-bug/bin/black", line 5, in <module>
    from black import patched_main
  File "/home/enpaul/black-click-compat-bug/lib64/python3.10/site-packages/black/__init__.py", line 34, in <module>
    from click.core import ParameterSource
ImportError: cannot import name 'ParameterSource' from 'click.core' (/home/enpaul/black-click-compat-bug/lib64/python3.10/site-packages/click/core.py)
```

**Expected behavior**

Black should specify a requirement for `click>=8.0.0` ([actual specification](https://github.com/psf/black/blob/main/setup.py#L100) is for `>=7.1.2`)

**Environment**

<!-- Please complete the following information: -->

- Black's version: `21.12b1.dev40+g565f9c9`
- OS: Linux (Fedora 35)
- Python: `Python 3.10.1`


--- 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 (C) 2020 Łukasz Langa
2 from setuptools import setup, find_packages
3 import sys
4 import os
5 
6 assert sys.version_info >= (3, 6, 2), "black requires Python 3.6.2+"
7 from pathlib import Path  # noqa E402
8 from typing import List  # noqa: E402
9 
10 CURRENT_DIR = Path(__file__).parent
11 sys.path.insert(0, str(CURRENT_DIR))  # for setuptools.build_meta
12 
13 
14 def get_long_description() -> str:
15     return (
16         (CURRENT_DIR / "README.md").read_text(encoding="utf8")
17         + "\n\n"
18         + (CURRENT_DIR / "CHANGES.md").read_text(encoding="utf8")
19     )
20 
21 
22 def find_python_files(base: Path) -> List[Path]:
23     files = []
24     for entry in base.iterdir():
25         if entry.is_file() and entry.suffix == ".py":
26             files.append(entry)
27         elif entry.is_dir():
28             files.extend(find_python_files(entry))
29 
30     return files
31 
32 
33 USE_MYPYC = False
34 # To compile with mypyc, a mypyc checkout must be present on the PYTHONPATH
35 if len(sys.argv) > 1 and sys.argv[1] == "--use-mypyc":
36     sys.argv.pop(1)
37     USE_MYPYC = True
38 if os.getenv("BLACK_USE_MYPYC", None) == "1":
39     USE_MYPYC = True
40 
41 if USE_MYPYC:
42     from mypyc.build import mypycify
43 
44     src = CURRENT_DIR / "src"
45     # TIP: filepaths are normalized to use forward slashes and are relative to ./src/
46     # before being checked against.
47     blocklist = [
48         # Not performance sensitive, so save bytes + compilation time:
49         "blib2to3/__init__.py",
50         "blib2to3/pgen2/__init__.py",
51         "black/output.py",
52         "black/concurrency.py",
53         "black/files.py",
54         "black/report.py",
55         # Breaks the test suite when compiled (and is also useless):
56         "black/debug.py",
57         # Compiled modules can't be run directly and that's a problem here:
58         "black/__main__.py",
59     ]
60     discovered = []
61     # black-primer and blackd have no good reason to be compiled.
62     discovered.extend(find_python_files(src / "black"))
63     discovered.extend(find_python_files(src / "blib2to3"))
64     mypyc_targets = [
65         str(p) for p in discovered if p.relative_to(src).as_posix() not in blocklist
66     ]
67 
68     opt_level = os.getenv("MYPYC_OPT_LEVEL", "3")
69     ext_modules = mypycify(mypyc_targets, opt_level=opt_level, verbose=True)
70 else:
71     ext_modules = []
72 
73 setup(
74     name="black",
75     use_scm_version={
76         "write_to": "src/_black_version.py",
77         "write_to_template": 'version = "{version}"\n',
78     },
79     description="The uncompromising code formatter.",
80     long_description=get_long_description(),
81     long_description_content_type="text/markdown",
82     keywords="automation formatter yapf autopep8 pyfmt gofmt rustfmt",
83     author="Łukasz Langa",
84     author_email="lukasz@langa.pl",
85     url="https://github.com/psf/black",
86     project_urls={"Changelog": "https://github.com/psf/black/blob/main/CHANGES.md"},
87     license="MIT",
88     py_modules=["_black_version"],
89     ext_modules=ext_modules,
90     packages=find_packages(where="src"),
91     package_dir={"": "src"},
92     package_data={
93         "blib2to3": ["*.txt"],
94         "black": ["py.typed"],
95         "black_primer": ["primer.json"],
96     },
97     python_requires=">=3.6.2",
98     zip_safe=False,
99     install_requires=[
100         "click>=7.1.2",
101         "platformdirs>=2",
102         "tomli>=1.1.0",
103         "typed-ast>=1.4.2; python_version < '3.8' and implementation_name == 'cpython'",
104         "pathspec>=0.9.0",
105         "dataclasses>=0.6; python_version < '3.7'",
106         "typing_extensions>=3.10.0.0; python_version < '3.10'",
107         "mypy_extensions>=0.4.3",
108     ],
109     extras_require={
110         "d": ["aiohttp>=3.7.4"],
111         "colorama": ["colorama>=0.4.3"],
112         "uvloop": ["uvloop>=0.15.2"],
113         "jupyter": ["ipython>=7.8.0", "tokenize-rt>=3.2.0"],
114     },
115     test_suite="tests.test_black",
116     classifiers=[
117         "Development Status :: 4 - Beta",
118         "Environment :: Console",
119         "Intended Audience :: Developers",
120         "License :: OSI Approved :: MIT License",
121         "Operating System :: OS Independent",
122         "Programming Language :: Python",
123         "Programming Language :: Python :: 3.6",
124         "Programming Language :: Python :: 3.7",
125         "Programming Language :: Python :: 3.8",
126         "Programming Language :: Python :: 3.9",
127         "Programming Language :: Python :: 3.10",
128         "Programming Language :: Python :: 3 :: Only",
129         "Topic :: Software Development :: Libraries :: Python Modules",
130         "Topic :: Software Development :: Quality Assurance",
131     ],
132     entry_points={
133         "console_scripts": [
134             "black=black:patched_main",
135             "blackd=blackd:patched_main [d]",
136             "black-primer=black_primer.cli:main",
137         ]
138     },
139 )
140
```
--- 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
@@ -97,7 +97,7 @@
     python_requires=">=3.6.2",
     zip_safe=False,
     install_requires=[
-        "click>=7.1.2",
+        "click>=8.0.0",
         "platformdirs>=2",
         "tomli>=1.1.0",
         "typed-ast>=1.4.2; python_version < '3.8' and implementation_name == 'cpython'",

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -97,7 +97,7 @@\n     python_requires=\">=3.6.2\",\n     zip_safe=False,\n     install_requires=[\n-        \"click>=7.1.2\",\n+        \"click>=8.0.0\",\n         \"platformdirs>=2\",\n         \"tomli>=1.1.0\",\n         \"typed-ast>=1.4.2; python_version < '3.8' and implementation_name == 'cpython'\",\n", "issue": "Black specifies a requirement for click>=7.1.2 but actually requires click>=8.0\n**Describe the bug**\r\n\r\nInstalling `black` from the head of the `main` branch and `click<8.0` results in a stack trace whenever the tool is run.\r\n\r\n**To Reproduce**\r\n\r\n```bash\r\npython3 -m venv black-click-compat-bug\r\nsource black-click-compat-bug/bin/activate\r\npython -m pip install \\\r\n  \"click<8.0\" \\\r\n  git+https://github.com/psf/black\r\nblack --help\r\n```\r\n\r\nResulting traceback:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/home/enpaul/black-click-compat-bug/bin/black\", line 5, in <module>\r\n    from black import patched_main\r\n  File \"/home/enpaul/black-click-compat-bug/lib64/python3.10/site-packages/black/__init__.py\", line 34, in <module>\r\n    from click.core import ParameterSource\r\nImportError: cannot import name 'ParameterSource' from 'click.core' (/home/enpaul/black-click-compat-bug/lib64/python3.10/site-packages/click/core.py)\r\n```\r\n\r\n**Expected behavior**\r\n\r\nBlack should specify a requirement for `click>=8.0.0` ([actual specification](https://github.com/psf/black/blob/main/setup.py#L100) is for `>=7.1.2`)\r\n\r\n**Environment**\r\n\r\n<!-- Please complete the following information: -->\r\n\r\n- Black's version: `21.12b1.dev40+g565f9c9`\r\n- OS: Linux (Fedora 35)\r\n- Python: `Python 3.10.1`\r\n\n", "before_files": [{"content": "# Copyright (C) 2020 \u0141ukasz Langa\nfrom setuptools import setup, find_packages\nimport sys\nimport os\n\nassert sys.version_info >= (3, 6, 2), \"black requires Python 3.6.2+\"\nfrom pathlib import Path  # noqa E402\nfrom typing import List  # noqa: E402\n\nCURRENT_DIR = Path(__file__).parent\nsys.path.insert(0, str(CURRENT_DIR))  # for setuptools.build_meta\n\n\ndef get_long_description() -> str:\n    return (\n        (CURRENT_DIR / \"README.md\").read_text(encoding=\"utf8\")\n        + \"\\n\\n\"\n        + (CURRENT_DIR / \"CHANGES.md\").read_text(encoding=\"utf8\")\n    )\n\n\ndef find_python_files(base: Path) -> List[Path]:\n    files = []\n    for entry in base.iterdir():\n        if entry.is_file() and entry.suffix == \".py\":\n            files.append(entry)\n        elif entry.is_dir():\n            files.extend(find_python_files(entry))\n\n    return files\n\n\nUSE_MYPYC = False\n# To compile with mypyc, a mypyc checkout must be present on the PYTHONPATH\nif len(sys.argv) > 1 and sys.argv[1] == \"--use-mypyc\":\n    sys.argv.pop(1)\n    USE_MYPYC = True\nif os.getenv(\"BLACK_USE_MYPYC\", None) == \"1\":\n    USE_MYPYC = True\n\nif USE_MYPYC:\n    from mypyc.build import mypycify\n\n    src = CURRENT_DIR / \"src\"\n    # TIP: filepaths are normalized to use forward slashes and are relative to ./src/\n    # before being checked against.\n    blocklist = [\n        # Not performance sensitive, so save bytes + compilation time:\n        \"blib2to3/__init__.py\",\n        \"blib2to3/pgen2/__init__.py\",\n        \"black/output.py\",\n        \"black/concurrency.py\",\n        \"black/files.py\",\n        \"black/report.py\",\n        # Breaks the test suite when compiled (and is also useless):\n        \"black/debug.py\",\n        # Compiled modules can't be run directly and that's a problem here:\n        \"black/__main__.py\",\n    ]\n    discovered = []\n    # black-primer and blackd have no good reason to be compiled.\n    discovered.extend(find_python_files(src / \"black\"))\n    discovered.extend(find_python_files(src / \"blib2to3\"))\n    mypyc_targets = [\n        str(p) for p in discovered if p.relative_to(src).as_posix() not in blocklist\n    ]\n\n    opt_level = os.getenv(\"MYPYC_OPT_LEVEL\", \"3\")\n    ext_modules = mypycify(mypyc_targets, opt_level=opt_level, verbose=True)\nelse:\n    ext_modules = []\n\nsetup(\n    name=\"black\",\n    use_scm_version={\n        \"write_to\": \"src/_black_version.py\",\n        \"write_to_template\": 'version = \"{version}\"\\n',\n    },\n    description=\"The uncompromising code formatter.\",\n    long_description=get_long_description(),\n    long_description_content_type=\"text/markdown\",\n    keywords=\"automation formatter yapf autopep8 pyfmt gofmt rustfmt\",\n    author=\"\u0141ukasz Langa\",\n    author_email=\"lukasz@langa.pl\",\n    url=\"https://github.com/psf/black\",\n    project_urls={\"Changelog\": \"https://github.com/psf/black/blob/main/CHANGES.md\"},\n    license=\"MIT\",\n    py_modules=[\"_black_version\"],\n    ext_modules=ext_modules,\n    packages=find_packages(where=\"src\"),\n    package_dir={\"\": \"src\"},\n    package_data={\n        \"blib2to3\": [\"*.txt\"],\n        \"black\": [\"py.typed\"],\n        \"black_primer\": [\"primer.json\"],\n    },\n    python_requires=\">=3.6.2\",\n    zip_safe=False,\n    install_requires=[\n        \"click>=7.1.2\",\n        \"platformdirs>=2\",\n        \"tomli>=1.1.0\",\n        \"typed-ast>=1.4.2; python_version < '3.8' and implementation_name == 'cpython'\",\n        \"pathspec>=0.9.0\",\n        \"dataclasses>=0.6; python_version < '3.7'\",\n        \"typing_extensions>=3.10.0.0; python_version < '3.10'\",\n        \"mypy_extensions>=0.4.3\",\n    ],\n    extras_require={\n        \"d\": [\"aiohttp>=3.7.4\"],\n        \"colorama\": [\"colorama>=0.4.3\"],\n        \"uvloop\": [\"uvloop>=0.15.2\"],\n        \"jupyter\": [\"ipython>=7.8.0\", \"tokenize-rt>=3.2.0\"],\n    },\n    test_suite=\"tests.test_black\",\n    classifiers=[\n        \"Development Status :: 4 - Beta\",\n        \"Environment :: Console\",\n        \"Intended Audience :: Developers\",\n        \"License :: OSI Approved :: MIT License\",\n        \"Operating System :: OS Independent\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Programming Language :: Python :: 3.10\",\n        \"Programming Language :: Python :: 3 :: Only\",\n        \"Topic :: Software Development :: Libraries :: Python Modules\",\n        \"Topic :: Software Development :: Quality Assurance\",\n    ],\n    entry_points={\n        \"console_scripts\": [\n            \"black=black:patched_main\",\n            \"blackd=blackd:patched_main [d]\",\n            \"black-primer=black_primer.cli:main\",\n        ]\n    },\n)\n", "path": "setup.py"}], "after_files": [{"content": "# Copyright (C) 2020 \u0141ukasz Langa\nfrom setuptools import setup, find_packages\nimport sys\nimport os\n\nassert sys.version_info >= (3, 6, 2), \"black requires Python 3.6.2+\"\nfrom pathlib import Path  # noqa E402\nfrom typing import List  # noqa: E402\n\nCURRENT_DIR = Path(__file__).parent\nsys.path.insert(0, str(CURRENT_DIR))  # for setuptools.build_meta\n\n\ndef get_long_description() -> str:\n    return (\n        (CURRENT_DIR / \"README.md\").read_text(encoding=\"utf8\")\n        + \"\\n\\n\"\n        + (CURRENT_DIR / \"CHANGES.md\").read_text(encoding=\"utf8\")\n    )\n\n\ndef find_python_files(base: Path) -> List[Path]:\n    files = []\n    for entry in base.iterdir():\n        if entry.is_file() and entry.suffix == \".py\":\n            files.append(entry)\n        elif entry.is_dir():\n            files.extend(find_python_files(entry))\n\n    return files\n\n\nUSE_MYPYC = False\n# To compile with mypyc, a mypyc checkout must be present on the PYTHONPATH\nif len(sys.argv) > 1 and sys.argv[1] == \"--use-mypyc\":\n    sys.argv.pop(1)\n    USE_MYPYC = True\nif os.getenv(\"BLACK_USE_MYPYC\", None) == \"1\":\n    USE_MYPYC = True\n\nif USE_MYPYC:\n    from mypyc.build import mypycify\n\n    src = CURRENT_DIR / \"src\"\n    # TIP: filepaths are normalized to use forward slashes and are relative to ./src/\n    # before being checked against.\n    blocklist = [\n        # Not performance sensitive, so save bytes + compilation time:\n        \"blib2to3/__init__.py\",\n        \"blib2to3/pgen2/__init__.py\",\n        \"black/output.py\",\n        \"black/concurrency.py\",\n        \"black/files.py\",\n        \"black/report.py\",\n        # Breaks the test suite when compiled (and is also useless):\n        \"black/debug.py\",\n        # Compiled modules can't be run directly and that's a problem here:\n        \"black/__main__.py\",\n    ]\n    discovered = []\n    # black-primer and blackd have no good reason to be compiled.\n    discovered.extend(find_python_files(src / \"black\"))\n    discovered.extend(find_python_files(src / \"blib2to3\"))\n    mypyc_targets = [\n        str(p) for p in discovered if p.relative_to(src).as_posix() not in blocklist\n    ]\n\n    opt_level = os.getenv(\"MYPYC_OPT_LEVEL\", \"3\")\n    ext_modules = mypycify(mypyc_targets, opt_level=opt_level, verbose=True)\nelse:\n    ext_modules = []\n\nsetup(\n    name=\"black\",\n    use_scm_version={\n        \"write_to\": \"src/_black_version.py\",\n        \"write_to_template\": 'version = \"{version}\"\\n',\n    },\n    description=\"The uncompromising code formatter.\",\n    long_description=get_long_description(),\n    long_description_content_type=\"text/markdown\",\n    keywords=\"automation formatter yapf autopep8 pyfmt gofmt rustfmt\",\n    author=\"\u0141ukasz Langa\",\n    author_email=\"lukasz@langa.pl\",\n    url=\"https://github.com/psf/black\",\n    project_urls={\"Changelog\": \"https://github.com/psf/black/blob/main/CHANGES.md\"},\n    license=\"MIT\",\n    py_modules=[\"_black_version\"],\n    ext_modules=ext_modules,\n    packages=find_packages(where=\"src\"),\n    package_dir={\"\": \"src\"},\n    package_data={\n        \"blib2to3\": [\"*.txt\"],\n        \"black\": [\"py.typed\"],\n        \"black_primer\": [\"primer.json\"],\n    },\n    python_requires=\">=3.6.2\",\n    zip_safe=False,\n    install_requires=[\n        \"click>=8.0.0\",\n        \"platformdirs>=2\",\n        \"tomli>=1.1.0\",\n        \"typed-ast>=1.4.2; python_version < '3.8' and implementation_name == 'cpython'\",\n        \"pathspec>=0.9.0\",\n        \"dataclasses>=0.6; python_version < '3.7'\",\n        \"typing_extensions>=3.10.0.0; python_version < '3.10'\",\n        \"mypy_extensions>=0.4.3\",\n    ],\n    extras_require={\n        \"d\": [\"aiohttp>=3.7.4\"],\n        \"colorama\": [\"colorama>=0.4.3\"],\n        \"uvloop\": [\"uvloop>=0.15.2\"],\n        \"jupyter\": [\"ipython>=7.8.0\", \"tokenize-rt>=3.2.0\"],\n    },\n    test_suite=\"tests.test_black\",\n    classifiers=[\n        \"Development Status :: 4 - Beta\",\n        \"Environment :: Console\",\n        \"Intended Audience :: Developers\",\n        \"License :: OSI Approved :: MIT License\",\n        \"Operating System :: OS Independent\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Programming Language :: Python :: 3.10\",\n        \"Programming Language :: Python :: 3 :: Only\",\n        \"Topic :: Software Development :: Libraries :: Python Modules\",\n        \"Topic :: Software Development :: Quality Assurance\",\n    ],\n    entry_points={\n        \"console_scripts\": [\n            \"black=black:patched_main\",\n            \"blackd=blackd:patched_main [d]\",\n            \"black-primer=black_primer.cli:main\",\n        ]\n    },\n)\n", "path": "setup.py"}]}