Stop using and deprecate ISpiderLoader.

This commit is contained in:
Andrey Rakhmatullin 2026-07-11 22:58:02 +05:00
parent a661d1746d
commit 9c0b55af0b
3 changed files with 27 additions and 5 deletions

View File

@ -3,6 +3,23 @@
Release notes
=============
Scrapy VERSION (unreleased)
---------------------------
Backward-incompatible changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- The following runtime usage of zope.interface_ interfaces is removed:
- :class:`~scrapy.spiderloader.SpiderLoader` and
:class:`~scrapy.spiderloader.DummySpiderLoader` are no longer marked
as implementing the ``ISpiderLoader`` interface.
- :func:`~scrapy.spiderloader.get_spider_loader` no longer checks that the
configured spider loader implements the ``ISpiderLoader`` interface.
(:issue:`6585`, :issue:`TBD`)
.. _release-2.17.0:
Scrapy 2.17.0 (2026-07-07)

View File

@ -1,7 +1,17 @@
# pragma: no file cover
# pylint: disable=no-method-argument,no-self-argument
import warnings
from zope.interface import Interface
from scrapy.exceptions import ScrapyDeprecationWarning
warnings.warn(
"The scrapy.interfaces module is deprecated.",
ScrapyDeprecationWarning,
stacklevel=2,
)
class ISpiderLoader(Interface):
def from_settings(settings):

View File

@ -5,9 +5,6 @@ import warnings
from collections import defaultdict
from typing import TYPE_CHECKING, Protocol, cast
from zope.interface import implementer
from scrapy.interfaces import ISpiderLoader
from scrapy.utils.misc import load_object, walk_modules_iter
from scrapy.utils.spider import iter_spider_classes
@ -45,7 +42,6 @@ class SpiderLoaderProtocol(Protocol):
"""Return the list of spiders names that can handle the given request"""
@implementer(ISpiderLoader)
class SpiderLoader:
"""
SpiderLoader is a class which locates and loads spiders
@ -131,7 +127,6 @@ class SpiderLoader:
return list(self._spiders.keys())
@implementer(ISpiderLoader)
class DummySpiderLoader:
"""A dummy spider loader that does not load any spiders."""