Table of Contents
9. Retire Python Baseline and Complete Rust Cutover
Date: 2026-08-30
Status
Accepted
Context
Following the implementation of ADR-0008, MailSweep was ported to a high-performance synchronous Rust crate architecture.
During the migration phase, the legacy Python implementation (src/mailsweep/, test_mailsweep.py, scripts/forgejo.py, and pyproject.toml) was retained alongside the Rust codebase as an oracle and golden parity verification suite.
With 100% parity verified across all 66 Rust integration and unit tests (covering 13-language categorization heuristics, RFC MIME codecs, IMAP gateway, transactional attachment inspection, backup archives with SHA-256 verification, safety auditor, and Forgejo issue tracker tooling), the Python baseline has completed its migration lifecycle.
Retaining Python sources introduces unnecessary maintenance overhead, dual-stack dependency noise (uv.lock, pyproject.toml, __pycache__), and documentation ambiguity.
Decision
We have retired all Python code and standardized the repository entirely on native Rust:
-
Source Code Cleanup:
- Removed
src/mailsweep/directory and all Python domain modules. - Removed legacy test runner
test_mailsweep.py. - Removed
scripts/forgejo.pyin favor of the compiled Rust binarysrc/bin/forgejo.rs.
- Removed
-
Packaging and Dependency Cleanup:
- Removed Python packaging configurations (
pyproject.toml,uv.lock). - Cleaned up Python caches and virtual environment artifacts.
- Removed Python packaging configurations (
-
Documentation & Tooling Standardization:
- Updated documentation, CLI references, and examples to use
cargo run --or the compiledmailsweepbinary. - Replaced
docs/python-api.mdwithdocs/rust-api.mddocumenting the native Rust crate interface. - Updated Wiki synchronization workflow (
.forgejo/workflows/wiki-sync.yaml) and documentation index.
- Updated documentation, CLI references, and examples to use
Consequences
- Delivers a pure, single-language Rust repository with zero external runtime or Python dependencies.
- Eliminates dual-maintenance overhead and simplifies the build, test, and CI lifecycle to standard
cargoworkflows. - Retains full backward-compatible JSON schema interoperability for scan summaries, cleanup plans, and rulesets.
- Preserves all 13-language classification heuristics, safety tier hierarchies, and backup guarantees.