Skip to content
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

Remove deprecated spider parameter #5589

Merged
merged 10 commits into from
Oct 26, 2022
Merged

Remove deprecated spider parameter #5589

merged 10 commits into from
Oct 26, 2022

Conversation

Laerte
Copy link
Member

@Laerte Laerte commented Aug 2, 2022

Closes #5588

@codecov
Copy link

codecov bot commented Aug 2, 2022

Codecov Report

Merging #5589 (fa4ed08) into master (92be5ba) will increase coverage by 0.16%.
The diff coverage is 80.00%.

❗ Current head fa4ed08 differs from pull request most recent head 354a32c. Consider uploading reports for the commit 354a32c to get more accurate results

@@            Coverage Diff             @@
##           master    #5589      +/-   ##
==========================================
+ Coverage   88.66%   88.83%   +0.16%     
==========================================
  Files         162      162              
  Lines       10995    10996       +1     
  Branches     1799     1800       +1     
==========================================
+ Hits         9749     9768      +19     
+ Misses        966      948      -18     
  Partials      280      280              
Impacted Files Coverage Δ
scrapy/core/engine.py 84.01% <80.00%> (+0.05%) ⬆️
scrapy/robotstxt.py 97.53% <0.00%> (+22.22%) ⬆️

@Laerte
Copy link
Member Author

Laerte commented Aug 2, 2022

The error in CI is not related with the change made.

@kmike
Copy link
Member

kmike commented Aug 3, 2022

If I'm not mistaken, this parameter is deprecated in #5090; it was released with Scrapy 2.6.0 (https://docs.scrapy.org/en/latest/news.html#scrapy-2-6-0-2022-03-01), which happened 2022-03-01. According to https://docs.scrapy.org/en/latest/versioning.html#deprecation-policy, we promise at least one year before the deprecated code is removed, so unfortunately we can't remove it now.

@Gallaecio
Copy link
Member

Instead, we need to capture and silence that warning when triggered by our own code.

@Laerte
Copy link
Member Author

Laerte commented Aug 3, 2022

@Gallaecio I will update the code to this approach.

@Gallaecio
Copy link
Member

I would like to first understand why it is happening in the first place, though. Maybe there is a better way.

@Gallaecio
Copy link
Member

Gallaecio commented Aug 3, 2022

OK, so I think we need to change download so that:

  • spider = self.spider never happens.
  • if spider is None changes to if self.spider is None.

Hopefully that solves the issue without undesired side effects.

@Laerte
Copy link
Member Author

Laerte commented Aug 3, 2022

@Gallaecio Hope i getted it the idea.

scrapy/core/engine.py Outdated Show resolved Hide resolved
scrapy/core/engine.py Outdated Show resolved Hide resolved
@Gallaecio
Copy link
Member

Looks good to me, thanks! 🚀

How do you feel about test coverage? Do you think you can add at least a test to verify that the exception is not logged with default settings? If you do not see it clearly, I can try and have a look later.

@Laerte
Copy link
Member Author

Laerte commented Aug 4, 2022

Looks good to me, thanks! 🚀

How do you feel about test coverage? Do you think you can add at least a test to verify that the exception is not logged with default settings? If you do not see it clearly, I can try and have a look later.

I'm on vacation, if you can add tests i will be glad, thanks!

@hernandezj1
Copy link

Thanks for this fix. It worked great!

@Laerte Laerte requested review from kmike and Gallaecio and removed request for kmike October 10, 2022 15:13
@kmike kmike merged commit 2464939 into scrapy:master Oct 26, 2022
@kmike
Copy link
Member

kmike commented Oct 26, 2022

Thanks @Laerte for keeping the PR up-to-date, this helps a lot!

@kmike kmike added this to the Scrapy 2.7.1 milestone Oct 26, 2022
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.

Scrapy warns about itself
5 participants