Standalone website discovery, fetching, parsing, and adapter contracts.
Project description
websource
Standalone website discovery, fetching, parsing, rendering, content extraction, structured extraction, refresh checking, and adapter contracts.
websource is built around strict Pydantic models and protocol interfaces. The
foundation layer owns value objects, enums, request/result models, adapter
descriptors, protocol interfaces, and error contracts. Runtime HTTP, browser,
provider, and website-specific adapters sit outside websource.foundation.
Structured extraction is modeled separately from readable content extraction, so article markdown, recipes, product records, property listings, vehicle ads, jobs, events, and custom schemas can share one transport contract without forcing every page into an article-shaped model.
Install
pip install websource
Optional browser rendering uses Playwright:
pip install "websource[browser]"
python -m playwright install chromium
For local development:
uv sync --all-extras --group dev
uv run --group dev pytest
CLI
websource adapters list --json
websource inspect https://example.com --json
websource discover https://example.com --mode crawl --max-depth 1 --jsonl
websource fetch https://example.com --json
websource fixture replay tests/fixtures/sites/example.com/article.html --url https://example.com/articles/one --json
websource provider run tavily tavily-http https://api.tavily.example/extract extract --input-url https://example.com/article --param schema=article --json
The CLI emits JSON envelopes for validation and runtime errors so agents and
automation can handle failures deterministically.
inspect performs a shallow seed URL probe: robots facts and verified source
hints stay in fields such as robots.sitemap_urls and sitemap_urls, while
unverified conventional fallbacks are labeled as candidate_sitemap_urls.
When no sitemap hint has been verified, sitemap_urls is null, not [].
Use inspect --include-http-headers to append request and response headers for
the HTTP exchanges made during inspection.
Python API
from websource.adapters import DefaultWebsiteClient
from websource.foundation import FetchRequest
client = DefaultWebsiteClient()
result = await client.fetch(FetchRequest(url="https://example.com"))
page = await client.parse_page(result)
content = await client.extract_content(page)
Custom adapters can subclass SiteSpecificAdapter and advertise only the
capabilities they override. Managed providers can use
HttpManagedProviderAdapter while provider-specific packages stabilize.
Built-in vertical schemas are available through websource.schemas for recipes,
products, property listings, vehicle listings, job postings, and events.
Release Checks
uv run --group dev ruff check src tests
uv run --group dev mypy src tests
uv run --group dev pytest
uv run --group dev bandit -r src
uv build
scripts/verify-package-install.sh
Documentation
- Docs index
- Foundation contracts
- Website client architecture
- Adapter design
- CLI and tool surface
- Vertical schemas
- JSON schemas
- Release policy
- Implementation plan
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file websource-0.1.2.tar.gz.
File metadata
- Download URL: websource-0.1.2.tar.gz
- Upload date:
- Size: 115.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5971f8684d5c41e5e7d010c3c18d72986c11a613f64469dbd19ed21bb408a15
|
|
| MD5 |
b8b6cbfa18ae694f2b809ab903379943
|
|
| BLAKE2b-256 |
20d36b2d98abdef0f4dd1393a63827f05e28fa223a91c645d00de0a09a08dd16
|
Provenance
The following attestation bundles were made for websource-0.1.2.tar.gz:
Publisher:
publish.yml on romamo/websource
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
websource-0.1.2.tar.gz -
Subject digest:
d5971f8684d5c41e5e7d010c3c18d72986c11a613f64469dbd19ed21bb408a15 - Sigstore transparency entry: 2129033714
- Sigstore integration time:
-
Permalink:
romamo/websource@c6b06d5f1e76f15f505fa68e0fbbcd1c7ca129b6 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/romamo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c6b06d5f1e76f15f505fa68e0fbbcd1c7ca129b6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file websource-0.1.2-py3-none-any.whl.
File metadata
- Download URL: websource-0.1.2-py3-none-any.whl
- Upload date:
- Size: 82.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d9069f6c401e026cf941618243ae7a02e5f0044addaccfff6438247bd9ff150
|
|
| MD5 |
82de7ef4bf64778cbf7729e72296b015
|
|
| BLAKE2b-256 |
c1f31686d4a015753ff38b4abdcbe9381ae5de81816fb4e6ebf9826705e1d753
|
Provenance
The following attestation bundles were made for websource-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on romamo/websource
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
websource-0.1.2-py3-none-any.whl -
Subject digest:
9d9069f6c401e026cf941618243ae7a02e5f0044addaccfff6438247bd9ff150 - Sigstore transparency entry: 2129034114
- Sigstore integration time:
-
Permalink:
romamo/websource@c6b06d5f1e76f15f505fa68e0fbbcd1c7ca129b6 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/romamo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c6b06d5f1e76f15f505fa68e0fbbcd1c7ca129b6 -
Trigger Event:
release
-
Statement type: