-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Engine: deprecations and type hints #5090
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## master #5090 +/- ##
==========================================
- Coverage 88.25% 88.19% -0.07%
==========================================
Files 162 162
Lines 10374 10392 +18
Branches 1506 1510 +4
==========================================
+ Hits 9156 9165 +9
- Misses 948 952 +4
- Partials 270 275 +5
|
Gallaecio
reviewed
Apr 8, 2021
Co-authored-by: Adrián Chaves <adrian@chaves.io>
elacuesta
changed the title
Engine type hints
Engine: deprecate open_spiders property, type hints
Apr 8, 2021
elacuesta
changed the title
Engine: deprecate open_spiders property, type hints
Engine: deprecate open_spiders and has_capacity, add type hints
Apr 8, 2021
Gallaecio
reviewed
Apr 9, 2021
elacuesta
changed the title
Engine: deprecate open_spiders and has_capacity, add type hints
Engine: deprecations and type hints
Apr 9, 2021
wRAR
reviewed
Apr 9, 2021
Gallaecio
reviewed
Apr 12, 2021
…uest_from_scheduler
Gallaecio
approved these changes
Apr 16, 2021
marlenachatzigrigoriou
pushed a commit
to marlenachatzigrigoriou/scrapy
that referenced
this pull request
Apr 21, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed earlier @wRAR
Type hints adapted from #3559
Deprecated methods:
ExecutionEngine.open_spiders
: I didn't check the history, but I suspect this probably comes from the time when multiple spiders could run in a single crawl. That hasn't been the case for a long time, so it's not necessary to have a plurally-named property with only one element.ExecutionEngine.has_capacity
: same as the above, the engine only handles one spider slot, which can be checked directly. Not called from outside the engine.ExecutionEngine.schedule
: Not called from outside the engine, deprecated as per Requests scheduled when idle never go through the spider middlewares #542 (comment)Also, the
spider
argument is deprecated for thespider_is_idle
,crawl
anddownload
methods, the spider instance saved in theExecutionEngine.spider
after callingopen_spider
is used instead. I would also like to deprecate passing a spider argument toclose_spider
, but that would be more complicated because of the order of the positional arguments, let's leave it for a future PR.