Skip to content

Switch auto field stats to an item pipeline#216

Closed
Gallaecio wants to merge 10 commits intoscrapy-plugins:mainfrom
Gallaecio:auto-fields
Closed

Switch auto field stats to an item pipeline#216
Gallaecio wants to merge 10 commits intoscrapy-plugins:mainfrom
Gallaecio:auto-fields

Conversation

@Gallaecio
Copy link
Contributor

@Gallaecio Gallaecio commented Aug 26, 2024

I was asked to support non-standard, custom items for auto field stats.

To achieve that, it seemed easier to switch the implementation to an item pipeline.

It also feels like this feature would make sense in scrapy-poet now. But I am not 100% sure, and I also would not want to move it until scrapy-poet gained add-on support.

To do:

@Gallaecio Gallaecio requested review from kmike and wRAR August 26, 2024 20:57
@codecov
Copy link

codecov bot commented Aug 26, 2024

Codecov Report

Attention: Patch coverage is 98.43750% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.03%. Comparing base (a2061e8) to head (a5ffb08).
Report is 37 commits behind head on main.

Files with missing lines Patch % Lines
scrapy_zyte_api/_poet_item_pipelines.py 98.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #216      +/-   ##
==========================================
+ Coverage   97.86%   98.03%   +0.16%     
==========================================
  Files          14       16       +2     
  Lines        1590     1625      +35     
  Branches      337      342       +5     
==========================================
+ Hits         1556     1593      +37     
+ Misses         14       11       -3     
- Partials       20       21       +1     
Files with missing lines Coverage Δ
scrapy_zyte_api/addon.py 98.14% <100.00%> (+0.07%) ⬆️
scrapy_zyte_api/poet.py 100.00% <100.00%> (ø)
scrapy_zyte_api/providers.py 93.71% <100.00%> (-0.95%) ⬇️
scrapy_zyte_api/_poet_item_pipelines.py 98.33% <98.33%> (ø)

... and 1 file with indirect coverage changes

@kmike
Copy link
Member

kmike commented Aug 29, 2024

The code looks good 👍 But I haven't checked how it works, and if it solves the issue :)

logger = getLogger(__name__)


class ScrapyZyteAPIAutoFieldStatsItemPipeline:
Copy link
Member

Choose a reason for hiding this comment

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

Moving it to scrapy-poet might allow to make the name shorter :)

@Gallaecio
Copy link
Contributor Author

Closing in favor of zytedata/zyte-common-items#124.

@Gallaecio Gallaecio closed this Dec 16, 2024
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.

3 participants