refactor: convert bsoup into an importable package with public API, full test coverage, and CI#1
Merged
Conversation
…ts, and updated docs Co-authored-by: lipnelz <174376617+lipnelz@users.noreply.github.com>
…tefacts Co-authored-by: lipnelz <174376617+lipnelz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Propose architecture improvements and update readme
refactor: convert bsoup into an importable package with public API and full test coverage
Mar 14, 2026
Owner
|
@copilot add test automatically run in pull request CI |
Co-authored-by: lipnelz <174376617+lipnelz@users.noreply.github.com>
Contributor
Author
Copilot
AI
changed the title
refactor: convert bsoup into an importable package with public API and full test coverage
refactor: convert bsoup into an importable package with public API, full test coverage, and CI
Mar 14, 2026
This file contains hidden or 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
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.
Single-file
bsoup.pyhad no package structure, no importable API, global mutable state, and zero tests. This PR restructures it as a proper Python package, exposes a clean async library interface, and adds a GitHub Actions CI pipeline.Package structure
bsoup/scraper.pyScraperclass +ScrapeResultdataclassbsoup/cli.pymain(),get_output_path())bsoup/__init__.pybsoup/__main__.pypython -m bsoupsupportArchitecture changes
semaphore— created per-batch insideScraper.scrape()insteadparse_pagewasasyncwith noawaits — renamed to synchronousparse_htmlmax_connections,decimal_sep,request_timeout,overall_timeout,retries) are nowScraperconstructor paramsPublic library API
Tests — 100 % coverage (40 tests)
tests/test_parser.pyparse_htmledge cases,ScrapeResult.to_csv_linetests/test_fetcher.pytests/test_scraper.pyscrape/scrape_to_csv, timeout cancellation, task exceptionstests/test_cli.pypyproject.tomlenforcesfail_under = 90.CI — GitHub Actions
Added
.github/workflows/ci.ymlwhich runs automatically on every push and pull request targetingmain:requirements.txtpytest --cov=bsoup— fails the build if coverage drops below 90 %coverage.xmlas a workflow artifact (retained 7 days)Original prompt
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.