Skip to main content

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.

PyPI version Python 3.7+ License: MIT

๐ŸŽฏ 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

  1. Multi-project development: Share packages across multiple projects
  2. Testing multiple versions: Test code against different package versions
  3. CI/CD pipelines: Faster environment setup in automated builds
  4. Educational environments: Create multiple student environments efficiently
  5. 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

pypm_manager-1.0.0.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypm_manager-1.0.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

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

Hashes for pypm_manager-1.0.0.tar.gz
Algorithm Hash digest
SHA256 daddd8b52e82bdd0314ca55d0c05b08fd95ae7fabe9dac3b3c17e75fa80b65df
MD5 7a893ed605ab8030e8b5a977eed2f2d4
BLAKE2b-256 6f882994b83e449e4a1c9ea4cf1bbbc19f9ae2bdb038d71a0a36942da12b45ce

See more details on using hashes here.

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

Hashes for pypm_manager-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e321b9ea0c40fe0fdbe07f7d7f6561169a7e8e12f28720ea97ed8a011b1fde68
MD5 625598043771f28c9df47fbb1ac5856f
BLAKE2b-256 f94228b2ab5fc4c5966ea19a5046d202b20eb11e084bfdbdfad697841f7e390e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page