Efficient Python package manager with centralized storage and zero duplication
Project description
PyPM - Python Package Manager
A revolutionary Python package manager that eliminates package duplication across environments by using centralized storage with environment-specific manifests.
๐ฏ Problem Solved
Traditional Python package managers create separate copies of packages for each virtual environment, leading to:
- Massive storage waste from duplicated packages
- Slower environment setup due to redundant downloads
- Difficult package management across multiple projects
๐ก Solution
PyPM stores each package version only once in a central location and uses lightweight environment dictionary files to specify which versions each environment should use.
Key Features
- โ Zero Duplication: Each package version stored only once
- โ Environment Manifests: JSON-based dictionary files specify package versions
- โ Efficient Loading: Only specified packages are loaded per environment
- โ Storage Savings: Dramatically reduces disk usage
- โ Fast Setup: No redundant package downloads
- โ No Dependencies: Pure Python standard library
๐ฆ Installation
Install from PyPI (Recommended)
pip install pypm-manager
Install from Source
git clone https://github.com/yourusername/pypm.git
cd pypm
pip install -e .
Verify Installation
pypm --help
๐ Architecture
PyPM System
โโโ Central Store (~/.pypm_store/)
โ โโโ packages/
โ โ โโโ <hash1>/ (e.g., numpy 1.24.0)
โ โ โโโ <hash2>/ (e.g., pandas 2.0.0)
โ โ โโโ <hash3>/ (e.g., numpy 1.23.0)
โ โโโ metadata.json
โ
โโโ Environments (~/.pypm_envs/)
โโโ project1.json (manifest with package versions)
โโโ project2.json
โโโ ml_project.json
๐ Quick Start
After installation, the pypm command is available globally:
Basic Usage
1. Add Packages to Central Store
# Add a package version to the central store
pypm add numpy 1.24.0 /path/to/numpy/files
# Add another version
pypm add numpy 1.23.0 /path/to/numpy-1.23.0/files
# Add different packages
pypm add pandas 2.0.0 /path/to/pandas/files
pypm add requests 2.31.0 /path/to/requests/files
2. Create Environments
# Create a new environment
#### 2. Create Environments
```bash
# Create a new environment
pypm create-env project1 -d "Data analysis project"
# Create another environment
pypm create-env ml_project -d "Machine learning project"
3. Install Packages to Environments
# Install specific package versions to project1
pypm install project1 numpy 1.24.0
pypm install project1 pandas 2.0.0
# Install different versions to ml_project
pypm install ml_project numpy 1.23.0
pypm install ml_project requests 2.31.0
4. Verify & Activate
# Verify all packages are available
pypm verify project1
# Generate activation script
pypm activate project1 -o activate_project1.py
๐ CLI Commands
Package Management
# Add package to central store
pypm add <name> <version> <path>
# Remove package from store
pypm remove <name> <version>
# List all packages in store
pypm list
# Show store information
pypm info
Environment Management
# Create environment
pypm create-env <name> [-d description]
# Delete environment
pypm delete-env <name>
# List all environments
pypm list-envs
# Show environment details
pypm show-env <name>
# Install package to environment
pypm install <env> <package> <version>
# Uninstall package from environment
pypm uninstall <env> <package>
# Verify environment
pypm verify <name>
# Create activation script
pypm activate <name> [-o output.py]
๐ป Programmatic Usage
from pypm import CentralPackageStore, EnvironmentManager, PackageLoader
# Initialize components
store = CentralPackageStore()
env_manager = EnvironmentManager()
loader = PackageLoader(store, env_manager)
# Add packages to central store
store.add_package("numpy", "1.24.0", "/path/to/numpy")
store.add_package("pandas", "2.0.0", "/path/to/pandas")
# Create environment
env_manager.create_environment("my_project", "Data analysis")
env_manager.add_package_to_env("my_project", "numpy", "1.24.0")
env_manager.add_package_to_env("my_project", "pandas", "2.0.0")
# Load and activate environment
loader.activate_environment("my_project")
# Now you can import the packages
import numpy as np
import pandas as pd
๐ Example Workflow
# 1. Setup central store with packages
pypm add numpy 1.24.0 C:/packages/numpy-1.24.0
pypm add pandas 2.0.0 C:/packages/pandas-2.0.0
pypm add scikit-learn 1.3.0 C:/packages/sklearn-1.3.0
# 2. Create two projects with different requirements
pypm create-env data_analysis -d "Data analysis project"
pypm create-env ml_model -d "ML model training"
# 3. Configure each environment
pypm install data_analysis numpy 1.24.0
pypm install data_analysis pandas 2.0.0
pypm install ml_model numpy 1.24.0
pypm install ml_model scikit-learn 1.3.0
# 4. Verify environments
pypm verify data_analysis
pypm verify ml_model
# 5. View what's in store
pypm list
pypm info
# 6. Generate activation scripts
pypm activate data_analysis
pypm activate ml_model
๐ Environment Manifest Example
Each environment is stored as a JSON file:
{
"name": "project1",
"description": "Data analysis project",
"packages": {
"numpy": "1.24.0",
"pandas": "2.0.0",
"requests": "2.31.0"
},
"metadata": {
"created": true
}
}
๐พ Storage Savings Example
Traditional approach:
- Environment 1: numpy (50MB) + pandas (100MB) + requests (5MB) = 155MB
- Environment 2: numpy (50MB) + scikit-learn (200MB) = 250MB
- Total: 405MB (numpy duplicated)
PyPM approach:
- Central Store: numpy (50MB) + pandas (100MB) + requests (5MB) + scikit-learn (200MB) = 355MB
- Environment files: 2 ร ~1KB = 2KB
- Total: 355MB + 2KB
- Savings: 50MB (12% reduction with just 2 environments)
With more environments, savings multiply significantly!
๐๏ธ Project Structure
Packagemanager/
โโโ central_store.py # Central package storage management
โโโ environment_manager.py # Environment manifest handling
โโโ package_loader.py # Package loading and activation
โโโ pypm.py # Command-line interface
โโโ __init__.py # Package initialization
โโโ README.md # This file
โโโ examples/ # Example usage scripts
โโโ example_basic.py
โโโ example_advanced.py
๐ง Requirements
- Python 3.7+
- No external dependencies (uses only standard library)
๐ Use Cases
- Multi-project development: Share packages across multiple projects
- Testing multiple versions: Test code against different package versions
- CI/CD pipelines: Faster environment setup in automated builds
- Educational environments: Create multiple student environments efficiently
- Production deployments: Reduce container image sizes
๐ Notes
- Package paths are stored as absolute paths in the central store
- Environment manifests are lightweight JSON files (~1KB each)
- The system uses content-addressable storage (hash-based naming)
- Compatible with existing Python packages
๐ Future Enhancements
- Automatic package download from PyPI
- Dependency resolution
- Virtual environment integration
- Package verification and checksums
- Export/import environment configurations
- Cloud storage backend support
๐ License
This project is open source and available for educational and commercial use.
๐ค Contributing
Contributions are welcome! This is a proof-of-concept that can be extended with additional features.
PyPM - Making Python package management efficient, one environment at a time! ๐
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 pypm_manager-1.0.0.tar.gz.
File metadata
- Download URL: pypm_manager-1.0.0.tar.gz
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
daddd8b52e82bdd0314ca55d0c05b08fd95ae7fabe9dac3b3c17e75fa80b65df
|
|
| MD5 |
7a893ed605ab8030e8b5a977eed2f2d4
|
|
| BLAKE2b-256 |
6f882994b83e449e4a1c9ea4cf1bbbc19f9ae2bdb038d71a0a36942da12b45ce
|
File details
Details for the file pypm_manager-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pypm_manager-1.0.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e321b9ea0c40fe0fdbe07f7d7f6561169a7e8e12f28720ea97ed8a011b1fde68
|
|
| MD5 |
625598043771f28c9df47fbb1ac5856f
|
|
| BLAKE2b-256 |
f94228b2ab5fc4c5966ea19a5046d202b20eb11e084bfdbdfad697841f7e390e
|