Skip to content

style: fix black, isort and pylint failures in examples/python - #166

Open
mueedx wants to merge 2 commits into
tinyfish-io:mainfrom
mueedx:fix/python-ci-lint-debt
Open

mueedx wants to merge 2 commits into
tinyfish-io:mainfrom
mueedx:fix/python-ci-lint-debt

Conversation

@mueedx

@mueedx mueedx commented Sep 30, 2026

Copy link
Copy Markdown

examples/python is not covered by CI. .github/workflows/python-precommit.yml

filters on examples/Python/** (capital P) but the directory is examples/python, and GitHub Actions path filters are case-sensitive, so the workflow has never run. The lint step also targeted application_examples examples, neither of which exists here.

A follow-up PR fixes the workflow paths. This PR clears the pre-existing debt it will surface so that PR can turn CI on green. Split deliberately: the debt here is unrelated to the path bug, and this change is mechanical and independently reviewable.

7 files touched:

  • news-aggregator/main.py: E1205 x2 resolved to f-strings (logging-format-style=new per .pylintrc:396), black reformatted trailing whitespace/indentation at lines 51-53

  • news-aggregator/main_sync.py: E1205 x2 resolved to f-strings

  • collect_paginated_ecommerce_listing_data/main.py: W1514 + W1309 on open(); black slice spacing

  • collect_paginated_news_headlines/main.py: W1514 on open()

  • compare_product_prices/async_main.py: black formatting (tuple unpacking, print collapse)

  • humanlike-antibot/main.py: isort import grouping

  • maps_scraper/main.py: isort import grouping

Note: news-aggregator/main.py:45-47 and compare_product_prices/async_main.py:47-49 contain the same broken async with await browser.new_context() pattern as .templates/python/template_async.py:21-23. This PR reformats those lines without fixing the bug; that is left as a separate contribution.

examples/python is not covered by CI. .github/workflows/python-precommit.yml

filters on examples/Python/** (capital P) but the directory is examples/python, and GitHub Actions path filters are case-sensitive, so the workflow has never run. The lint step also targeted application_examples examples, neither of which exists here.

A follow-up PR fixes the workflow paths. This PR clears the pre-existing debt it will surface so that PR can turn CI on green. Split deliberately: the debt here is unrelated to the path bug, and this change is mechanical and independently reviewable.

7 files touched:

- news-aggregator/main.py: E1205 x2 resolved to f-strings (logging-format-style=new per .pylintrc:396), black reformatted trailing whitespace/indentation at lines 51-53

- news-aggregator/main_sync.py: E1205 x2 resolved to f-strings

- collect_paginated_ecommerce_listing_data/main.py: W1514 + W1309 on open(); black slice spacing

- collect_paginated_news_headlines/main.py: W1514 on open()

- compare_product_prices/async_main.py: black formatting (tuple unpacking, print collapse)

- humanlike-antibot/main.py: isort import grouping

- maps_scraper/main.py: isort import grouping

Note: news-aggregator/main.py:45-47 and compare_product_prices/async_main.py:47-49 contain the same broken async with await browser.new_context() pattern as .templates/python/template_async.py:21-23. This PR reformats those lines without fixing the bug; that is left as a separate contribution.
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 0bc6c11c-4652-498b-ab24-34be26b3eeef

📥 Commits

Reviewing files that changed from the base of the PR and between e46b9d9 and 4472c49.

📒 Files selected for processing (7)
  • examples/python/collect_paginated_ecommerce_listing_data/main.py
  • examples/python/collect_paginated_news_headlines/main.py
  • examples/python/compare_product_prices/async_main.py
  • examples/python/humanlike-antibot/main.py
  • examples/python/maps_scraper/main.py
  • examples/python/news-aggregator/main.py
  • examples/python/news-aggregator/main_sync.py

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Two Python examples now specify UTF-8 when opening output files. The news aggregators use f-strings for log messages, with their message text unchanged. Other edits reorder imports or adjust code formatting without changing the described behavior or output.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 0402e

The examples gain consistent UTF-8 output and formatting without an identified behavioral regression. This change is mergeable after normal checks; existing workflow-path and browser-context issues remain outside its scope.

Architecture Summary

Architecture risk: 🟡 Medium · up to 4472c

The change affects 1 system.

Changed systems: examples

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — examples (service) was modified; 7 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in examples/python/collect_paginated_ecommerce_listing_data/main.py: The agentql and Playwright imports are reordered.
  • observed — Modified behavior in examples/python/collect_paginated_ecommerce_listing_data/main.py: The slice expression’s spacing is adjusted; its limit and behavior are unchanged.
  • observed — Modified behavior in examples/python/collect_paginated_ecommerce_listing_data/main.py: books.json is now opened with explicit UTF-8 encoding instead of the platform-default encoding.
  • observed — Modified behavior in examples/python/collect_paginated_news_headlines/main.py: The agentql and paginate imports now appear before the Playwright import; the imported names are unchanged.

Reliability and maintainability

  • inferred — Risk-relevant change factors for examples: blast_radius_1; direct_dependents_1
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the formatting and lint fixes in the affected examples/python files.
Description check ✅ Passed The description directly explains the formatting and lint fixes, the CI workflow context, the files changed, and the intentionally deferred async bug fix.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

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.

1 participant