Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Merge pull request #5950 from wRAR/addons

Andrey Rakhmatullin06ebdee35dc7
diff --cc scrapy/settings/__init__.py
index b0adb5ba8,0f5cf85ac..bc82cc098
--- a/scrapy/settings/__init__.py
+++ b/scrapy/settings/__init__.py
@@@ -22,23 -6,10 +22,24 @@@ from typing import
from scrapy.settings import default_settings
-SETTINGS_PRIORITIES = {
+# The key types are restricted in BaseSettings._get_key() to ones supported by JSON,
+# see https://github.com/scrapy/scrapy/issues/5383.
+_SettingsKeyT = Union[bool, float, int, str, None]
+
+if TYPE_CHECKING:
+ # https://github.com/python/typing/issues/445#issuecomment-1131458824
+ from _typeshed import SupportsItems
+
+ # typing.Self requires Python 3.11
+ from typing_extensions import Self
+
+ _SettingsInputT = Union[SupportsItems[_SettingsKeyT, Any], str, None]
+
+
+SETTINGS_PRIORITIES: Dict[str, int] = {
"default": 0,
"command": 10,
+ "addon": 15,
"project": 20,
"spider": 30,
"cmdline": 40,