We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
"DeprecationWarning: Use of 'SCRAPY_'-prefixed environment variables" always shows
`ScrapyDeprecationWarning: Use of 'SCRAPY_'-prefixed environment variables to override settings is deprecated.`

This deprecation warning can't be shut up inside a project.

https://github.com/scrapy/scrapy/blob/034e2c31c7d55333c3de208f80dcee1bf45ef9b9/scrapy/utils/project.py#L17-L19

This is always true, if inside a project. Because of
https://github.com/scrapy/scrapy/blob/034e2c31c7d55333c3de208f80dcee1bf45ef9b9/scrapy/utils/conf.py#L77-L84
We should probably stop "emulating" ENV vars there, and pass this somehow differently.

Additionally, the `ScrapyDeprecationWarning` for `env_overrides` is too generic: It never tells you _which_ variable(s) are actually set. This is plain annoying. Please make it more specific.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `scrapy/utils/project.py`
Content:
```
1 import os
2 import pickle
3 import warnings
4 
5 from importlib import import_module
6 from os.path import join, dirname, abspath, isabs, exists
7 
8 from scrapy.utils.conf import closest_scrapy_cfg, get_config, init_env
9 from scrapy.settings import Settings
10 from scrapy.exceptions import NotConfigured, ScrapyDeprecationWarning
11 
12 
13 ENVVAR = 'SCRAPY_SETTINGS_MODULE'
14 DATADIR_CFG_SECTION = 'datadir'
15 
16 
17 def inside_project():
18     scrapy_module = os.environ.get('SCRAPY_SETTINGS_MODULE')
19     if scrapy_module is not None:
20         try:
21             import_module(scrapy_module)
22         except ImportError as exc:
23             warnings.warn("Cannot import scrapy settings module %s: %s" % (scrapy_module, exc))
24         else:
25             return True
26     return bool(closest_scrapy_cfg())
27 
28 
29 def project_data_dir(project='default'):
30     """Return the current project data dir, creating it if it doesn't exist"""
31     if not inside_project():
32         raise NotConfigured("Not inside a project")
33     cfg = get_config()
34     if cfg.has_option(DATADIR_CFG_SECTION, project):
35         d = cfg.get(DATADIR_CFG_SECTION, project)
36     else:
37         scrapy_cfg = closest_scrapy_cfg()
38         if not scrapy_cfg:
39             raise NotConfigured("Unable to find scrapy.cfg file to infer project data dir")
40         d = abspath(join(dirname(scrapy_cfg), '.scrapy'))
41     if not exists(d):
42         os.makedirs(d)
43     return d
44 
45 
46 def data_path(path, createdir=False):
47     """
48     Return the given path joined with the .scrapy data directory.
49     If given an absolute path, return it unmodified.
50     """
51     if not isabs(path):
52         if inside_project():
53             path = join(project_data_dir(), path)
54         else:
55             path = join('.scrapy', path)
56     if createdir and not exists(path):
57         os.makedirs(path)
58     return path
59 
60 
61 def get_project_settings():
62     if ENVVAR not in os.environ:
63         project = os.environ.get('SCRAPY_PROJECT', 'default')
64         init_env(project)
65 
66     settings = Settings()
67     settings_module_path = os.environ.get(ENVVAR)
68     if settings_module_path:
69         settings.setmodule(settings_module_path, priority='project')
70 
71     pickled_settings = os.environ.get("SCRAPY_PICKLED_SETTINGS_TO_OVERRIDE")
72     if pickled_settings:
73         warnings.warn("Use of environment variable "
74                       "'SCRAPY_PICKLED_SETTINGS_TO_OVERRIDE' "
75                       "is deprecated.", ScrapyDeprecationWarning)
76         settings.setdict(pickle.loads(pickled_settings), priority='project')
77 
78     env_overrides = {k[7:]: v for k, v in os.environ.items() if
79                      k.startswith('SCRAPY_')}
80     if env_overrides:
81         warnings.warn("Use of 'SCRAPY_'-prefixed environment variables to override settings is deprecated.", ScrapyDeprecationWarning)
82         settings.setdict(env_overrides, priority='project')
83     return settings
84
```
--- 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/scrapy/utils/project.py b/scrapy/utils/project.py
--- a/scrapy/utils/project.py
+++ b/scrapy/utils/project.py
@@ -75,9 +75,24 @@
                       "is deprecated.", ScrapyDeprecationWarning)
         settings.setdict(pickle.loads(pickled_settings), priority='project')
 
