web-snapshot-cli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ python-version: ["3.10", "3.11", "3.12"]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install package and dev dependencies
26
+ run: pip install -e ".[dev]"
27
+
28
+ - name: Ruff
29
+ run: ruff check src tests
30
+
31
+ - name: Ruff format
32
+ run: ruff format --check src tests
33
+
34
+ - name: Pytest
35
+ run: pytest
@@ -0,0 +1,64 @@
1
+ # PyPI project: web-snapshot-cli
2
+ # Trusted publisher: owner codingsushi79, repo Snapshot, workflow publish.yml, env pypi
3
+ name: Publish to PyPI
4
+
5
+ on:
6
+ release:
7
+ types: [published]
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.12"
22
+
23
+ - name: Install package and dev dependencies
24
+ run: pip install -e ".[dev]"
25
+
26
+ - name: Ruff
27
+ run: ruff check src tests
28
+
29
+ - name: Pytest
30
+ run: pytest
31
+
32
+ build:
33
+ needs: test
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - uses: actions/checkout@v4
37
+
38
+ - uses: actions/setup-python@v5
39
+ with:
40
+ python-version: "3.12"
41
+
42
+ - name: Build sdist and wheel
43
+ run: |
44
+ pip install build
45
+ python -m build
46
+
47
+ - uses: actions/upload-artifact@v4
48
+ with:
49
+ name: dist
50
+ path: dist/
51
+
52
+ publish:
53
+ needs: build
54
+ runs-on: ubuntu-latest
55
+ environment: pypi
56
+ permissions:
57
+ id-token: write
58
+ steps:
59
+ - uses: actions/download-artifact@v4
60
+ with:
61
+ name: dist
62
+ path: dist/
63
+
64
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,15 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .eggs/
5
+ dist/
6
+ build/
7
+ .venv/
8
+ venv/
9
+ .env
10
+ .DS_Store
11
+ .pytest_cache/
12
+ .mypy_cache/
13
+ .ruff_cache/
14
+ *.log
15
+ /tmp/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 snapshot contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,204 @@
1
+ Metadata-Version: 2.4
2
+ Name: web-snapshot-cli
3
+ Version: 0.1.0
4
+ Summary: Take offline snapshots of any website and restore them locally
5
+ Project-URL: Homepage, https://github.com/codingsushi79/Snapshot
6
+ Project-URL: Repository, https://github.com/codingsushi79/Snapshot
7
+ Author: snapshot contributors
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: cli,crawler,offline,snapshot,web-archive
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Internet :: WWW/HTTP
17
+ Classifier: Topic :: Utilities
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: beautifulsoup4>=4.12
20
+ Requires-Dist: click>=8.1
21
+ Requires-Dist: httpx>=0.27
22
+ Requires-Dist: markdownify>=0.13
23
+ Requires-Dist: rich>=13.7
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
26
+ Requires-Dist: pytest>=8.0; extra == 'dev'
27
+ Requires-Dist: ruff>=0.8; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # snapshot — offline website snapshots
31
+
32
+ Take a fast offline copy of any public website, then serve it locally.
33
+
34
+ ## Install
35
+
36
+ **One-liner (macOS / Linux / WSL):**
37
+
38
+ ```bash
39
+ curl -fsSL https://raw.githubusercontent.com/codingsushi79/Snapshot/main/install.sh | bash
40
+ ```
41
+
42
+ **One-liner (Windows PowerShell):**
43
+
44
+ ```powershell
45
+ irm https://raw.githubusercontent.com/codingsushi79/Snapshot/main/install.ps1 | iex
46
+ ```
47
+
48
+ **Universal fallback** (requires Python 3.10+):
49
+
50
+ ```bash
51
+ python3 -m pip install --user git+https://github.com/codingsushi79/Snapshot.git
52
+ ```
53
+
54
+ **From PyPI** (once published):
55
+
56
+ ```bash
57
+ pip install web-snapshot-cli
58
+ ```
59
+
60
+ Then run:
61
+
62
+ ```bash
63
+ snapshot https://example.com ./mirror
64
+ ```
65
+
66
+ <details>
67
+ <summary>Other install methods</summary>
68
+
69
+ ```bash
70
+ # With pipx (recommended for CLI tools)
71
+ pipx install web-snapshot-cli
72
+ # or from git:
73
+ pipx install git+https://github.com/codingsushi79/Snapshot.git
74
+
75
+ # From a local clone
76
+ git clone https://github.com/codingsushi79/Snapshot.git
77
+ cd Snapshot
78
+ pip install -e .
79
+ ```
80
+
81
+ </details>
82
+
83
+ ## Usage
84
+
85
+ ### Snapshot a single page
86
+
87
+ ```bash
88
+ snapshot https://example.com ./mirror
89
+ ```
90
+
91
+ ### Crawl an entire site
92
+
93
+ ```bash
94
+ snapshot --crawl https://docs.example.com ./docs --max-pages 200 --depth 4
95
+ ```
96
+
97
+ ### Save pages as Markdown
98
+
99
+ ```bash
100
+ snapshot https://example.com ./mirror --lang md
101
+ ```
102
+
103
+ ### Crawl with filters and politeness
104
+
105
+ ```bash
106
+ snapshot --crawl --include '/docs/*' --exclude '/docs/drafts/*' \
107
+ --crawl-delay 1 --robots https://docs.example.com ./docs
108
+ ```
109
+
110
+ ### Authenticated pages
111
+
112
+ ```bash
113
+ snapshot --cookie session=abc123 --header "Authorization: Bearer TOKEN" \
114
+ https://app.example.com ./mirror
115
+ ```
116
+
117
+ ### Sitemap-based crawl
118
+
119
+ ```bash
120
+ snapshot --crawl --sitemap https://example.com ./mirror --max-pages 500
121
+ ```
122
+
123
+ ### Resume an interrupted snapshot
124
+
125
+ ```bash
126
+ snapshot --resume --crawl https://example.com ./mirror
127
+ ```
128
+
129
+ ### Dry run (no writes)
130
+
131
+ ```bash
132
+ snapshot --dry-run --verbose --crawl https://example.com ./mirror
133
+ ```
134
+
135
+ ### Extra args (positional)
136
+
137
+ Any `key=value` pairs after the output directory are merged into options:
138
+
139
+ ```bash
140
+ snapshot https://example.com ./mirror crawl=true max-pages=100 lang=html concurrency=32
141
+ ```
142
+
143
+ ### Restore locally
144
+
145
+ ```bash
146
+ snapshot -restore ./mirror
147
+ ```
148
+
149
+ This starts a local HTTP server (default `http://127.0.0.1:8080`) and opens your browser.
150
+
151
+ ```bash
152
+ snapshot -restore ./mirror --port 3000 --no-open
153
+ ```
154
+
155
+ ## Options
156
+
157
+ | Flag | Description |
158
+ |------|-------------|
159
+ | `--crawl`, `-c` | Follow same-origin links and download all pages |
160
+ | `--lang`, `-l` | Output format: `html` (default) or `md` |
161
+ | `--max-pages` | Max pages when crawling (default: 50) |
162
+ | `--depth` | Max crawl depth (default: 3) |
163
+ | `--no-assets` | Skip CSS, JS, images, fonts |
164
+ | `--timeout` | HTTP timeout in seconds (default: 15) |
165
+ | `--concurrency` | Parallel downloads (default: 16) |
166
+ | `--same-origin` / `--no-same-origin` | Restrict crawl to same origin (default: on) |
167
+ | `--user-agent` | Custom User-Agent header |
168
+ | `--cookie` | Cookie as `name=value` (repeatable) |
169
+ | `--header` | Extra HTTP header (repeatable) |
170
+ | `--include` | Only fetch URLs matching glob (repeatable) |
171
+ | `--exclude` | Skip URLs matching glob (repeatable) |
172
+ | `--robots` / `--no-robots` | Respect robots.txt (default: on) |
173
+ | `--crawl-delay` | Seconds to wait after each request (default: 0) |
174
+ | `--sitemap` | Seed crawl from sitemap.xml |
175
+ | `--resume` | Skip pages/assets already saved |
176
+ | `--verbose`, `-v` | Detailed log output |
177
+ | `--dry-run` | Fetch without writing files |
178
+ | `-restore DIR` | Serve a saved snapshot from `DIR` |
179
+ | `--port` | Port for restore (default: 8080) |
180
+ | `--host` | Host for restore (default: 127.0.0.1) |
181
+ | `--no-open` | Don't open a browser on restore |
182
+
183
+ ## How it works
184
+
185
+ 1. **snapshot** fetches pages with async HTTP (httpx), rewrites links to local paths, and downloads linked assets in parallel.
186
+ 2. A `.snapshot.json` manifest is written to the output folder with metadata for restore.
187
+ 3. **snapshot -restore** serves the saved files and maps `/` back to the original root page.
188
+
189
+ ## Output layout
190
+
191
+ ```
192
+ mirror/
193
+ .snapshot.json
194
+ example.com/
195
+ index.html
196
+ about/
197
+ index.html
198
+ _assets/
199
+ ...
200
+ ```
201
+
202
+ ## License
203
+
204
+ MIT
@@ -0,0 +1,175 @@
1
+ # snapshot — offline website snapshots
2
+
3
+ Take a fast offline copy of any public website, then serve it locally.
4
+
5
+ ## Install
6
+
7
+ **One-liner (macOS / Linux / WSL):**
8
+
9
+ ```bash
10
+ curl -fsSL https://raw.githubusercontent.com/codingsushi79/Snapshot/main/install.sh | bash
11
+ ```
12
+
13
+ **One-liner (Windows PowerShell):**
14
+
15
+ ```powershell
16
+ irm https://raw.githubusercontent.com/codingsushi79/Snapshot/main/install.ps1 | iex
17
+ ```
18
+
19
+ **Universal fallback** (requires Python 3.10+):
20
+
21
+ ```bash
22
+ python3 -m pip install --user git+https://github.com/codingsushi79/Snapshot.git
23
+ ```
24
+
25
+ **From PyPI** (once published):
26
+
27
+ ```bash
28
+ pip install web-snapshot-cli
29
+ ```
30
+
31
+ Then run:
32
+
33
+ ```bash
34
+ snapshot https://example.com ./mirror
35
+ ```
36
+
37
+ <details>
38
+ <summary>Other install methods</summary>
39
+
40
+ ```bash
41
+ # With pipx (recommended for CLI tools)
42
+ pipx install web-snapshot-cli
43
+ # or from git:
44
+ pipx install git+https://github.com/codingsushi79/Snapshot.git
45
+
46
+ # From a local clone
47
+ git clone https://github.com/codingsushi79/Snapshot.git
48
+ cd Snapshot
49
+ pip install -e .
50
+ ```
51
+
52
+ </details>
53
+
54
+ ## Usage
55
+
56
+ ### Snapshot a single page
57
+
58
+ ```bash
59
+ snapshot https://example.com ./mirror
60
+ ```
61
+
62
+ ### Crawl an entire site
63
+
64
+ ```bash
65
+ snapshot --crawl https://docs.example.com ./docs --max-pages 200 --depth 4
66
+ ```
67
+
68
+ ### Save pages as Markdown
69
+
70
+ ```bash
71
+ snapshot https://example.com ./mirror --lang md
72
+ ```
73
+
74
+ ### Crawl with filters and politeness
75
+
76
+ ```bash
77
+ snapshot --crawl --include '/docs/*' --exclude '/docs/drafts/*' \
78
+ --crawl-delay 1 --robots https://docs.example.com ./docs
79
+ ```
80
+
81
+ ### Authenticated pages
82
+
83
+ ```bash
84
+ snapshot --cookie session=abc123 --header "Authorization: Bearer TOKEN" \
85
+ https://app.example.com ./mirror
86
+ ```
87
+
88
+ ### Sitemap-based crawl
89
+
90
+ ```bash
91
+ snapshot --crawl --sitemap https://example.com ./mirror --max-pages 500
92
+ ```
93
+
94
+ ### Resume an interrupted snapshot
95
+
96
+ ```bash
97
+ snapshot --resume --crawl https://example.com ./mirror
98
+ ```
99
+
100
+ ### Dry run (no writes)
101
+
102
+ ```bash
103
+ snapshot --dry-run --verbose --crawl https://example.com ./mirror
104
+ ```
105
+
106
+ ### Extra args (positional)
107
+
108
+ Any `key=value` pairs after the output directory are merged into options:
109
+
110
+ ```bash
111
+ snapshot https://example.com ./mirror crawl=true max-pages=100 lang=html concurrency=32
112
+ ```
113
+
114
+ ### Restore locally
115
+
116
+ ```bash
117
+ snapshot -restore ./mirror
118
+ ```
119
+
120
+ This starts a local HTTP server (default `http://127.0.0.1:8080`) and opens your browser.
121
+
122
+ ```bash
123
+ snapshot -restore ./mirror --port 3000 --no-open
124
+ ```
125
+
126
+ ## Options
127
+
128
+ | Flag | Description |
129
+ |------|-------------|
130
+ | `--crawl`, `-c` | Follow same-origin links and download all pages |
131
+ | `--lang`, `-l` | Output format: `html` (default) or `md` |
132
+ | `--max-pages` | Max pages when crawling (default: 50) |
133
+ | `--depth` | Max crawl depth (default: 3) |
134
+ | `--no-assets` | Skip CSS, JS, images, fonts |
135
+ | `--timeout` | HTTP timeout in seconds (default: 15) |
136
+ | `--concurrency` | Parallel downloads (default: 16) |
137
+ | `--same-origin` / `--no-same-origin` | Restrict crawl to same origin (default: on) |
138
+ | `--user-agent` | Custom User-Agent header |
139
+ | `--cookie` | Cookie as `name=value` (repeatable) |
140
+ | `--header` | Extra HTTP header (repeatable) |
141
+ | `--include` | Only fetch URLs matching glob (repeatable) |
142
+ | `--exclude` | Skip URLs matching glob (repeatable) |
143
+ | `--robots` / `--no-robots` | Respect robots.txt (default: on) |
144
+ | `--crawl-delay` | Seconds to wait after each request (default: 0) |
145
+ | `--sitemap` | Seed crawl from sitemap.xml |
146
+ | `--resume` | Skip pages/assets already saved |
147
+ | `--verbose`, `-v` | Detailed log output |
148
+ | `--dry-run` | Fetch without writing files |
149
+ | `-restore DIR` | Serve a saved snapshot from `DIR` |
150
+ | `--port` | Port for restore (default: 8080) |
151
+ | `--host` | Host for restore (default: 127.0.0.1) |
152
+ | `--no-open` | Don't open a browser on restore |
153
+
154
+ ## How it works
155
+
156
+ 1. **snapshot** fetches pages with async HTTP (httpx), rewrites links to local paths, and downloads linked assets in parallel.
157
+ 2. A `.snapshot.json` manifest is written to the output folder with metadata for restore.
158
+ 3. **snapshot -restore** serves the saved files and maps `/` back to the original root page.
159
+
160
+ ## Output layout
161
+
162
+ ```
163
+ mirror/
164
+ .snapshot.json
165
+ example.com/
166
+ index.html
167
+ about/
168
+ index.html
169
+ _assets/
170
+ ...
171
+ ```
172
+
173
+ ## License
174
+
175
+ MIT
@@ -0,0 +1,67 @@
1
+ #Requires -Version 5.1
2
+ $ErrorActionPreference = "Stop"
3
+
4
+ $Repo = if ($env:SNAPSHOT_REPO) { $env:SNAPSHOT_REPO } else { "https://github.com/codingsushi79/Snapshot.git" }
5
+ $Ref = if ($env:SNAPSHOT_REF) { $env:SNAPSHOT_REF } else { "main" }
6
+ $InstallSpec = "git+$Repo@$Ref"
7
+
8
+ function Write-Info($msg) { Write-Host "→ $msg" -ForegroundColor Cyan }
9
+ function Write-Warn($msg) { Write-Host "! $msg" -ForegroundColor Yellow }
10
+ function Write-Err($msg) { Write-Host "✗ $msg" -ForegroundColor Red }
11
+
12
+ function Find-Python {
13
+ foreach ($cmd in @("python", "python3", "py")) {
14
+ if (Get-Command $cmd -ErrorAction SilentlyContinue) {
15
+ $ok = & $cmd -c "import sys; raise SystemExit(0 if sys.version_info >= (3,10) else 1)" 2>$null
16
+ if ($LASTEXITCODE -eq 0) { return $cmd }
17
+ }
18
+ }
19
+ return $null
20
+ }
21
+
22
+ function Ensure-Pip($py) {
23
+ & $py -m pip --version 2>$null | Out-Null
24
+ if ($LASTEXITCODE -ne 0) {
25
+ Write-Info "Bootstrapping pip…"
26
+ & $py -m ensurepip --upgrade 2>$null | Out-Null
27
+ }
28
+ & $py -m pip --version 2>$null | Out-Null
29
+ return ($LASTEXITCODE -eq 0)
30
+ }
31
+
32
+ Write-Info "Installing snapshot from $InstallSpec"
33
+
34
+ $py = Find-Python
35
+ if (-not $py) {
36
+ Write-Err "Python 3.10+ is required."
37
+ Write-Err "Install from https://www.python.org/downloads/ and re-run this script."
38
+ exit 1
39
+ }
40
+
41
+ if (-not (Ensure-Pip $py)) {
42
+ Write-Err "pip is required but could not be installed."
43
+ exit 1
44
+ }
45
+
46
+ if (Get-Command pipx -ErrorAction SilentlyContinue) {
47
+ Write-Info "Installing snapshot with pipx…"
48
+ pipx install --force $InstallSpec
49
+ } else {
50
+ Write-Info "Installing snapshot with pip…"
51
+ & $py -m pip install --user --upgrade $InstallSpec
52
+ }
53
+
54
+ $localBin = Join-Path $env:USERPROFILE ".local\\bin"
55
+ $scriptsDir = Join-Path $env:APPDATA "Python\\Python312\\Scripts"
56
+ $paths = @($localBin, $scriptsDir) | Where-Object { Test-Path $_ }
57
+ if ($paths.Count -gt 0) {
58
+ $env:PATH = ($paths -join ";") + ";" + $env:PATH
59
+ }
60
+
61
+ if (Get-Command snapshot -ErrorAction SilentlyContinue) {
62
+ Write-Info "Installed snapshot."
63
+ Write-Info "Run: snapshot https://example.com ./mirror"
64
+ } else {
65
+ Write-Warn "snapshot installed, but not on PATH."
66
+ Write-Warn "Restart your terminal or add Python Scripts to PATH."
67
+ }
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ REPO="${SNAPSHOT_REPO:-https://github.com/codingsushi79/Snapshot.git}"
5
+ REF="${SNAPSHOT_REF:-main}"
6
+ INSTALL_SPEC="git+${REPO}@${REF}"
7
+
8
+ info() { printf '\033[1;34m→\033[0m %s\n' "$*"; }
9
+ warn() { printf '\033[1;33m!\033[0m %s\n' "$*"; }
10
+ err() { printf '\033[1;31m✗\033[0m %s\n' "$*" >&2; }
11
+
12
+ need_cmd() {
13
+ command -v "$1" >/dev/null 2>&1
14
+ }
15
+
16
+ find_python() {
17
+ for cmd in python3 python py; do
18
+ if need_cmd "$cmd"; then
19
+ if "$cmd" -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 10) else 1)' 2>/dev/null; then
20
+ echo "$cmd"
21
+ return 0
22
+ fi
23
+ fi
24
+ done
25
+ return 1
26
+ }
27
+
28
+ ensure_pip() {
29
+ local py="$1"
30
+ if "$py" -m pip --version >/dev/null 2>&1; then
31
+ return 0
32
+ fi
33
+ info "Bootstrapping pip…"
34
+ "$py" -m ensurepip --upgrade >/dev/null 2>&1 || true
35
+ "$py" -m pip --version >/dev/null 2>&1
36
+ }
37
+
38
+ pip_user_flag() {
39
+ if [[ -n "${VIRTUAL_ENV:-}" ]]; then
40
+ echo ""
41
+ else
42
+ echo "--user"
43
+ fi
44
+ }
45
+
46
+ install_with_pipx() {
47
+ local py="$1"
48
+ info "Installing snapshot with pipx…"
49
+ if ! need_cmd pipx; then
50
+ local user_flag
51
+ user_flag="$(pip_user_flag)"
52
+ # shellcheck disable=SC2086
53
+ "$py" -m pip install $user_flag pipx
54
+ export PATH="${HOME}/.local/bin:${PATH}"
55
+ if need_cmd pipx; then
56
+ pipx ensurepath >/dev/null 2>&1 || true
57
+ fi
58
+ fi
59
+ if need_cmd pipx; then
60
+ pipx install --force "$INSTALL_SPEC"
61
+ return 0
62
+ fi
63
+ return 1
64
+ }
65
+
66
+ install_with_pip() {
67
+ local py="$1"
68
+ local user_flag
69
+ user_flag="$(pip_user_flag)"
70
+ info "Installing snapshot with pip…"
71
+ # shellcheck disable=SC2086
72
+ "$py" -m pip install $user_flag --upgrade "$INSTALL_SPEC"
73
+ }
74
+
75
+ verify_install() {
76
+ export PATH="${HOME}/.local/bin:${HOME}/Library/Python/3.12/bin:${HOME}/Library/Python/3.11/bin:${HOME}/Library/Python/3.10/bin:${PATH}"
77
+ if command -v snapshot >/dev/null 2>&1; then
78
+ info "Installed: $(snapshot --version 2>/dev/null || snapshot --help | head -1)"
79
+ info "Run: snapshot https://example.com ./mirror"
80
+ return 0
81
+ fi
82
+ warn "snapshot installed, but not on PATH."
83
+ warn "Add this to your shell profile:"
84
+ echo " export PATH=\"\${HOME}/.local/bin:\${PATH}\""
85
+ return 1
86
+ }
87
+
88
+ main() {
89
+ info "Installing snapshot from ${INSTALL_SPEC}"
90
+
91
+ if ! PY="$(find_python)"; then
92
+ err "Python 3.10+ is required."
93
+ err "Install Python from https://www.python.org/downloads/ and re-run this script."
94
+ exit 1
95
+ fi
96
+
97
+ if ! ensure_pip "$PY"; then
98
+ err "pip is required but could not be installed."
99
+ exit 1
100
+ fi
101
+
102
+ if ! install_with_pipx "$PY"; then
103
+ install_with_pip "$PY"
104
+ fi
105
+
106
+ verify_install || true
107
+ }
108
+
109
+ main "$@"