Metadata-Version: 2.4
Name: dpncy
Version: 1.0.3
Summary: The Intelligent Python Dependency Resolver
Home-page: https://github.com/patrickryankenneth/dpncy
Author: Patrick Ryan
Author-email: patrickryankenneth@gmail.com
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: redis
Requires-Dist: packaging
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# dpncy - The Intelligent Python Dependency Resolver

### One environment. Infinite packages/versions. No duplicates/downgrades ever again.

<table>
<tr>
<td width="50%">

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 

</td>
<td width="50%"> 
  
[![Build Status](https://github.com/patrickryankenneth/dpncy/actions/workflows/test.yml/badge.svg)](https://github.com/patrickryankenneth/dpncy/actions)  

</td>
</tr>
</table>

--- 

Tired of creating a new virtual environment for every small dependency conflict? I am too.

dpncy ends dependency hell by introducing **"selective version bubbles."**

It's a revolutionary package manager that allows you to run multiple versions of a library in a single environment. It intelligently isolates *only* the conflicting packages while sharing all compatible dependencies. The result is one clean environment, infinite versions, and zero waste.

---

<table>
<tr>
<td width="50%">

## 🌍 Real-World Example
Imagine maintaining a Flask app that needs:
- `flask-login==0.4.1` (legacy)
- `requests==2.28.0` (new)
- `scikit-learn==0.24` (ML)

**Traditional:**  
3 separate environments  
**dpncy:**  
Single environment  

</td>
<td width="50%">

## 🏢 Enterprise Impact
| Metric               | Before dpncy | After dpncy |
|----------------------|--------------|-------------|
| CI/CD Complexity     | 5 envs       | 1 env       |
| Storage Overhead     | 8.7GB        | 1.2GB       |
| Setup Time           | 22 min       | 60 sec      |

</td>
</tr>
</table>

---

## See It In Action

This is the output of the live interactive demo. Notice how we seamlessly switch from `flask-login==0.6.3` to `0.4.1` at runtime, without ever changing the environment.

<details>
<summary>🚀 Click to view the full interactive demo output </summary>

## dpncy Demo: Seamless Version Switching

Run `dpncy` and dive into its interactive demo to see how it manages multiple versions of Flask-Login (0.6.3 and 0.4.1) in one environment—without pip reinstalls!

🎉 Welcome to dpncy - Multi-version intelligent package installer!
=================================================================
🔍 Checking system requirements...
✅ Redis connection: OK

🎯 What would you like to do?
1. 🚀 Run interactive demo
2. 📦 Install a package
3. 📊 View system status
4. 📖 Show help
5. ⚙️ Configure settings

Enter your choice (1-5): 1

🎬 Starting interactive demo...
Continue with demo? (y/N): y
📥 Installing demo dependencies...
✅ Demo dependencies installed!

🚀 DPNCY Interactive Demo 🚀
--------------------------
1. Install Flask-Login 0.6.3 normally
2. Use dpncy to install 0.4.1
3. Show version switching in action

🔧 STEP 1: Normal pip install
✅ Flask-Login 0.6.3 installed!

✨ STEP 2: dpncy install
📸 Snapshotting environment...
⚙️ Installing flask-login==0.4.1...
🛡️ Downgrade protection activated!
  - Isolated flask-login v0.4.1 to bubble
  - Restored flask-login v0.6.3 in main environment
✅ Environment restored and conflicts isolated!
🧠 Updating knowledge base...
✅ Knowledge base updated.

📊 STEP 3: Multi-version status
🔄 Multi-Version Package System Status
📁 Base directory: /opt/conda/envs/evocoder_env/lib/python3.11/site-packages/.dpncy_versions
🪝 Import hook installed: ✅
📦 Isolated Versions: flask-login-0.4.1 (4.7 MB)

🔥 DEMO READY! Switching versions...

=== Testing Flask-Login 0.6.3 ===
🌀 Activating flask-login==0.6.3...
Active Flask-Login: 0.6.3
✅ Works!

=== Testing Flask-Login 0.4.1 ===
🌀 Activating flask-login==0.4.1...
✅ Activated bubble: /opt/conda/envs/evocoder_env/lib/python3.11/site-packages/.dpncy_versions/flask-login-0.4.1
Active Flask-Login: 0.4.1
✅ Works!

🎉 dpncy switched versions seamlessly—no pip needed!

Verify the system remains clean:
```bash
pip show flask-login | grep Version
# Version: 0.6.3 ← Original version intact!
```

</details>



---

## 🎯 Why dpncy Changes Everything

## 🏢 Enterprise Scenario
*"Our data science team needed 3 versions of TensorFlow (1.15, 2.4, 2.9) 
in the same JupyterHub environment,
dpncy made it work with zero conflicts."*

**Before dpncy:**
- Need Django 3.2 for one project, Django 4.0 for another? → Two virtual environments
- Legacy package needs requests==2.20.0 but your app needs 2.28.0? → Dependency hell
- Want to test your code against multiple package versions? → Complex CI/CD setup

**With dpncy:**
- One environment, infinite package versions
- Zero conflicts, zero waste
- Runtime version switching without pip

---

<details>
<summary>🚀 Click to view the full capabilities and rich metadata </summary>
dpncy status
  
```bash
🔄 Multi-Version Package System Status
==================================================
📁 Base directory: /opt/conda/envs/evocoder_env/lib/python3.11/site-packages/.dpncy_versions
🪝 Import hook installed: ✅

📦 Isolated Package Versions (1):
  📁 flask-1.1.2 (0.6 MB)
```


dpncy list
```bash
📋 Found 223 packages:
  🛡️💚 absl-py v2.3.1 - Abseil Python Common Libraries, see https://github.com/ab...
  🛡️💚 absl_py v2.3.1.dist - Abseil Python Common Libraries, see https://github.com/ab...
  🛡️💚 annotated-types v0.7.0 - Reusable constraint types to use with typing.Annotated
  🛡️💚 annotated_types v0.7.0.dist - Reusable constraint types to use with typing.Annotated
  🛡️💚 anyio v4.9.0 - High level compatibility layer for multiple asynchronous ...
  🛡️💚 argon2-cffi v25.1.0 - Argon2 for Python
  🛡️💚 argon2-cffi-bindings v21.2.0 - Low-level CFFI bindings for Argon2
(continues on..............)
```

dpncy list click
```bash
📋 Found 1 package:
  🛡️💚 click v8.2.1 - Composable command line interface toolkit
```

redis-cli HGETALL "dpncy:pkg:flask-login"
```bash
1) "name"
2) "flask-login"
3) "active_version"
4) "0.6.3"
```

redis-cli SMEMBERS "dpncy:pkg:flask-login:installed_versions"
```bash
1) "0.6.3"
2) "0.4.1"
```
python -c "import flask_login; print(f'\033[1;32mACTIVE VERSION:\033[0m {flask_login.__version__}')"
```bash
ACTIVE VERSION: 0.6.3
```
pip show flask-login | grep Version
```bash
Version: 0.6.3
```

redis-cli HGETALL "dpncy:pkg:flask-login:0.4.1"
```bash
 1) "help_text"
 2) "No executable binary found."
 3) "Requires-Python"
 4) ">=3.7"
 5) "security.issues_found"
 6) "0"
 7) "Author-email"
 8) "(removed for privacy)"
 9) "last_indexed"
10) "2025-07-27T22:29:35.715001"
11) "Metadata-Version"
12) "2.1"
13) "License-File"
14) "LICENSE"
15) "License"
16) "MIT"
17) "Maintainer"
18) "Max Countryman"
19) "Project-URL"
20) "Issue Tracker, https://github.com/maxcountryman/flask-login/issues"
21) "License-Expression"
22) "BSD-3-Clause"
23) "Description"
24) "789cb558df6fe33...(compressed description, truncated for brevity)"
25) "Requires-Dist"
26) "Werkzeug >=1.0.1"
27) "security.audit_status"
28) "checked_in_bulk"
29) "security.report"
30) "[]"
31) "health.import_check.version"
32) "0.6.3"
33) "Description-Content-Type"
34) "text/markdown"
35) "health.import_check.importable"
36) "True"
37) "Home-page"
38) "https://github.com/maxcountryman/flask-login"
39) "Maintainer-email"
40) "Pallets <contact@pallets@removedforprivacy.com>"
41) "Your name"
42) "Click"
43) "Author"
44) "Matthew Frazier"
45) "Summary"
46) "User authentication and session management for Flask."
47) "[please donate today]"
48) "https://palletsprojects.com/donate"
49) "dependencies"
50) "[\"Flask >=1.0.4\", \"Werkzeug >=1.0.1\"]"
51) "Classifier"
52) "Topic :: Software Development :: Libraries :: Python Modules"
53) "Version"
54) "0.6.3"
55) "name"
56) "flask-login"
57) "Name"
58) "Flask-Login"
59) "cli_analysis.subcommands"
60) "[]"
61) "[contrib]"
62) "https://palletsprojects.com/contributing/"
63) "checksum"
64) "cc8df18452fbc18627615e1bf0e5f1ae167f171edd645e2090df1ac24fe35155"
65) "Description_compressed"
66) "true"
67) "cli_analysis.common_flags"
68) "[]"
```

</details>

---

## 🧠 Key Features

- **Blazing Fast**: Indexes packages at 6/sec with full security auditing and health checks
- **Intelligent Conflict Resolution:** Automatically detects and isolates only incompatible package versions. No more bloated environments.
- **Surgical Version Bubbles:** Creates lightweight, isolated "bubbles" for conflicting packages while sharing all other compatible libraries.
- **Dynamic Import Hook:** Seamlessly switches between the system version and an isolated bubble version at runtime.
- **User-Friendly CLI:** Includes an interactive mode, a guided demo, and straightforward commands for managing packages.
- **Redis-Powered Indexing:** Uses Redis for a fast and persistent index of all your package metadata.

---

## 🚀 Getting Started: The 1-Minute Demo

The best way to see the power of `dpncy` is to run the interactive demo.

# Prerequisites (install these first):
```bash
sudo apt-get install redis-server  # Ubuntu/Debian
```
```bash
brew install redis                 # macOS
```
# Start Redis
```bash
redis-server
```
# Verify Redis is running
```bash
redis-cli ping  # Should return "PONG"
  ```
**Note**: Install `tqdm` for progress bars during metadata building:
```bash
pip install tqdm
  ```
# 1. Clone the repository
```bash
git clone https://github.com/patrickryankenneth/dpncy.git
cd dpncy
```

# 2. Install dpncy with its demo dependencies
# The '.' installs the code in the current directory
```bash
pip install ".[demo]"
```
# 3. Run the interactive demo!
# This will guide you through installing conflicting versions and show the magic.
```bash
dpncy demo
```

---


## 🛠️ Installation

For general use after you've tried the demo:

```bash
# Clone the repo
git clone https://github.com/patrickryankenneth/dpncy.git
cd dpncy

# Install using pip
pip install .
```

On the first run, dpncy will guide you through an interactive configuration to set up your paths and Redis connection.

---

## ⚙️ Usage

```bash
# Show the status of the versioning system and isolated packages
dpncy status

# Get detailed information about a specific package
dpncy info flask

# List all packages known to dpncy
dpncy list

# Use dpncy to install a package with version management
dpncy install "requests==2.20.0"
```
---

## How It Works

dpncy operates on a simple but powerful principle:

1. **Snapshot & Analyze:** When you run `dpncy install <package>`, it analyzes your environment.

2. **Standard Install:** Performs a standard pip install.

3. **Isolate Conflicts:** Analyzes changes, isolates conflicting versions into "bubbles," and restores the original environment.

4. **Activate at Runtime:** A lightweight import hook dynamically adds the correct bubble version to your Python path on import.

---

## 🔧 Configuration

dpncy is designed to be configured interactively on its first run, so you don't need to manually create a configuration file.

For advanced users or automated setups, the configuration is stored at:

```text
~/.config/dpncy/config.json
```

<details>
<summary>Example config.json</summary>

```json
{
    "paths_to_index": ["/home/user/.venv/bin"],
    "site_packages_path": "/home/user/.venv/lib/python3.11/site-packages",
    "redis_host": "localhost",
    "redis_port": 6379,
    "redis_key_prefix": "dpncy:pkg:",
    "python_executable": "/home/user/.venv/bin/python",
    "multiversion_base": "/home/user/.venv/lib/python3.11/site-packages/.dpncy_versions"
}
```

</details>

---

## 🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

---

## 📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

---

[![Security Audit](https://img.shields.io/badge/Security-100%25_Verified-brightgreen)](https://github.com/your-repo)

---
