Skip to content

Rewrite in Rust with PyPI binary distribution - #7

Merged
laiso merged 3 commits into
mainfrom
rust-impl
Mar 21, 2026
Merged

Rewrite in Rust with PyPI binary distribution#7
laiso merged 3 commits into
mainfrom
rust-impl

Conversation

@laiso

@laiso laiso commented Mar 21, 2026

Copy link
Copy Markdown
Owner

Summary

Rewrite the Python implementation in Rust and add PyPI binary distribution.

Background: ISSUE.md — remove wget dependency, 5x faster conversion pipeline, single-binary distribution

Changes

  • Rust implementation (src/) — reqwest/tokio async crawler, scraper/htmd converter, zip packager
  • PyPI distribution (python/) — thin wrapper bundling Rust binary in wheel
  • Delete Python implementation (site2skill/, test_*.py)
  • Security fix — path traversal vulnerability, url_to_file_path extension bug
  • Code quality — lazy_static! regex caching, unified URL filter logic, memory accumulation fix
  • Test expansion — 15 → 49 unit tests + 2 doc tests

Benchmark (100 pages, conversion pipeline)

Python Rust Ratio
Wall time 0.77s 0.15s 5.1x
Peak memory 34MB 11MB 3.1x

Test plan

  • cargo test — 49 tests + 2 doc tests pass, zero warnings
  • Benchmark measured (scripts/generate_bench_site.py + --skip-fetch)
  • Linux build verification
  • pip install wheel verification

🤖 Generated with Claude Code

@laiso
laiso force-pushed the rust-impl branch 2 times, most recently from 268f095 to 20a6b1d Compare March 21, 2026 07:37
Why: ISSUE.md — wget dependency removal, 5x faster conversion pipeline,
single-binary distribution via PyPI wheel.

- Replace Python site2skill/ with Rust src/ (reqwest/tokio crawler,
  scraper/htmd converter, zip packager)
- Add python/ wrapper for PyPI binary distribution (sqlite-scanner pattern)
- Fix path traversal vulnerability in skill structure generation
- Fix url_to_file_path extension bug, unify URL scope filtering
- Cache all regex with lazy_static, eliminate memory accumulation in crawler
- Add 34 regression tests (15 → 49 unit + 2 doc tests)
- Add benchmark tooling (scripts/generate_bench_site.py, run_benchmark.py)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
laiso and others added 2 commits March 21, 2026 14:43
- Add GHA release workflow: builds wheels for linux x86_64/aarch64,
  macOS arm64/x86_64, publishes to PyPI on tag push
- Bump version to 0.2.0-beta.1 (pre-release, pip install --pre)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@laiso
laiso merged commit 8450611 into main Mar 21, 2026
1 check passed
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