-    env_overrides = {k[7:]: v for k, v in os.environ.items() if
-                     k.startswith('SCRAPY_')}
-    if env_overrides:
-        warnings.warn("Use of 'SCRAPY_'-prefixed environment variables to override settings is deprecated.", ScrapyDeprecationWarning)
-        settings.setdict(env_overrides, priority='project')
+    scrapy_envvars = {k[7:]: v for k, v in os.environ.items() if
+                      k.startswith('SCRAPY_')}
+    valid_envvars = {
+        'CHECK',
+        'PICKLED_SETTINGS_TO_OVERRIDE',
+        'PROJECT',
+        'PYTHON_SHELL',
+        'SETTINGS_MODULE',
+    }
+    setting_envvars = {k for k in scrapy_envvars if k not in valid_envvars}
+    if setting_envvars:
+        setting_envvar_list = ', '.join(sorted(setting_envvars))
+        warnings.warn(
+            'Use of environment variables prefixed with SCRAPY_ to override '
+            'settings is deprecated. The following environment variables are '
+            'currently defined: {}'.format(setting_envvar_list),
+            ScrapyDeprecationWarning
+        )
+    settings.setdict(scrapy_envvars, priority='project')
+
     return settings

{"golden_diff": "diff --git a/scrapy/utils/project.py b/scrapy/utils/project.py\n--- a/scrapy/utils/project.py\n+++ b/scrapy/utils/project.py\n@@ -75,9 +75,24 @@\n                       \"is deprecated.\", ScrapyDeprecationWarning)\n         settings.setdict(pickle.loads(pickled_settings), priority='project')\n \n-    env_overrides = {k[7:]: v for k, v in os.environ.items() if\n-                     k.startswith('SCRAPY_')}\n-    if env_overrides:\n-        warnings.warn(\"Use of 'SCRAPY_'-prefixed environment variables to override settings is deprecated.\", ScrapyDeprecationWarning)\n-        settings.setdict(env_overrides, priority='project')\n+    scrapy_envvars = {k[7:]: v for k, v in os.environ.items() if\n+                      k.startswith('SCRAPY_')}\n+    valid_envvars = {\n+        'CHECK',\n+        'PICKLED_SETTINGS_TO_OVERRIDE',\n+        'PROJECT',\n+        'PYTHON_SHELL',\n+        'SETTINGS_MODULE',\n+    }\n+    setting_envvars = {k for k in scrapy_envvars if k not in valid_envvars}\n+    if setting_envvars:\n+        setting_envvar_list = ', '.join(sorted(setting_envvars))\n+        warnings.warn(\n+            'Use of environment variables prefixed with SCRAPY_ to override '\n+            'settings is deprecated. The following environment variables are '\n+            'currently defined: {}'.format(setting_envvar_list),\n+            ScrapyDeprecationWarning\n+        )\n+    settings.setdict(scrapy_envvars, priority='project')\n+\n     return settings\n", "issue": "\"DeprecationWarning: Use of 'SCRAPY_'-prefixed environment variables\" always shows\n`ScrapyDeprecationWarning: Use of 'SCRAPY_'-prefixed environment variables to override settings is deprecated.`\r\n\r\nThis deprecation warning can't be shut up inside a project.\r\n\r\nhttps://github.com/scrapy/scrapy/blob/034e2c31c7d55333c3de208f80dcee1bf45ef9b9/scrapy/utils/project.py#L17-L19\r\n\r\nThis is always true, if inside a project. Because of\r\nhttps://github.com/scrapy/scrapy/blob/034e2c31c7d55333c3de208f80dcee1bf45ef9b9/scrapy/utils/conf.py#L77-L84\r\nWe should probably stop \"emulating\" ENV vars there, and pass this somehow differently.\r\n\r\nAdditionally, the `ScrapyDeprecationWarning` for `env_overrides` is too generic: It never tells you _which_ variable(s) are actually set. This is plain annoying. Please make it more specific.\n", "before_files": [{"content": "import os\nimport pickle\nimport warnings\n\nfrom importlib import import_module\nfrom os.path import join, dirname, abspath, isabs, exists\n\nfrom scrapy.utils.conf import closest_scrapy_cfg, get_config, init_env\nfrom scrapy.settings import Settings\nfrom scrapy.exceptions import NotConfigured, ScrapyDeprecationWarning\n\n\nENVVAR = 'SCRAPY_SETTINGS_MODULE'\nDATADIR_CFG_SECTION = 'datadir'\n\n\ndef inside_project():\n    scrapy_module = os.environ.get('SCRAPY_SETTINGS_MODULE')\n    if scrapy_module is not None:\n        try:\n            import_module(scrapy_module)\n        except ImportError as exc:\n            warnings.warn(\"Cannot import scrapy settings module %s: %s\" % (scrapy_module, exc))\n        else:\n            return True\n    return bool(closest_scrapy_cfg())\n\n\ndef project_data_dir(project='default'):\n    \"\"\"Return the current project data dir, creating it if it doesn't exist\"\"\"\n    if not inside_project():\n        raise NotConfigured(\"Not inside a project\")\n    cfg = get_config()\n    if cfg.has_option(DATADIR_CFG_SECTION, project):\n        d = cfg.get(DATADIR_CFG_SECTION, project)\n    else:\n        scrapy_cfg = closest_scrapy_cfg()\n        if not scrapy_cfg:\n            raise NotConfigured(\"Unable to find scrapy.cfg file to infer project data dir\")\n        d = abspath(join(dirname(scrapy_cfg), '.scrapy'))\n    if not exists(d):\n        os.makedirs(d)\n    return d\n\n\ndef data_path(path, createdir=False):\n    \"\"\"\n    Return the given path joined with the .scrapy data directory.\n    If given an absolute path, return it unmodified.\n    \"\"\"\n    if not isabs(path):\n        if inside_project():\n            path = join(project_data_dir(), path)\n        else:\n            path = join('.scrapy', path)\n    if createdir and not exists(path):\n        os.makedirs(path)\n    return path\n\n\ndef get_project_settings():\n    if ENVVAR not in os.environ:\n        project = os.environ.get('SCRAPY_PROJECT', 'default')\n        init_env(project)\n\n    settings = Settings()\n    settings_module_path = os.environ.get(ENVVAR)\n    if settings_module_path:\n        settings.setmodule(settings_module_path, priority='project')\n\n    pickled_settings = os.environ.get(\"SCRAPY_PICKLED_SETTINGS_TO_OVERRIDE\")\n    if pickled_settings:\n        warnings.warn(\"Use of environment variable \"\n                      \"'SCRAPY_PICKLED_SETTINGS_TO_OVERRIDE' \"\n                      \"is deprecated.\", ScrapyDeprecationWarning)\n        settings.setdict(pickle.loads(pickled_settings), priority='project')\n\n    env_overrides = {k[7:]: v for k, v in os.environ.items() if\n                     k.startswith('SCRAPY_')}\n    if env_overrides:\n        warnings.warn(\"Use of 'SCRAPY_'-prefixed environment variables to override settings is deprecated.\", ScrapyDeprecationWarning)\n        settings.setdict(env_overrides, priority='project')\n    return settings\n", "path": "scrapy/utils/project.py"}], "after_files": [{"content": "import os\nimport pickle\nimport warnings\n\nfrom importlib import import_module\nfrom os.path import join, dirname, abspath, isabs, exists\n\nfrom scrapy.utils.conf import closest_scrapy_cfg, get_config, init_env\nfrom scrapy.settings import Settings\nfrom scrapy.exceptions import NotConfigured, ScrapyDeprecationWarning\n\n\nENVVAR = 'SCRAPY_SETTINGS_MODULE'\nDATADIR_CFG_SECTION = 'datadir'\n\n\ndef inside_project():\n    scrapy_module = os.environ.get('SCRAPY_SETTINGS_MODULE')\n    if scrapy_module is not None:\n        try:\n            import_module(scrapy_module)\n        except ImportError as exc:\n            warnings.warn(\"Cannot import scrapy settings module %s: %s\" % (scrapy_module, exc))\n        else:\n            return True\n    return bool(closest_scrapy_cfg())\n\n\ndef project_data_dir(project='default'):\n    \"\"\"Return the current project data dir, creating it if it doesn't exist\"\"\"\n    if not inside_project():\n        raise NotConfigured(\"Not inside a project\")\n    cfg = get_config()\n    if cfg.has_option(DATADIR_CFG_SECTION, project):\n        d = cfg.get(DATADIR_CFG_SECTION, project)\n    else:\n        scrapy_cfg = closest_scrapy_cfg()\n        if not scrapy_cfg:\n            raise NotConfigured(\"Unable to find scrapy.cfg file to infer project data dir\")\n        d = abspath(join(dirname(scrapy_cfg), '.scrapy'))\n    if not exists(d):\n        os.makedirs(d)\n    return d\n\n\ndef data_path(path, createdir=False):\n    \"\"\"\n    Return the given path joined with the .scrapy data directory.\n    If given an absolute path, return it unmodified.\n    \"\"\"\n    if not isabs(path):\n        if inside_project():\n            path = join(project_data_dir(), path)\n        else:\n            path = join('.scrapy', path)\n    if createdir and not exists(path):\n        os.makedirs(path)\n    return path\n\n\ndef get_project_settings():\n    if ENVVAR not in os.environ:\n        project = os.environ.get('SCRAPY_PROJECT', 'default')\n        init_env(project)\n\n    settings = Settings()\n    settings_module_path = os.environ.get(ENVVAR)\n    if settings_module_path:\n        settings.setmodule(settings_module_path, priority='project')\n\n    pickled_settings = os.environ.get(\"SCRAPY_PICKLED_SETTINGS_TO_OVERRIDE\")\n    if pickled_settings:\n        warnings.warn(\"Use of environment variable \"\n                      \"'SCRAPY_PICKLED_SETTINGS_TO_OVERRIDE' \"\n                      \"is deprecated.\", ScrapyDeprecationWarning)\n        settings.setdict(pickle.loads(pickled_settings), priority='project')\n\n    scrapy_envvars = {k[7:]: v for k, v in os.environ.items() if\n                      k.startswith('SCRAPY_')}\n    valid_envvars = {\n        'CHECK',\n        'PICKLED_SETTINGS_TO_OVERRIDE',\n        'PROJECT',\n        'PYTHON_SHELL',\n        'SETTINGS_MODULE',\n    }\n    setting_envvars = {k for k in scrapy_envvars if k not in valid_envvars}\n    if setting_envvars:\n        setting_envvar_list = ', '.join(sorted(setting_envvars))\n        warnings.warn(\n            'Use of environment variables prefixed with SCRAPY_ to override '\n            'settings is deprecated. The following environment variables are '\n            'currently defined: {}'.format(setting_envvar_list),\n            ScrapyDeprecationWarning\n        )\n    settings.setdict(scrapy_envvars, priority='project')\n\n    return settings\n", "path": "scrapy/utils/project.py"}]}