From 3ea86df16f656c7e82022d1df656916c14d3bd8f Mon Sep 17 00:00:00 2001 From: Andrey Rakhmatullin Date: Sat, 11 Jul 2026 23:22:30 +0500 Subject: [PATCH] Deprecate IFeedStorage. --- scrapy/extensions/feedexport.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/scrapy/extensions/feedexport.py b/scrapy/extensions/feedexport.py index 1a93c7b4a..9c95e3331 100644 --- a/scrapy/extensions/feedexport.py +++ b/scrapy/extensions/feedexport.py @@ -88,25 +88,18 @@ class ItemFilter: return True # accept all items by default -class IFeedStorage(Interface): # type: ignore[misc] - """Interface that all Feed Storages must implement""" - +class _IFeedStorage(Interface): # type: ignore[misc] # pragma: no cover # pylint: disable=no-self-argument - def __init__(uri, *, feed_options=None): # type: ignore[no-untyped-def] # pylint: disable=super-init-not-called - """Initialize the storage with the parameters given in the URI and the - feed-specific options (see :setting:`FEEDS`)""" + def __init__(uri, *, feed_options=None): ... # type: ignore[no-untyped-def] # pylint: disable=super-init-not-called - def open(spider): # type: ignore[no-untyped-def] - """Open the storage for the given spider. It must return a file-like - object that will be used for the exporters""" + def open(spider): ... # type: ignore[no-untyped-def] - def store(file): # type: ignore[no-untyped-def] - """Store the given file stream""" + def store(file): ... # type: ignore[no-untyped-def] class FeedStorageProtocol(Protocol): - """Reimplementation of ``IFeedStorage`` that can be used in type hints.""" + """Protocol that all Feed Storages must follow.""" def __init__(self, uri: str, *, feed_options: dict[str, Any] | None = None): """Initialize the storage with the parameters given in the URI and the @@ -728,3 +721,14 @@ class FeedExporter: feed_options.get("item_filter", ItemFilter) ) return item_filter_class(feed_options) + + +def __getattr__(name: str) -> Any: # pragma: no cover + if name == "IFeedStorage": + warnings.warn( + "scrapy.extensions.feedexport.IFeedStorage is deprecated.", + ScrapyDeprecationWarning, + stacklevel=2, + ) + return _IFeedStorage + raise AttributeError(f"module {__name__!r} has no attribute {name!r}")