Detects and fixes broken absolute paths inside a Python virtual environment that has been moved or renamed.
Project description
venv-relocate
Detects and fixes broken absolute paths inside a Python virtual environment that has been moved or renamed.
The problem
When you move or rename the parent folder of a venv, all scripts inside it still hold the old absolute path hardcoded (shebangs, pyvenv.cfg, activation scripts). The venv becomes unusable even though the files are physically still there.
venv-relocate detects the mismatch between the recorded path and the real path, then rewrites the affected files in-place.
What it fixes
pyvenv.cfg- Shebangs of all scripts in
bin/(orScripts/on Windows) - Activation scripts:
activate,activate.csh,activate.fish,Activate.ps1
Installation
pip install venv-relocate
Usage
# Preview what would be changed (nothing is written)
venv-relocate .venv --dry-run
# Apply fixes (creates .bak backups by default)
venv-relocate .venv
# Apply without backups
venv-relocate .venv --no-backup
License
Copyright (c) 2026 Mehdi.A — MIT
Project details
Release history Release notifications | RSS feed
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 venv_relocate-0.4.0.tar.gz.
File metadata
- Download URL: venv_relocate-0.4.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1d4ce413e09ef4c396e79e62d938744500d71d19a02b387ca5a6669aa8fa9c5
|
|
| MD5 |
6f84d46af50baf75f73a9ae14e1791c3
|
|
| BLAKE2b-256 |
b589ad34c3970e9d5a864354c8eb348f357cb73f5902d5de36ac42b9f21cfba1
|
File details
Details for the file venv_relocate-0.4.0-py3-none-any.whl.
File metadata
- Download URL: venv_relocate-0.4.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db18e7e125f80aed5e899616d370436178e2e4a9d2bac7645e63501c606ed5b4
|
|
| MD5 |
9845aad45989892d09f8feb4208a370b
|
|
| BLAKE2b-256 |
92372f2318edb810762728146e291c55e037070f3e93531b6890489f312cad24
|