pyrehearse 2.3.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.
- pyrehearse-2.3.0/LICENSE +21 -0
- pyrehearse-2.3.0/PKG-INFO +476 -0
- pyrehearse-2.3.0/README.md +431 -0
- pyrehearse-2.3.0/pyproject.toml +207 -0
- pyrehearse-2.3.0/setup.cfg +4 -0
- pyrehearse-2.3.0/src/pyrehearse/__init__.py +3 -0
- pyrehearse-2.3.0/src/pyrehearse/__main__.py +6 -0
- pyrehearse-2.3.0/src/pyrehearse.egg-info/PKG-INFO +476 -0
- pyrehearse-2.3.0/src/pyrehearse.egg-info/SOURCES.txt +48 -0
- pyrehearse-2.3.0/src/pyrehearse.egg-info/dependency_links.txt +1 -0
- pyrehearse-2.3.0/src/pyrehearse.egg-info/entry_points.txt +3 -0
- pyrehearse-2.3.0/src/pyrehearse.egg-info/requires.txt +15 -0
- pyrehearse-2.3.0/src/pyrehearse.egg-info/top_level.txt +2 -0
- pyrehearse-2.3.0/src/pyvm_updater/__init__.py +6 -0
- pyrehearse-2.3.0/src/pyvm_updater/cli.py +1085 -0
- pyrehearse-2.3.0/src/pyvm_updater/config.py +191 -0
- pyrehearse-2.3.0/src/pyvm_updater/constants.py +17 -0
- pyrehearse-2.3.0/src/pyvm_updater/history.py +55 -0
- pyrehearse-2.3.0/src/pyvm_updater/installers.py +127 -0
- pyrehearse-2.3.0/src/pyvm_updater/logging_config.py +65 -0
- pyrehearse-2.3.0/src/pyvm_updater/metadata_store.py +193 -0
- pyrehearse-2.3.0/src/pyvm_updater/migration/__init__.py +1 -0
- pyrehearse-2.3.0/src/pyvm_updater/migration/command.py +101 -0
- pyrehearse-2.3.0/src/pyvm_updater/migration/inputs.py +89 -0
- pyrehearse-2.3.0/src/pyvm_updater/migration/runner.py +333 -0
- pyrehearse-2.3.0/src/pyvm_updater/paths.py +256 -0
- pyrehearse-2.3.0/src/pyvm_updater/plugins/__init__.py +0 -0
- pyrehearse-2.3.0/src/pyvm_updater/plugins/base.py +53 -0
- pyrehearse-2.3.0/src/pyvm_updater/plugins/manager.py +111 -0
- pyrehearse-2.3.0/src/pyvm_updater/plugins/standard.py +757 -0
- pyrehearse-2.3.0/src/pyvm_updater/tui.py +1122 -0
- pyrehearse-2.3.0/src/pyvm_updater/utils.py +190 -0
- pyrehearse-2.3.0/src/pyvm_updater/venv.py +524 -0
- pyrehearse-2.3.0/src/pyvm_updater/version.py +470 -0
- pyrehearse-2.3.0/src/pyvm_updater/wizard.py +236 -0
- pyrehearse-2.3.0/tests/test_cli.py +86 -0
- pyrehearse-2.3.0/tests/test_cli_use.py +82 -0
- pyrehearse-2.3.0/tests/test_colorized_list.py +75 -0
- pyrehearse-2.3.0/tests/test_history.py +70 -0
- pyrehearse-2.3.0/tests/test_json_output.py +110 -0
- pyrehearse-2.3.0/tests/test_migration.py +301 -0
- pyrehearse-2.3.0/tests/test_paths.py +400 -0
- pyrehearse-2.3.0/tests/test_plugins.py +102 -0
- pyrehearse-2.3.0/tests/test_spinner.py +86 -0
- pyrehearse-2.3.0/tests/test_store_detection.py +103 -0
- pyrehearse-2.3.0/tests/test_utils.py +65 -0
- pyrehearse-2.3.0/tests/test_venv.py +159 -0
- pyrehearse-2.3.0/tests/test_venv_duplicate.py +253 -0
- pyrehearse-2.3.0/tests/test_venv_rename.py +248 -0
- pyrehearse-2.3.0/tests/test_version.py +122 -0
pyrehearse-2.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Python Version Manager 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,476 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyrehearse
|
|
3
|
+
Version: 2.3.0
|
|
4
|
+
Summary: Rehearse Python upgrades and manage Python versions
|
|
5
|
+
Author-email: Shreyas Mene <shreyasmene06@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/shreyasmene06/pyrehearse
|
|
8
|
+
Project-URL: Repository, https://github.com/shreyasmene06/pyrehearse
|
|
9
|
+
Project-URL: Documentation, https://github.com/shreyasmene06/pyrehearse/tree/main/docs
|
|
10
|
+
Project-URL: Issues, https://github.com/shreyasmene06/pyrehearse/issues
|
|
11
|
+
Project-URL: License, https://github.com/shreyasmene06/pyrehearse/blob/main/LICENSE
|
|
12
|
+
Project-URL: Installation_Guide, https://github.com/shreyasmene06/pyrehearse/blob/main/docs/INSTALL.md
|
|
13
|
+
Project-URL: Quick_Start, https://github.com/shreyasmene06/pyrehearse/blob/main/docs/QUICKSTART.md
|
|
14
|
+
Project-URL: Quick_Reference, https://github.com/shreyasmene06/pyrehearse/blob/main/docs/QUICK_REFERENCE.md
|
|
15
|
+
Project-URL: Changelog, https://github.com/shreyasmene06/pyrehearse/blob/main/CHANGELOG.md
|
|
16
|
+
Classifier: Development Status :: 4 - Beta
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
|
+
Classifier: Operating System :: OS Independent
|
|
27
|
+
Requires-Python: >=3.9
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: requests>=2.25.0
|
|
31
|
+
Requires-Dist: beautifulsoup4>=4.9.0
|
|
32
|
+
Requires-Dist: packaging>=20.0
|
|
33
|
+
Requires-Dist: click>=8.0.0
|
|
34
|
+
Requires-Dist: textual>=0.40.0
|
|
35
|
+
Requires-Dist: rich>=13.0.0
|
|
36
|
+
Provides-Extra: dev
|
|
37
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-cov>=2.0; extra == "dev"
|
|
39
|
+
Requires-Dist: black>=21.0; extra == "dev"
|
|
40
|
+
Requires-Dist: flake8>=3.9; extra == "dev"
|
|
41
|
+
Requires-Dist: mypy>=0.900; extra == "dev"
|
|
42
|
+
Requires-Dist: textual-dev>=1.0.0; extra == "dev"
|
|
43
|
+
Requires-Dist: ruff>=0.0.280; extra == "dev"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
# PyRehearse
|
|
47
|
+
|
|
48
|
+
**Test your Python upgrade before you ship it.** PyRehearse compares project tests across Python versions and verifies proposed dependency fixes. It also manages side-by-side Python installs and virtual environments.
|
|
49
|
+
|
|
50
|
+
## Overview
|
|
51
|
+
|
|
52
|
+
Formerly published as `pyvm-updater`. Use `pyrehearse` for new commands. The `pyvm` alias, existing configuration and data paths, and plugin imports remain supported.
|
|
53
|
+
|
|
54
|
+
**Documentation**: [Installation Guide](https://github.com/shreyasmene06/pyrehearse/blob/main/docs/INSTALL.md) | [Quick Start](https://github.com/shreyasmene06/pyrehearse/blob/main/docs/QUICKSTART.md) | [Quick Reference](https://github.com/shreyasmene06/pyrehearse/blob/main/docs/QUICK_REFERENCE.md)
|
|
55
|
+
|
|
56
|
+
## Rehearse a Python upgrade
|
|
57
|
+
|
|
58
|
+
`pyrehearse migrate` tests the same commit on two Python versions and can verify a candidate lockfile if the original pins fail. In this Pastas run, Python 3.13 was missing a compatible wheel. Changing three pins let the same 25 upstream tests pass.
|
|
59
|
+
|
|
60
|
+

|
|
61
|
+
|
|
62
|
+
[Reproduce the Pastas run](https://github.com/shreyasmene06/pyrehearse/blob/main/docs/examples/pastas/README.md) · [Use `pyrehearse migrate` on your project](https://github.com/shreyasmene06/pyrehearse/blob/main/docs/MIGRATION.md)
|
|
63
|
+
|
|
64
|
+
## Features
|
|
65
|
+
|
|
66
|
+
### Interactive TUI
|
|
67
|
+
|
|
68
|
+
<img width="1914" height="1039" alt="image" src="https://github.com/user-attachments/assets/6ffc278a-752b-468b-8a57-fff4d2936677" />
|
|
69
|
+
|
|
70
|
+
- Terminal interface with keyboard and mouse support
|
|
71
|
+
- Three-panel layout showing installed versions, available releases, and status
|
|
72
|
+
- Keyboard navigation with Tab, arrows, and shortcuts
|
|
73
|
+
- Live installation progress updates
|
|
74
|
+
- Theme switching between dark and light modes
|
|
75
|
+
|
|
76
|
+
### CLI Features
|
|
77
|
+
|
|
78
|
+
- Check current Python version against latest stable release
|
|
79
|
+
- Install the latest Python or specific versions side-by-side
|
|
80
|
+
- List all available Python versions with support status
|
|
81
|
+
- Interactive progress spinners for network operations
|
|
82
|
+
- Cross-platform support for Windows, Linux, and macOS
|
|
83
|
+
- Virtual environment management
|
|
84
|
+
- Python upgrade rehearsals with locked dependencies and your project's tests ([guide](https://github.com/shreyasmene06/pyrehearse/blob/main/docs/MIGRATION.md), [Pastas case study](https://github.com/shreyasmene06/pyrehearse/blob/main/docs/examples/pastas/README.md))
|
|
85
|
+
- Configuration system for user preferences
|
|
86
|
+
|
|
87
|
+
### Safety
|
|
88
|
+
|
|
89
|
+
- Never modifies system Python defaults
|
|
90
|
+
- SHA256 checksum verification for all downloads
|
|
91
|
+
- Smart installation using mise, pyenv, conda, or system package managers
|
|
92
|
+
- Plugin system for custom installers (see [Plugins](#plugin-system))
|
|
93
|
+
- Rollback support to undo installations
|
|
94
|
+
- Multiple Python versions coexist without conflicts
|
|
95
|
+
|
|
96
|
+
## Plugin System
|
|
97
|
+
|
|
98
|
+
pyrehearse supports custom installation backends through a plugin system. You can add your own installers by placing Python files in `~/.config/pyvm/plugins/`.
|
|
99
|
+
|
|
100
|
+
### Security Note
|
|
101
|
+
|
|
102
|
+
> [!WARNING]
|
|
103
|
+
> **Custom plugins are executed as arbitrary Python code.** Only install plugins from trusted sources. pyrehearse will load and execute any `.py` file found in the plugins directory during startup.
|
|
104
|
+
|
|
105
|
+
## Installation
|
|
106
|
+
|
|
107
|
+
Already installed `pyvm-updater`? Follow the [upgrade guide](https://github.com/shreyasmene06/pyrehearse/blob/main/docs/INSTALL.md#migrating-from-pyvm-updater) before installing the new distribution.
|
|
108
|
+
|
|
109
|
+
### From PyPI (Recommended)
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pip install --user pyrehearse
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### From GitHub
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
git clone https://github.com/shreyasmene06/pyrehearse.git
|
|
119
|
+
cd pyrehearse
|
|
120
|
+
pip install --user .
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Using pipx
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
pipx install pyrehearse
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Note**: On newer Linux systems (Ubuntu 23.04+, Debian 12+), use the `--user` flag or pipx to avoid "externally-managed-environment" errors.
|
|
130
|
+
|
|
131
|
+
### Verify Installation
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pyrehearse --version
|
|
135
|
+
pyrehearse check
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Quick Start
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Check your Python version
|
|
142
|
+
pyrehearse check
|
|
143
|
+
|
|
144
|
+
# Update to latest Python
|
|
145
|
+
pyrehearse update
|
|
146
|
+
|
|
147
|
+
# Launch interactive TUI
|
|
148
|
+
pyrehearse tui
|
|
149
|
+
|
|
150
|
+
# List available versions
|
|
151
|
+
pyrehearse list
|
|
152
|
+
|
|
153
|
+
# Install a specific version
|
|
154
|
+
pyrehearse install 3.12.8
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Usage
|
|
158
|
+
|
|
159
|
+
### Shell Completion
|
|
160
|
+
|
|
161
|
+
Enable tab completion for your shell:
|
|
162
|
+
|
|
163
|
+
#### Bash
|
|
164
|
+
|
|
165
|
+
Add this to `~/.bashrc`:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
eval "$(_PYREHEARSE_COMPLETE=bash_source pyrehearse)"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
#### Zsh
|
|
172
|
+
|
|
173
|
+
Add this to `~/.zshrc`:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
eval "$(_PYREHEARSE_COMPLETE=zsh_source pyrehearse)"
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### Fish
|
|
180
|
+
|
|
181
|
+
Add this to `~/.config/fish/config.fish`:
|
|
182
|
+
|
|
183
|
+
```fish
|
|
184
|
+
_PYREHEARSE_COMPLETE=fish_source pyrehearse | source
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Interactive TUI Mode
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
pyrehearse tui
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Keyboard Shortcuts:
|
|
194
|
+
|
|
195
|
+
| Key | Action |
|
|
196
|
+
|-----|--------|
|
|
197
|
+
| Tab / Shift+Tab | Switch between panels |
|
|
198
|
+
| Arrow Keys | Navigate within panel |
|
|
199
|
+
| Enter | Install selected version |
|
|
200
|
+
| U | Update to latest Python |
|
|
201
|
+
| B | Rollback last installation |
|
|
202
|
+
| X | Remove selected version |
|
|
203
|
+
| R | Refresh data |
|
|
204
|
+
| T | Toggle theme |
|
|
205
|
+
| Q | Quit |
|
|
206
|
+
|
|
207
|
+
### CLI Commands
|
|
208
|
+
|
|
209
|
+
| Command | Description |
|
|
210
|
+
|---------|-------------|
|
|
211
|
+
| `pyrehearse check` | Check Python version against latest |
|
|
212
|
+
| `pyrehearse list` | List available Python versions |
|
|
213
|
+
| `pyrehearse list --all` | Show all versions including patches |
|
|
214
|
+
| `pyrehearse install <version>` | Install specific Python version |
|
|
215
|
+
| `pyrehearse update` | Update to latest Python version |
|
|
216
|
+
| `pyrehearse update --version 3.12.0` | Update to specific version |
|
|
217
|
+
| `pyrehearse remove <version>` | Remove an installed version |
|
|
218
|
+
| `pyrehearse rollback` | Undo last installation |
|
|
219
|
+
| `pyrehearse migrate --from 3.12 --to 3.13 --lock requirements.lock.txt -- python -m pytest` | Compare the same project and dependency pins on two Python versions |
|
|
220
|
+
| `pyrehearse venv create <name>` | Create virtual environment |
|
|
221
|
+
| `pyrehearse venv list` | List virtual environments |
|
|
222
|
+
| `pyrehearse config` | View configuration |
|
|
223
|
+
| `pyrehearse info` | Show system information |
|
|
224
|
+
|
|
225
|
+
### Virtual Environment Management
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# Create a new virtual environment
|
|
229
|
+
pyrehearse venv create myproject
|
|
230
|
+
|
|
231
|
+
# Create with specific Python version
|
|
232
|
+
pyrehearse venv create myproject --python 3.12
|
|
233
|
+
|
|
234
|
+
# List all managed environments
|
|
235
|
+
pyrehearse venv list
|
|
236
|
+
|
|
237
|
+
# Show activation command
|
|
238
|
+
pyrehearse venv activate myproject
|
|
239
|
+
|
|
240
|
+
# Remove an environment
|
|
241
|
+
pyrehearse venv remove myproject
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Using Installed Python Versions
|
|
245
|
+
|
|
246
|
+
After installation, the new Python is available alongside your existing version:
|
|
247
|
+
|
|
248
|
+
#### Linux/macOS
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# Use the new version
|
|
252
|
+
python3.12 your_script.py
|
|
253
|
+
|
|
254
|
+
# Create a virtual environment
|
|
255
|
+
python3.12 -m venv myproject
|
|
256
|
+
source myproject/bin/activate
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#### Windows
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Use Python Launcher
|
|
263
|
+
py -3.12 your_script.py
|
|
264
|
+
|
|
265
|
+
# List installed versions
|
|
266
|
+
py --list
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## How It Works
|
|
270
|
+
|
|
271
|
+
pyrehearse uses an intelligent fallback chain for installation:
|
|
272
|
+
|
|
273
|
+
#### Linux
|
|
274
|
+
|
|
275
|
+
1. mise (if available)
|
|
276
|
+
2. pyenv (if available)
|
|
277
|
+
3. apt with deadsnakes PPA (Ubuntu/Debian)
|
|
278
|
+
4. dnf/yum (Fedora/RHEL)
|
|
279
|
+
|
|
280
|
+
#### macOS
|
|
281
|
+
|
|
282
|
+
1. mise (if available)
|
|
283
|
+
2. pyenv (if available)
|
|
284
|
+
3. Homebrew
|
|
285
|
+
|
|
286
|
+
#### Windows
|
|
287
|
+
|
|
288
|
+
- Downloads official installer from python.org
|
|
289
|
+
|
|
290
|
+
## Configuration
|
|
291
|
+
|
|
292
|
+
Configuration is stored at `~/.config/pyvm/config.toml`:
|
|
293
|
+
|
|
294
|
+
```toml
|
|
295
|
+
[general]
|
|
296
|
+
auto_confirm = false
|
|
297
|
+
verbose = false
|
|
298
|
+
preferred_installer = "auto"
|
|
299
|
+
|
|
300
|
+
[download]
|
|
301
|
+
verify_checksum = true
|
|
302
|
+
max_retries = 3
|
|
303
|
+
timeout = 120
|
|
304
|
+
|
|
305
|
+
[tui]
|
|
306
|
+
theme = "dark"
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Manage configuration:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
pyrehearse config # View current settings
|
|
313
|
+
pyrehearse config --init # Create default config
|
|
314
|
+
pyrehearse config --path # Show config file location
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Data Locations (XDG Compliance)
|
|
318
|
+
|
|
319
|
+
`pyrehearse` stores configuration, data, and cache files following the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) on Linux/macOS, and standard `LocalAppData` locations on Windows.
|
|
320
|
+
|
|
321
|
+
**Linux / macOS:**
|
|
322
|
+
- **Config:** `~/.config/pyvm/` (`$XDG_CONFIG_HOME`)
|
|
323
|
+
- **Data (Venvs/History):** `~/.local/share/pyvm/` (`$XDG_DATA_HOME`)
|
|
324
|
+
- **Cache (Metadata):** `~/.cache/pyvm/` (`$XDG_CACHE_HOME`)
|
|
325
|
+
|
|
326
|
+
**Windows:**
|
|
327
|
+
- **Config / Data / Cache:** `%LOCALAPPDATA%\pyvm\`
|
|
328
|
+
|
|
329
|
+
### Automatic Migration for Existing Users
|
|
330
|
+
If you are upgrading from an older installation that used legacy paths (e.g., `~/.pyvm`, `~/.pyvm_history.json`), commands such as `pyrehearse list` will **automatically move** your files and virtual environments to the new locations.
|
|
331
|
+
|
|
332
|
+
* **Logs:** If you run into issues, check your terminal output. Failed partial migrations will be retried automatically on subsequent runs until successful.
|
|
333
|
+
|
|
334
|
+
## Requirements
|
|
335
|
+
|
|
336
|
+
- Python 3.9 or higher
|
|
337
|
+
- Internet connection
|
|
338
|
+
- Admin/sudo privileges for some package manager operations
|
|
339
|
+
|
|
340
|
+
## Dependencies
|
|
341
|
+
|
|
342
|
+
Automatically installed:
|
|
343
|
+
|
|
344
|
+
- requests
|
|
345
|
+
- beautifulsoup4
|
|
346
|
+
- packaging
|
|
347
|
+
- click
|
|
348
|
+
- textual
|
|
349
|
+
|
|
350
|
+
## Troubleshooting
|
|
351
|
+
|
|
352
|
+
### "externally-managed-environment" Error
|
|
353
|
+
|
|
354
|
+
Use one of these solutions:
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
# Option 1: User install
|
|
358
|
+
pip install --user pyrehearse
|
|
359
|
+
|
|
360
|
+
# Option 2: Use pipx
|
|
361
|
+
pipx install pyrehearse
|
|
362
|
+
|
|
363
|
+
# Option 3: Use virtual environment
|
|
364
|
+
python3 -m venv venv && source venv/bin/activate
|
|
365
|
+
pip install pyrehearse
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### "pyrehearse: command not found"
|
|
369
|
+
|
|
370
|
+
Add the installation directory to your PATH:
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
# For pip install --user
|
|
374
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
375
|
+
|
|
376
|
+
# For pipx
|
|
377
|
+
pipx ensurepath
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### "Already installed but shows old version"
|
|
381
|
+
|
|
382
|
+
The new Python is installed alongside your existing version. Use the specific version command:
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
python3.12 --version # Linux/macOS
|
|
386
|
+
py -3.12 --version # Windows
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Permission Denied Errors
|
|
390
|
+
|
|
391
|
+
- **Cause:** The script lacks execute permissions or is trying to write to a protected folder.
|
|
392
|
+
- **Fix:**
|
|
393
|
+
- Run the command with `sudo` (Linux/Mac) or as Administrator (Windows).
|
|
394
|
+
- Ensure the script is executable: `chmod +x pyrehearse`.
|
|
395
|
+
|
|
396
|
+
### Firewall/Antivirus Blocking
|
|
397
|
+
|
|
398
|
+
- **Cause:** Security software might flag the updater as suspicious because it modifies system files.
|
|
399
|
+
- **Fix:** Whitelist `pyrehearse` in your antivirus settings or temporarily disable the firewall during the update process.
|
|
400
|
+
|
|
401
|
+
## 🆚 Comparison with other tools
|
|
402
|
+
|
|
403
|
+
| Feature | pyrehearse | pyenv | asdf |
|
|
404
|
+
|---------|------|-------|------|
|
|
405
|
+
| **Scope** | Python only | Python only | Multi-language |
|
|
406
|
+
| **Complexity** | Low (Single script) | High (Shims, builds) | High (Plugins) |
|
|
407
|
+
| **OS Support** | Cross-platform | Unix-focused | Unix-focused |
|
|
408
|
+
| **Use Case** | Quick updates & lightweight management | Deep version management | Universal dev environments |
|
|
409
|
+
|
|
410
|
+
## 📖 API Documentation
|
|
411
|
+
|
|
412
|
+
Developers can use `pyrehearse` as a Python library to manage installations programmatically.
|
|
413
|
+
|
|
414
|
+
### Installation Functions
|
|
415
|
+
|
|
416
|
+
The module provides platform-specific functions to install Python versions.
|
|
417
|
+
|
|
418
|
+
```python
|
|
419
|
+
from pyvm_updater import installers
|
|
420
|
+
|
|
421
|
+
# Windows: Downloads and runs the official installer
|
|
422
|
+
success = installers.update_python_windows("3.12.1")
|
|
423
|
+
|
|
424
|
+
# Linux: Tries mise, pyenv, then system package managers (apt/dnf)
|
|
425
|
+
success = installers.update_python_linux("3.12.1", build_from_source=False)
|
|
426
|
+
|
|
427
|
+
# macOS: Tries mise, pyenv, brew, then official installer
|
|
428
|
+
success = installers.update_python_macos("3.12.1")
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
## Development
|
|
432
|
+
|
|
433
|
+
```bash
|
|
434
|
+
# Clone and install in development mode
|
|
435
|
+
git clone https://github.com/shreyasmene06/pyrehearse.git
|
|
436
|
+
cd pyrehearse
|
|
437
|
+
pip install -e ".[dev]"
|
|
438
|
+
|
|
439
|
+
# Run tests
|
|
440
|
+
pytest tests/ -v
|
|
441
|
+
|
|
442
|
+
# Run linters
|
|
443
|
+
ruff check .
|
|
444
|
+
black --check .
|
|
445
|
+
mypy src/pyvm_updater
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
## Exit Codes
|
|
449
|
+
|
|
450
|
+
| Code | Meaning |
|
|
451
|
+
|------|---------|
|
|
452
|
+
| 0 | Success or up-to-date |
|
|
453
|
+
| 1 | Update available or error |
|
|
454
|
+
| 130 | Operation cancelled by user |
|
|
455
|
+
|
|
456
|
+
## Contributing
|
|
457
|
+
|
|
458
|
+
Contributions are welcome. See [CONTRIBUTING.md](https://github.com/shreyasmene06/pyrehearse/blob/main/CONTRIBUTING.md) for guidelines.
|
|
459
|
+
|
|
460
|
+
## License
|
|
461
|
+
|
|
462
|
+
MIT License. See [LICENSE](https://github.com/shreyasmene06/pyrehearse/blob/main/LICENSE) for details.
|
|
463
|
+
|
|
464
|
+
## Author
|
|
465
|
+
|
|
466
|
+
Shreyas Mene
|
|
467
|
+
|
|
468
|
+
## Contributors
|
|
469
|
+
|
|
470
|
+
<!-- CONTRIBUTORS_START -->
|
|
471
|
+
<a href="https://github.com/Build-with-Akshit"><img src="https://github.com/Build-with-Akshit.png" width="50px" loading="lazy" title="Build-with-Akshit" style="border-radius:50%;margin:5px;" alt="Build-with-Akshit" /></a><a href="https://github.com/Nidzz07"><img src="https://github.com/Nidzz07.png" width="50px" loading="lazy" title="Nidzz07" style="border-radius:50%;margin:5px;" alt="Nidzz07" /></a><a href="https://github.com/ParthG2209"><img src="https://github.com/ParthG2209.png" width="50px" loading="lazy" title="ParthG2209" style="border-radius:50%;margin:5px;" alt="ParthG2209" /></a><a href="https://github.com/Pikolosan"><img src="https://github.com/Pikolosan.png" width="50px" loading="lazy" title="Pikolosan" style="border-radius:50%;margin:5px;" alt="Pikolosan" /></a><a href="https://github.com/RahilHalai7"><img src="https://github.com/RahilHalai7.png" width="50px" loading="lazy" title="RahilHalai7" style="border-radius:50%;margin:5px;" alt="RahilHalai7" /></a><a href="https://github.com/ShaikhWarsi"><img src="https://github.com/ShaikhWarsi.png" width="50px" loading="lazy" title="ShaikhWarsi" style="border-radius:50%;margin:5px;" alt="ShaikhWarsi" /></a><a href="https://github.com/Sivanesan-R"><img src="https://github.com/Sivanesan-R.png" width="50px" loading="lazy" title="Sivanesan-R" style="border-radius:50%;margin:5px;" alt="Sivanesan-R" /></a><a href="https://github.com/Sumit0919"><img src="https://github.com/Sumit0919.png" width="50px" loading="lazy" title="Sumit0919" style="border-radius:50%;margin:5px;" alt="Sumit0919" /></a><a href="https://github.com/Ved178"><img src="https://github.com/Ved178.png" width="50px" loading="lazy" title="Ved178" style="border-radius:50%;margin:5px;" alt="Ved178" /></a><a href="https://github.com/advay-demo"><img src="https://github.com/advay-demo.png" width="50px" loading="lazy" title="advay-demo" style="border-radius:50%;margin:5px;" alt="advay-demo" /></a><a href="https://github.com/amanyadavkr098-bot"><img src="https://github.com/amanyadavkr098-bot.png" width="50px" loading="lazy" title="amanyadavkr098-bot" style="border-radius:50%;margin:5px;" alt="amanyadavkr098-bot" /></a><a href="https://github.com/ashmeet-chhabra"><img src="https://github.com/ashmeet-chhabra.png" width="50px" loading="lazy" title="ashmeet-chhabra" style="border-radius:50%;margin:5px;" alt="ashmeet-chhabra" /></a><a href="https://github.com/davideciaccio"><img src="https://github.com/davideciaccio.png" width="50px" loading="lazy" title="davideciaccio" style="border-radius:50%;margin:5px;" alt="davideciaccio" /></a><a href="https://github.com/fgrabowski"><img src="https://github.com/fgrabowski.png" width="50px" loading="lazy" title="fgrabowski" style="border-radius:50%;margin:5px;" alt="fgrabowski" /></a><a href="https://github.com/ghost"><img src="https://github.com/ghost.png" width="50px" loading="lazy" title="ghost" style="border-radius:50%;margin:5px;" alt="ghost" /></a><a href="https://github.com/guitolino"><img src="https://github.com/guitolino.png" width="50px" loading="lazy" title="guitolino" style="border-radius:50%;margin:5px;" alt="guitolino" /></a><a href="https://github.com/itsdakshjain"><img src="https://github.com/itsdakshjain.png" width="50px" loading="lazy" title="itsdakshjain" style="border-radius:50%;margin:5px;" alt="itsdakshjain" /></a><a href="https://github.com/kush-mehra1"><img src="https://github.com/kush-mehra1.png" width="50px" loading="lazy" title="kush-mehra1" style="border-radius:50%;margin:5px;" alt="kush-mehra1" /></a><a href="https://github.com/lamiyacodes"><img src="https://github.com/lamiyacodes.png" width="50px" loading="lazy" title="lamiyacodes" style="border-radius:50%;margin:5px;" alt="lamiyacodes" /></a><a href="https://github.com/saksham-stack"><img src="https://github.com/saksham-stack.png" width="50px" loading="lazy" title="saksham-stack" style="border-radius:50%;margin:5px;" alt="saksham-stack" /></a><a href="https://github.com/shauryavardhan1307"><img src="https://github.com/shauryavardhan1307.png" width="50px" loading="lazy" title="shauryavardhan1307" style="border-radius:50%;margin:5px;" alt="shauryavardhan1307" /></a><a href="https://github.com/shreyasmene06"><img src="https://github.com/shreyasmene06.png" width="50px" loading="lazy" title="shreyasmene06" style="border-radius:50%;margin:5px;" alt="shreyasmene06" /></a><a href="https://github.com/swarnimbandekar"><img src="https://github.com/swarnimbandekar.png" width="50px" loading="lazy" title="swarnimbandekar" style="border-radius:50%;margin:5px;" alt="swarnimbandekar" /></a><a href="https://github.com/vishaal2002"><img src="https://github.com/vishaal2002.png" width="50px" loading="lazy" title="vishaal2002" style="border-radius:50%;margin:5px;" alt="vishaal2002" /></a><a href="https://github.com/yashstack-bot"><img src="https://github.com/yashstack-bot.png" width="50px" loading="lazy" title="yashstack-bot" style="border-radius:50%;margin:5px;" alt="yashstack-bot" /></a>
|
|
472
|
+
<!-- CONTRIBUTORS_END -->
|
|
473
|
+
|
|
474
|
+
## Disclaimer
|
|
475
|
+
|
|
476
|
+
This tool downloads and installs software from python.org. Always verify the authenticity of downloaded files. The authors are not responsible for any issues arising from Python installations.
|