Skip to content

Support Scrapy 2.14#269

Merged
Gallaecio merged 48 commits intomainfrom
scrapy-2.14
Jan 20, 2026
Merged

Support Scrapy 2.14#269
Gallaecio merged 48 commits intomainfrom
scrapy-2.14

Conversation

@Gallaecio
Copy link
Contributor

@Gallaecio Gallaecio commented Jan 9, 2026

Resolves #265.

Includes and closes #267.

@Gallaecio Gallaecio marked this pull request as ready for review January 14, 2026 17:59
@Gallaecio Gallaecio requested review from Copilot and wRAR January 14, 2026 18:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for Scrapy 2.14, which introduces significant changes to the API, including removal of the spider parameter from various methods and changes to the download handler signature. The changes primarily involve migrating from deprecated Twisted Deferred-based APIs to modern async/await coroutine patterns.

Changes:

  • Updated minimum Python version from 3.9 to 3.10
  • Added compatibility layer for Scrapy 2.14's new async/await-based download handler API
  • Modified test infrastructure to work with both old and new Scrapy APIs
  • Updated various middleware and handler signatures to support optional spider parameters

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tox.ini Updated Python version requirements to 3.10 for test environments
tests/test_sessions.py Migrated test decorators and added async start() methods to spiders
tests/test_request_fingerprinter.py Updated test infrastructure for Scrapy 2.14 compatibility
tests/test_referer.py Added compatibility wrapper for deferred handling
tests/test_providers.py Replaced deprecated readBody with custom implementation and updated test utilities
tests/test_middlewares.py Added compatibility functions for request/response processing
tests/test_handler.py Updated download handler references and test patterns
tests/test_api_requests.py Added extensive compatibility handling for async/deferred differences
tests/test_addon.py Updated download handler class references
tests/mockserver.py Updated to use new download_request helper
tests/init.py Added compatibility helper functions for download/process operations
scrapy_zyte_api/utils.py Added backport implementations for Scrapy 2.14 utility functions
scrapy_zyte_api/responses.py Fixed deprecated datetime.utcfromtimestamp usage
scrapy_zyte_api/providers.py Added conditional logic for engine.download_async vs download
scrapy_zyte_api/handler.py Added conditional implementations for Scrapy 2.14's download_request signature
scrapy_zyte_api/_session.py Updated session management for async context managers and new download API
scrapy_zyte_api/_middlewares.py Made spider parameter optional and updated signal handling
pyproject.toml Updated Python version requirements and test filter warnings
docs/usage/manual.rst Changed examples to use async start() instead of start_requests()
docs/usage/automap.rst Changed examples to use async start() instead of start_requests()
docs/setup.rst Updated Python version requirement documentation
.github/workflows/test.yml Updated test matrix Python versions to 3.10

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Gallaecio Gallaecio requested a review from elacuesta January 14, 2026 18:04
This was referenced Jan 14, 2026
Copy link
Contributor

@wRAR wRAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

@Gallaecio Gallaecio merged commit 8e393e5 into main Jan 20, 2026
21 of 22 checks passed
@wRAR wRAR deleted the scrapy-2.14 branch January 21, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Scrapy 2.14

4 participants