Safely merge multiple Python virtual environments by reconstructing dependencies.
Project description
pyvenvmerge
A Python CLI utility for safely merging multiple virtual environments through deterministic dependency reconstruction instead of direct venv modification.
Features
Environment Analysis
- Virtual environment validation
- Python version compatibility checks
- Dependency extraction using
pip freeze
Dependency Resolution
- PEP 508 compliant parsing
- Specifier-based merging
- Conflict detection and resolution
- Semantic dependency validation
Merge Intelligence
- Dependency graph analysis
- Conflict classification
- Risk analysis and compatibility scoring
- Dry-run diagnostics
Dependency Support
- PyPI packages
- Editable installs (
-e) - Git dependencies (
git+...) - File dependencies (
package @ file://...)
Reliability
- Deterministic environment rebuild
- Two-phase installation pipeline
- Integrity verification using
pip check - JSON merge reports
Reporting & Reproducibility
- Structured merge report generation
- JSON report export
- Deterministic lockfile export
- Resuable report generation layer
- Serializable merge metadata artifacts
Example
pyvenvmerge envA envB --dry-run
Example output:
Compatibility Score : 82/100
Risk Level : MEDIUM
Warnings:
⚠ pandas requires numpy<2.0 but selected version is 2.4.2
Installation
pip install pyvenvmerge
Usage
pyvenvmerge envA envB -o mergedEnv
Save structured data
pyvenvmerge envA envB --dry-run --save-report report.json
Export deterministic lockfile
pyvenvmerge envA envB --dry-run --export-lock requirements.lock
Conflict Resolution Strategies
pyvenvmerge envA envB -o mergedEnv --strategy highest
# default
pyvenvmerge envA envB -o mergedEnv --strategy strict
pyvenvmerge envA envB -o mergedEnv --strategy unpinned
Dry-Run Mode
Preview the merge plan without creating an environment:
pyvenvmerge envA envB --dry-run
JSON Report
pyvenvmerge envA envB --dry-run --report json
Limitations
Current limitations:
- No deep resolution for Git/file dependencies.
- Environment markers are partially evaluated.
- Extra merging is basic.
- Advanced specifiers such as !=, ~=, === are not fully optimized yet.
- Complex specifier combination are not fully optimized yet.
These will be improved in future versions.
Documentation
Detailed documentation:
License
MIT License
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 pyvenvmerge-1.0.0.tar.gz.
File metadata
- Download URL: pyvenvmerge-1.0.0.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df23869652b75ed067b7e3c665d17cff8d8662cce0370667549d70440dd19935
|
|
| MD5 |
490f1e1d8df779232854f13b5cdbb4fb
|
|
| BLAKE2b-256 |
1c7762477379304f6b7764af4f413583c0c2624a715771358014bfb5572f236f
|
File details
Details for the file pyvenvmerge-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyvenvmerge-1.0.0-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fc7ac481e42309bb0a0fd6de30fafc5dab7df1857c3d3ebd3d0c4061dffb6c5
|
|
| MD5 |
a59424f0b62a1dcca655841f71f3d0b5
|
|
| BLAKE2b-256 |
179927d7a858948d905a221542f2c43c072de924b09a726245c78389efb83e7e
|