ScrollWeave — Python library backed by Rust (zero third-party runtime dependencies)
A Python library with a Rust-only algorithmic core. Import with import scrollweave. Both Cargo dependencies and Python runtime dependencies are empty. Native build requires rustc/cargo and a working linker; Python 3.10+.
Verification status (2026-10-30, Windows, Rust 1.93.1, Python 3.12.7):
cargo test --workspace --all-targetspasses (31 tests),python -m unittest discover -s tests/pythonpasses (26 tests),pip install .builds and loads the native wheel,tools/smoke_test.pypasses against both the source tree and the installed wheel, andfixtures/shot_01..03.pngreconstructfixtures/expected_long.pngbyte-exactly with positions0,90,180(MAE 0, height difference 0). The 15-frame regression suite also runs: truth 512x3306, output 512x3307, missing 0; MAE 0.1267 / exact 99.819% with masks and MAE 0.1822 / exact 99.728% without masks. A separate six-scenario headless-browser regression (fixed headers/sidebars, 2-3 scrolling frames) auto-detected the content region and produced clean content with MAE 0.01-0.03 after page padding. A 3px horizontal capture drift between real web frames is now estimated and removed before reconstruction, including when an explicitViewportis supplied, eliminating doubled text in the overlap. Byte-exact parity with the research Python prototype, 30/UI/Japanese suites and other platforms remain unverified. Treat this as a tested release for the shipped and 15-frame fixtures, not a production-certified binary.
Quick start
python -m pip install scrollweave
python -c "import scrollweave; print(scrollweave.__version__)"
The PyPI wheel bundles the platform-specific native dynamic library, so there is no
pip install numpy pillow scipy ... step. When no wheel exists for your platform,
pip builds the source distribution locally and therefore needs Rust/Cargo and a
working linker.
From a checkout, install and validate the native algorithms with:
python -m pip install .
cargo test --workspace
python -m unittest discover -s tests/python -v
Main Python API
The public API has one function per domain: reconstruction, planning and layout.
from scrollweave import (
Goal,
Image,
LayeredOptions,
PlanOptions,
PriorMasks,
Viewport,
compose,
plan_views,
stitch_basic,
stitch_layered,
)
# Layered reconstruction requires vertical scroll positions.
r = stitch_layered(
['001.png', '002.png', '003.png'],
scroll=[0, 195, 390],
viewport=Viewport(87, 681),
options=LayeredOptions(segmentation='temporal'),
diagnostics=True,
)
r.save('merged.png')
r.save_debug('diagnostics')
print(r.scroll, r.viewport, r.geometry_mode)
print(r.support_fraction, r.unverified_fraction)
# Omit viewport when the screenshots contain a fixed web header/sidebar.
# The native planner detects persistent full-width/full-height chrome and crops
# it before reconstruction:
auto = stitch_layered(['001.png', '002.png', '003.png'], scroll=[0, 195, 390])
auto.save('merged_content.png')
# Planning is a separate domain operation.
repair = plan_views(r, PlanOptions(count=3, goal=Goal.REPAIR))
verification = plan_views(r, PlanOptions(count=2, goal=Goal.VERIFICATION))
# Basic 2D alignment/compositing remains available as a separate entry point.
basic = stitch_basic(
['001.png', '002.png', '003.png'],
positions=[0, 195, 390],
viewport=Viewport(0, 720),
)
# Prior masks are validated domain objects, not bare N*H*W bytes.
masks = PriorMasks(
width=760,
height=512,
frames=(bytes(760 * 512),) * 3,
)
layered = stitch_layered(
['001.png', '002.png', '003.png'],
scroll=[0, 195, 390],
viewport=Viewport(87, 681),
options=LayeredOptions(recurrent_mask=masks, flat_mask=masks),
)
# Compose is independent of stitching.
compose(['001.png', '002.png'], layout='vertical').save('vertical.png')
# In-memory RGB frames (only Python built-ins, no Pillow / NumPy)
frame = Image(width=32, height=32, rgb=b'\xff\x00\x00' * (32 * 32))
Viewport(top=..., bottom=..., left=..., right=...) uses source-frame coordinates;
bottom and right are exclusive. Passing a viewport disables automatic fixed-chrome
detection and uses exactly the supplied band/region. Omitting it lets the native
layer detect a persistent header/sidebar and infer the scroll viewport automatically.
Result model
BasicResult contains image, positions, viewport, graph,
support_fraction, unverified_fraction and optional diagnostics.
LayeredResult contains image, scroll, viewport, geometry_mode,
support_fraction, unverified_fraction, and nested objects:
evidence:source_ids,support,views,conflict,unverified,invalid_source,estimated_ui,ui_probability,rejected_prior_rowsdiagnostics(opt-in):coverage,confidence,provenance,screen_mask
Planner output is returned by plan_views() as ViewSuggestion values; it is not
embedded in the reconstruction result. Evidence flags do not mean pixels are
correct or incorrect; missing content is never invented, and all output pixels at
observed locations are copied from original input RGB buffers.
CLI
python -m scrollweave stitch 001.png 002.png 003.png -o merged.png \
--positions 0,195,390 --viewport 87:681 --debug-dir debug \
--recommend-views 2 --recommend-repair-views 2
python -m scrollweave stitch 001.png 002.png 003.png -o merged.png \
--algorithm basic --positions 0,195,390
python -m scrollweave compose a.png b.png -o combined.png --layout horizontal
The Rust package scrollweave-cli builds a scrollweave binary; the native FFI
cdylib is named scrollweave_ffi. The Python console command is also scrollweave.
Source layout / modules
| Rust module | Research capability it addresses |
|---|---|
align.rs, graph.rs |
Image-derived integer scroll offsets, overlap graph, robust pose optimization |
geometry.rs |
Persistent screen-border detection + activity-envelope fallback |
evidence.rs |
Independent position support, conflict and unverified maps; duplicate-view disambiguation |
layered.rs |
Automatic horizontal capture-drift registration, fixed-header/sidebar content-region detection, rectangular frame cropping, document/screen evidence, transient candidates, morphology, appearance histogram, side rails, prior calibration, original pixel source selection |
graphcut.rs |
Optional binary grid Potts mincut via pure Rust Dinic (experimental) |
planner.rs |
Verification suggestions and expected repair suggestions |
crates/scrollweave-ffi/src/lib.rs |
C ABI v5 to Python; buffers allocated and freed in Rust |
codec.rs |
PNG (8-bit, non-interlaced), BMP24, PPM P6; raw RGB via C ABI |
Important scope and mathematical limits
- This is a Rust reimplementation of the Python research algorithms, not the Python research functions executed behind a thin Rust shell. Core operations are fully Rust; Python manages paths, arguments and copying result buffers.
- It follows the layered default behaviors / major research branches, not line-for-line numerical reproduction. The Gaussian appearance filter, morphology, graphcut solver, edge statistics and source scoring have approximations/differences. Exact pixel parity is not yet verified. Refer to
docs/PORT_STATUS.md. - The default layered algorithm is a layered RGB reconstruction method, not verified high-accuracy removal of all dynamic UI. Motion-tracked arbitrary moving object segmentation and OCR are not present in the original working default path, and are not asserted here.
- The layered compositor handles vertically scrolling same-width/same-height frames and estimates small horizontal capture drift before reconstruction. Arbitrary 2D translation remains the basic matcher's job; the layered path explicitly rejects user-supplied horizontal offsets.
- When scroll positions are not supplied, the older Rust feature/graph matcher estimates them. It is not guaranteed on heavy occlusion or near-blank screenshots and may decline input.
- JPEG, HEIC and MP4 decoders are not included. Convert externally to PNG or supply raw RGB
Imageobjects. No OCR or trained AI model. - Native behavior is verified by the tests and shipped fixtures above. No improvement over the research Python prototype is claimed, and automatic matcher results on periodic content can be ambiguous.
Test and independent evidence
cargo test --workspace # Must run on a Rust-equipped machine
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
python -m ruff format --check .
python -m ruff check .
python -m unittest discover -s tests/python -v
python tools/smoke_test.py # installed-package end-to-end smoke test
python tools/benchmark_native.py --truth fixtures/expected_long.png \
--positions 0,90,180 fixtures/shot_01.png fixtures/shot_02.png fixtures/shot_03.png
research/reference/ stores a development-only frozen Python research reference for future parity work; it is not imported or installed by ScrollWeave, and its scientific packages are neither runtime nor build dependencies of this Rust-backed library.
Release publishing
Publishing a GitHub Release runs .github/workflows/publish.yml. The workflow verifies
that the release tag matches the package version, builds the source distribution and
platform wheels for Linux/Windows/macOS, runs twine check, and uploads through PyPI
Trusted Publishing. Configure the PyPI trusted publisher once for owner xtr-hub,
repository scrollweave, workflow publish.yml (no environment). Subsequent releases
publish automatically.
MIT license.
Reproduce the original 15-frame UI pressure test (full regression ZIP)
After installing the package and extracting the full regression ZIP:
python tools/benchmark_native.py --suite benchmark_data/starry \
--recurrent-mask benchmark_data/starry/recurrent_mask.bin \
--flat-mask benchmark_data/starry/flat_mask.bin \
--viewport 90:678 --output reconstructed.png --metrics measured.json
The mask files are development fixtures derived from the original observed test screenshots, not automatically learned from input on this call. For a mask-free experiment omit both flags. The benchmark checks the entire ground-truth page and reports height error explicitly; it does not silently crop to the overlap. The shipped fixture was run on Windows on 2026-10-29: positions 0,90,180 produced an exact 120x330 page (MAE 0).
Metadata
Release files for scrollweave 0.9.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scrollweave-0.9.2.tar.gz | 195.5 kB | With provenance | Details for scrollweave-0.9.2.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scrollweave-0.9.2-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for scrollweave-0.9.2-py3-none-win_amd64.whl |
| scrollweave-0.9.2-py3-none-manylinux_2_34_x86_64.whl | Python 3 | none | Linux glibc 2.34+ x86-64 | Details for scrollweave-0.9.2-py3-none-manylinux_2_34_x86_64.whl |
| scrollweave-0.9.2-py3-none-macosx_10_13_universal2.whl | Python 3 | none | macOS 10.13+ universal2 (ARM64, x86-64) | Details for scrollweave-0.9.2-py3-none-macosx_10_13_universal2.whl |
Total release size: 1.2 MB
Release files / scrollweave-0.9.2.tar.gz
| Download URL | scrollweave-0.9.2.tar.gz |
|---|---|
| Size | 195.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed5ad2b48800588c9eb4d87e3c63a195185e8f449cc4f6dcfb14d8738c95d5a2
|
|
BLAKE2b-256 checksum How to use checksums |
c27b0d2f38f5883faa5d5deddeb2379455a7a73c67acc4002fd29ec9e38d12a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / scrollweave-0.9.2-py3-none-win_amd64.whl
| Download URL | scrollweave-0.9.2-py3-none-win_amd64.whl |
|---|---|
| Size | 254.7 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
41c7b0f10407e2faabde6b625a7f7a1d3c047b261de38b7a2a5983e8d613766d
|
|
BLAKE2b-256 checksum How to use checksums |
dcfc87f76579a50200a73bc77a3ead1dca00e1c1f73a78c402232c82bdcff95d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / scrollweave-0.9.2-py3-none-manylinux_2_34_x86_64.whl
| Download URL | scrollweave-0.9.2-py3-none-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 378.4 kB |
| Tags | Linux glibc 2.34+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
1cbf0c9104b92bca10cf680b616f0bb53e7371a49b766f94c77512e5cdd0058d
|
|
BLAKE2b-256 checksum How to use checksums |
79d26d3d4dfb6b4b79e6d2083f7dc99e3f572bcd29d42823e0012ba74584e092
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / scrollweave-0.9.2-py3-none-macosx_10_13_universal2.whl
| Download URL | scrollweave-0.9.2-py3-none-macosx_10_13_universal2.whl |
|---|---|
| Size | 330.3 kB |
| Tags | Python 3 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
d45e20252cbaa76bdd0dc3dd6528287d48be3d255bbeeda8b5738729a2885bee
|
|
BLAKE2b-256 checksum How to use checksums |
c92c7e4a0ad99d13f5cd750cdc2bce85b026bf410a2d37efb6efd33bb49fbce7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for scrollweave 0.9.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 4 files in this release have been uploaded with provenance metadata.
Attestation for scrollweave-0.9.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.