Enterprise-grade remote directory mirroring tool with adaptive concurrency, integrity checks, and SSRF-hardened transport.
Project description
MirrorURL
Enterprise-grade remote directory mirroring tool. MirrorURL recursively discovers files behind an HTTP(S) directory listing and mirrors them locally with adaptive concurrency, resumable/partial downloads, integrity verification, and an SSRF-hardened transport layer.
Status: Refactor complete. The full implementation now lives in the
src/mirror_url/package (30 modules), migrated verbatim from the original single-file script perREFACTORING_PLAN.md. The legacymirror_url.pyis retained only as a frozen reference and can be deleted once you've run the test suite against the package in an environment with the runtime dependencies installed (see Development).
Features
- Recursive discovery of remote directory trees (BFS, depth/exclude limits, cycle-safe).
- True parallel downloads — multiple files and multiple chunks per file concurrently.
- Adaptive async concurrency that tunes itself to server RTT, throughput, and error rate.
- Resumable & partial downloads with HTTP range requests and chunk assembly.
- Integrity checks — size/timestamp comparison, ETag handling, content hashing.
- Resilience — per-domain circuit breakers, exponential backoff, rate limiting.
- Security — path-traversal and symlink-bomb defenses, private-IP/SSRF guards, URL-scope enforcement.
- Operability — metrics collection, multi-level progress, optional HTTP health-check server.
- Caching — filesystem and disk-backed indexes to skip unchanged content.
Installation
# From source (editable, recommended during the refactor)
pip install -e ".[all,dev]"
Python 3.9+ is required. Core dependencies: httpx, pydantic (v2), PyYAML.
Optional extras: fast (stringzilla, lxml), progress (tqdm), monitor (psutil).
Usage
Run via the console entry point or the module:
mirror-url https://example.com/files/ --output ./mirror
# or
python -m mirror_url https://example.com/files/ --output ./mirror
Run mirror-url --help for the full option list.
Configuration can also be supplied via a YAML file (see MirrorConfig /
load_config_from_args).
📖 Full documentation: see the User Guide (HTML version) for detailed installation, CLI reference, config-file format, download modes, security notes, the Python API, and troubleshooting.
🛠 Contributing to the code? The Developer Guide
(HTML version) is an architecture deep-dive:
dependency layers, the MirrorURL mixin design, runtime data flow, and
step-by-step extension recipes.
Development
pip install -e ".[dev]"
pre-commit install
ruff check . # lint
black --check . # format check
mypy # type-check the new package
pytest -m "not integration" # fast test lane
pytest # full suite (includes integration)
Continuous integration runs lint + tests across Python 3.9–3.12 (see
.github/workflows/ci.yml).
Project layout
src/mirror_url/ # the package (30 modules, dependency-layered)
tests/ # pytest suite
mirror_url.py # legacy monolith (frozen reference, pending removal)
REFACTORING_PLAN.md # module breakdown + migration roadmap
CHANGELOG.md # notable changes (Keep a Changelog format)
CONTRIBUTING.md # dev setup, checks, conventions
pyproject.toml # packaging, deps, tool config
Contributing
Contributions are welcome — see CONTRIBUTING.md for the dev setup, the checks CI runs, and the project conventions (dependency layering, lint policy, behavior-preserving refactors). Notable changes are tracked in CHANGELOG.md.
License
MIT © BP
Project details
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 mirror_url-3.1.15.tar.gz.
File metadata
- Download URL: mirror_url-3.1.15.tar.gz
- Upload date:
- Size: 168.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07e467db086aa8dbbb12b9d236f485825f28e20543469fbf4d4f7bb6071710cd
|
|
| MD5 |
f487c4ea688b955f12cb83b8fc106232
|
|
| BLAKE2b-256 |
12fc70fdb568bb07d60c8f8c55e29e0698d14b8c4b3c5eeeb56a49fe9d9efc32
|
Provenance
The following attestation bundles were made for mirror_url-3.1.15.tar.gz:
Publisher:
release.yml on bpodlipnik/mirror-url
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mirror_url-3.1.15.tar.gz -
Subject digest:
07e467db086aa8dbbb12b9d236f485825f28e20543469fbf4d4f7bb6071710cd - Sigstore transparency entry: 2063565226
- Sigstore integration time:
-
Permalink:
bpodlipnik/mirror-url@1f898e898558f4680a3eeb62d9ccacc3577202e4 -
Branch / Tag:
refs/tags/v3.1.15 - Owner: https://github.com/bpodlipnik
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1f898e898558f4680a3eeb62d9ccacc3577202e4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mirror_url-3.1.15-py3-none-any.whl.
File metadata
- Download URL: mirror_url-3.1.15-py3-none-any.whl
- Upload date:
- Size: 177.8 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 |
dce1812e0134d362e8e9e5e2c9e70469ae0327ca66995b1ce5d7d86ea7b9d1a4
|
|
| MD5 |
0aa6e906f85be1b0cb981920f9e1ef96
|
|
| BLAKE2b-256 |
5f74043b7b6c1406bee3f9f4824c35a28cfbd01bc09f0f33181cd4e43e64afc6
|
Provenance
The following attestation bundles were made for mirror_url-3.1.15-py3-none-any.whl:
Publisher:
release.yml on bpodlipnik/mirror-url
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mirror_url-3.1.15-py3-none-any.whl -
Subject digest:
dce1812e0134d362e8e9e5e2c9e70469ae0327ca66995b1ce5d7d86ea7b9d1a4 - Sigstore transparency entry: 2063565240
- Sigstore integration time:
-
Permalink:
bpodlipnik/mirror-url@1f898e898558f4680a3eeb62d9ccacc3577202e4 -
Branch / Tag:
refs/tags/v3.1.15 - Owner: https://github.com/bpodlipnik
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1f898e898558f4680a3eeb62d9ccacc3577202e4 -
Trigger Event:
push
-
Statement type: