A domain-specific language for web scraping, inspired by ParseHub
Project description
ParseHub DSL
ParseHub DSL is a bounded browser-automation DSL for structured web extraction.
Its officially supported runtime contract is:
- Playwright
- Chrome / Chromium-family browsers
The project is built around:
- a ParseHub-inspired interaction model
- a dedicated DSL grammar and compiler pipeline
- a Playwright-backed browser execution runtime
- a verified, bounded set of supported DSL examples and automation flows
The repo is no longer in broad modernization mode. Its latest bounded release mainline was:
release-to-1.0 convergence
That lane has now converged locally: the repo metadata and release-facing docs
are aligned on a bounded 1.0.1 stable-release posture for the already
supported modern DSL surface.
Current posture
- Phase 1: complete
- Phase 2: closeout documented; the former config-string runtime boundary is now closed by proof
- Phase 3: capability promotion review is complete
- Phase 4: docs / workflow / release-surface convergence is complete
- Post-Phase-4 bounded follow-ups: semantic authority, runtime authority, browser-confidence hardening, compiler/runtime hardening, and release-readiness slices are complete
- Latest bounded operator-surface expansion: local profile/session management now includes the closed RFC-anchored Phase 3 successor lane (
config.session_profiledefault-profile selection + shared cross-profile session query seam; metadata indexing remains deferred behind the scale gate) - Latest closed release lane:
release-to-1.0-convergence - Current repo metadata:
parsehub-dsl==1.0.1/Production/Stable - Latest externally published artifact:
parsehub-dsl==1.0.0(the next repo-side patch target is1.0.1) - Historical prior publication milestone:
parsehub-dsl==0.2.0b1 - Publication rule: repo verification now targets
1.0.1, while external stable publication remains a separate operator action; the latest published artifact stays1.0.0until that upload completes
Runtime support contract
ParseHub DSL is not positioned as a general-purpose “automate anything on any website” platform.
The current official support contract is narrower:
- supported runtime: Playwright
- supported browser family: Chrome / Chromium-family
- supported automation surface: the bounded DSL surface verified by this repository
- supported browser-confidence proof lane: deterministic local headless browser verification
Important note:
- the repository may retain internal browser abstractions for testing and architecture
- those internal seams do not imply public support for Selenium, Firefox, WebKit, or general multi-backend parity
- the current verified browser-confidence lane installs and launches Chromium via Playwright
- stealth-related code paths and flags remain optional and best-effort; they do not widen the support contract or create anti-bot / CAPTCHA / platform-defense success guarantees
Runtime operator controls
The supported operator surface is still bounded, but it includes practical runtime controls:
--locale,--timezone-id, and--user-agentfor browser-context shaping--browser-channeland--browser-executablefor local Chromium-family launches--cdp-urlto attach to an existing Chromium CDP endpoint instead of launching a local browser--disable-resources,--block-domain, and--extra-headerfor bounded request-layer control--disable-stealthfor turning off optional best-effort stealth tweaks--profile,--session, and--profile-rootfor local profile/session-backed runsparsehub profile .../parsehub session ...for local profile/session lifecycle management
Important operator notes:
--browser-channeland--browser-executableare launch-only controls; they do not apply when--cdp-urlis used--headedis a local debugging toggle for a local Playwright launch; it does not widen the supported proof story beyond the deterministic local headless browser-confidence lane- these controls improve operator ergonomics and reproducibility, but they do not create public-site reliability, anti-bot, or multi-browser parity guarantees
Stable-release posture
Use these files as the authority chain:
docs/START_HERE.mddocs/README.mddocs/CURRENT_STATUS.mddocs/ROADMAP.mddocs/RELEASE_CONTRACT.mddocs/SUPPORT_POLICY.mdCHANGELOG.mddocs/EXPRESSION_MODEL.mddocs/CAPABILITY_MATRIX.mddocs/OMX_WORKING_CONVENTION.mddocs/PROFILE_SESSION_ENVIRONMENT_MANUAL.mdas the primary user-manual + design-appendix packagedocs/PROFILE_SESSION_ENVIRONMENT_GUIDE.mdas a secondary companion for the full conceptual and CLI relationshipdocs/PROFILE_SESSION_ENVIRONMENT_QUICKSTART.mdas a secondary companion for the shortest operator pathdocs/PROFILE_SESSION_ENVIRONMENT_DOMAIN_MODEL.mdas a secondary companion for the designer-facing modeldocs/encoding.md(when diagnosing DSL/config/source-file encoding issues)
Additional operator references:
docs/SUPPORTED_EXAMPLES.mddocs/PARAMETER_INPUTS.mddocs/TEST_LANES.mdexamples/USAGE_GUIDE.md
Install
Recommended: editable install
cd F:/parsehub/parsehub-dsl
python -m venv .venv
.venv\Scripts\activate
pip install -e ".[dev]"
python -m playwright install chromium
Alternative: requirements + editable package
cd F:/parsehub/parsehub-dsl
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
python -m playwright install chromium
pip install -e .
Fast operator path
Installed CLI help
parsehub --help
Smallest supported execution path
parsehub example_simple.ph
Persist the full structured result
parsehub example_simple.ph --output json --output-file temp/example_simple.json
Create a local profile and capture a reusable login session
parsehub profile create demo_profile --name "Demo Profile" --login-url https://example.com/login
parsehub session login demo_profile
parsehub session verify sess_... --profile demo_profile
parsehub session export sess_... --profile demo_profile --output-dir temp/session-export
parsehub authenticated.ph --profile demo_profile
Use docs/PROFILE_SESSION_ENVIRONMENT_MANUAL.md as the primary authority
for this topic. docs/PROFILES_AND_SESSIONS.md remains the specialized
companion for storage/lifecycle/verification/export semantics, while the guide,
quickstart, and domain-model docs remain secondary companions for narrower
reading paths.
Manual login capture also supports bounded overrides such as --locale,
--timezone-id, --user-agent, --browser-channel, --browser-executable,
--disable-resources, repeated --extra-header, repeated --block-domain,
and --disable-stealth.
Inspect parameter metadata without running the browser
parsehub examples/parameter_demo_current.ph --params-help
python -m parsehub.cli examples/parameter_demo_current.ph --params-help
Module entry is the development fallback after editable install (or with
PYTHONPATH=src set). The installed parsehub console script is the canonical
release-facing operator path.
Output behavior
The CLI now has two distinct output surfaces:
- stdout preview
- human-readable execution summary
- grouped preview of collected rows
- suitable for quick inspection
--output-filepersisted result- full structured JSON or CSV output
- suitable for downstream processing or saved artifacts
Important rule:
--outputcontrols the format of--output-file- stdout remains a human-readable preview rather than raw JSON/CSV
DSL source-file encoding contract
- ParseHub DSL source files (
.ph) are read as UTF-8 - files saved as UTF-8 with BOM are also accepted
- UTF-8 remains the only supported source-file encoding contract
- non-UTF-8
.phfiles produce an explicitsave the .ph file as UTF-8guidance message - non-UTF-8
--configJSON files produce an explicitsave the .json file as UTF-8guidance message - non-UTF-8 internal grammar/resource files are reported as an internal install/project-file integrity problem rather than user DSL input drift
Default verification commands
Stable smoke baseline
pytest
Broader regression bundle
python run_phase1_regressions.py
Required release gates
python scripts/release/run_release_gates.py
Fresh-venv install / CLI / compile / run happy path
python scripts/release/run_release_happy_path.py
Publish-surface verification before manual release
python scripts/release/run_publish_surface_check.py
Explicit browser-confidence lane
pytest tests/runtime/test_playwright_driver.py tests/runtime/test_e2e_execution.py -m browser_confidence -q
Interpretation:
pytestis the stable default baselinepython run_phase1_regressions.pyis the broader verified safety netpython scripts/release/run_release_gates.pyis the repo-owned release gate runner- the browser-confidence lane remains non-default for plain
pytest - the same browser-confidence lane is now also invoked explicitly by release-gate automation
- the current explicit proof lane is Playwright-backed and uses locally installed Chromium
python scripts/release/run_publish_surface_check.pyvalidates the stable-release package artifacts and metadata locally- none of these commands imply public-site scraping reliability
Supported example quickstart
Representative supported examples include:
simple.phproduct_list.phnested_data.phpipe_functions_demo.phelse_branch_demo.phsimple_param_test.phenhanced_click_demo.phlabel_system_demo.phwait_time_units_demo.phenhanced_click_demo_current.phlabel_system_demo_current.phwait_time_units_demo_current.phparameter_demo_current.phtemplate_data_flow_current.phsearch_interaction_scroll_current.phruntime_engine_authority_current.ph
Useful compile commands:
python compile.py examples/parameter_demo_current.ph --verbose
python compile.py examples/template_data_flow_current.ph --verbose
See docs/SUPPORTED_EXAMPLES.md for the verified example-by-example guidance.
Known boundaries
The current release target is intentionally bounded.
Still out of scope:
- public-site scraping reliability guarantees
- headed/manual browser execution as a default guarantee
- anti-bot / CAPTCHA / stealth success guarantees
- stealth-related code paths, flags, or tests as a contract-widening signal
- official multi-browser runtime parity across Chrome / Firefox / WebKit
- official Selenium runtime support
- YAML config support
- legacy inline globals such as
global counter = 0 - legacy dollar-ref syntax such as
$counter - legacy parameter aliases such as
number/boolean
Docs
- start here / current project reality
- docs index
- current status snapshot
- roadmap / active next-step authority
- release contract / stable-release target
- support policy / runtime support contract
- changelog / release-facing history
- expression model / runtime contract
- capability matrix
- OMX working convention / repo-root workflow
- test lanes / verification surfaces
- supported examples quickstart
- parameter inputs and precedence
- profiles and sessions
- examples usage guide
- root-level legacy tests cleanup note
- legacy syntax migration guide
Repository layout
parsehub-dsl/
├── src/parsehub/ # grammar, parser, semantic analysis, IR, runtime, codegen
├── tests/ # smoke / integration / runtime verification lanes
├── examples/ # supported and historical DSL examples
├── docs/ # repo-visible authority docs
├── scripts/ # release, verification, and maintenance scripts
├── .github/ # CI / workflow configuration
├── compile.py # compile / natural-language generation entrypoint
├── run_phase1_regressions.py
└── README.md
Practical next-step rule
When in doubt:
- trust executable evidence first
- trust top-level current-facts docs second
- preserve the bounded release target
- start any widened work from a new bounded plan instead of silently reopening old lanes
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 parsehub_dsl-1.0.1.tar.gz.
File metadata
- Download URL: parsehub_dsl-1.0.1.tar.gz
- Upload date:
- Size: 182.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bad18131d4dd1e62c3ceb53aa485aa24a670b4a850ab5481aa72681fe966f85a
|
|
| MD5 |
ca444f21e512c7530f334f304d539d13
|
|
| BLAKE2b-256 |
751c6ca49d67aa2640ed92b92271520527ded4ab4633c93554632937e6d2d694
|
File details
Details for the file parsehub_dsl-1.0.1-py3-none-any.whl.
File metadata
- Download URL: parsehub_dsl-1.0.1-py3-none-any.whl
- Upload date:
- Size: 163.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
371c428259db1fad0c7c9152fa08dffe8d4475208328a65a4aebb8a6c47bea02
|
|
| MD5 |
35f80ce7e8370db131bad7b2519f00ad
|
|
| BLAKE2b-256 |
7c856e68342d28dc0ad10cc1b0f587c252fb29177dc6c1fd031ee2c34e3369ad
|