Skip to content

Commit 65151eb

Browse files
committed
Initial commit of omnipkg
0 parents  commit 65151eb

21 files changed

Lines changed: 3282 additions & 0 deletions

.github/workflows/publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# .github/workflows/publish-to-pypi.yml
2+
3+
name: Publish Python Package to PyPI
4+
5+
on:
6+
release:
7+
types: [published] # This workflow runs when a new release is published on GitHub
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
# Use the specific Python version you require, e-g-, 3.11
21+
python-version: '3.11'
22+
23+
- name: Install modern build dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install build twine
27+
# build - The modern, PEP 517 compliant build frontend
28+
# twine - The standard for securely uploading packages
29+
30+
- name: Build package
31+
# This command automatically finds and uses your pyproject.toml
32+
# It builds the source distribution (sdist) and the wheel.
33+
run: python -m build
34+
35+
- name: Publish package to PyPI
36+
env:
37+
# Use the secret you created in GitHub Settings -> Secrets -> Actions
38+
TWINE_USERNAME: __token__
39+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
40+
run: twine upload dist/*
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Security Audit
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
pip-audit:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.11'
22+
23+
- name: Install build tools and update setuptools
24+
run: |
25+
python -m pip install --upgrade pip setuptools wheel
26+
27+
- name: Install omnipkg with its dependencies
28+
run: |
29+
pip install ".[demo]"
30+
31+
- name: Run pip-audit
32+
uses: pypa/gh-action-pip-audit@v1.1.0
33+
# No 'with:' section needed if you're just doing a default scan

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Python bytecode
2+
*.pyc
3+
__pycache__/
4+
5+
# Distribution & build files
6+
/build/
7+
/dist/
8+
*.egg-info/
9+
.eggs/
10+
11+
# Virtual environments
12+
.venv/
13+
venv/
14+
env/
15+
16+
# IDE files
17+
.vscode/
18+
.idea/
19+
*.swp
20+
21+
# Temporary files & logs
22+
*.log
23+
*.tmp
24+
*.bak
25+
*.cast
26+
*.mp4
27+
*.gif
28+
*.svg
29+
30+
# PyPI and other secrets
31+
.env
32+
.DS_Store

COMMERCIAL_LICENSE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
omnipkg Commercial License
2+
===========================
3+
4+
This commercial license is intended for companies or individuals who wish to use omnipkg
5+
in a closed-source product, without complying with the AGPLv3 requirements.
6+
7+
By obtaining a commercial license, you are granted permission to:
8+
- Use omnipkg in proprietary or SaaS applications
9+
- Avoid the obligation to release your source code
10+
- Receive priority support and custom features (optional)
11+
12+
To inquire about commercial terms and pricing, please contact:
13+
14+
📧 omnipkg@proton.me
15+
16+
This license does NOT affect the open-source AGPLv3 version, which remains freely available.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) 2025 1minds3t
2+
3+
This file is part of `omnipkg`.
4+
5+
omnipkg is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU Affero General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
(at your option) any later version.
9+
10+
omnipkg is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU Affero General Public License for more details.
14+
15+
You should have received a copy of the GNU Affero General Public License
16+
along with omnipkg. If not, see <https://www.gnu.org/licenses/>.
17+
18+
---
19+
20+
For commercial licensing options or general inquiries, contact:
21+
📧 omnipkg@proton.me

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include README.md
2+
include LICENSE
3+
include requirements.txt

README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
2+
---
3+
4+
# omnipkg: The Intelligent Python Package Manager
5+
> One environment. Infinite versions. Zero conflicts.
6+
7+
<p align="center">
8+
<a href="https://github.com/omnipkg/omnipkg/actions/workflows/test.yml">
9+
<img src="https://img.shields.io/github/actions/workflow/status/omnipkg/omnipkg/test.yml?branch=main" alt="Build Status">
10+
</a>
11+
<a href="https://pypi.org/project/omnipkg/">
12+
<img src="https://img.shields.io/pypi/v/omnipkg.svg" alt="PyPI version">
13+
</a>
14+
<a href="https://www.gnu.org/licenses/agpl-3.0">
15+
<img src="https://img.shields.io/badge/License-AGPLv3-red.svg" alt="License: AGPLv3">
16+
</a>
17+
<a href="https://github.com/omnipkg/omnipkg/actions/workflows/security_audit.yml">
18+
<img src="https://img.shields.io/github/actions/workflow/status/omnipkg/omnipkg/security_audit.yml?branch=main" alt="Security Audit">
19+
</a>
20+
</p>
21+
22+
---
23+
24+
`omnipkg` lets you install *any version* of *any package* without breaking your environment, downgrading dependencies, or needing Conda, Docker, or `pipx`. **Dependency hell? Obliterated.**
25+
26+
---
27+
## See It to Believe It (30 Second Demo)
28+
29+
<!-- A GIF is the best format for this. It shows the tool in action without taking up a ton of space. -->
30+
![omnipkg Demo GIF](https://user-images.githubusercontent.com/your-image-url-here.gif)
31+
*This shows `omnipkg install old-package`, downgrade protection activating, and `omnipkg status` confirming both versions coexist.*
32+
33+
---
34+
35+
## 🚀 Features
36+
37+
- 🛡️ **Downgrade Protection**: Stops `pip` from nuking your environment by isolating conflicting versions into protected "bubbles."
38+
- 💾 **Intelligent Deduplication**: Saves up to 60% disk space on bubbled packages while keeping native C extensions stable.
39+
- 🧠 **Redis-Backed Knowledge Base**: Lightning-fast lookups for all package versions, dependencies, and security info.
40+
- 🔀 **Runtime Version Switching**: Activate any bubbled package version on the fly, even within the same script.
41+
- 🧪 **Battle-Tested**: Proven to handle massive environments (520+ packages, 95+ bubbles, 15.4GB+) without flinching.
42+
43+
---
44+
45+
## How Is This Possible?
46+
47+
When a downgrade is detected, `omnipkg` performs surgery:
48+
1. **Intercepts** the request.
49+
2. **Installs** the conflicting version and its entire dependency tree into a temporary, isolated location.
50+
3. **Creates** a space-efficient, deduplicated "bubble" in `.omnipkg_versions`.
51+
4. **Restores** the original package in your main environment.
52+
53+
The result: a perfectly stable global environment, with every version you've ever needed on standby.
54+
55+
<details>
56+
<summary><strong>🔬 Click for a Real-World Example: Downgrading PyTorch</strong></summary>
57+
58+
```bash
59+
# User wants to install an older torch version
60+
$ omnipkg install torch==2.7.0
61+
62+
# ... (omnipkg detects the downgrade) ...
63+
🛡️ DOWNGRADE PROTECTION ACTIVATED!
64+
-> Fixing downgrade: torch from v2.7.1 to v2.7.0
65+
🫧 Creating isolated bubble for torch v2.7.0
66+
✅ Success: Dependencies resolved via PyPI API.
67+
🧹 Creating deduplicated bubble...
68+
⚠️ Disabling deduplication for native package: torch
69+
✅ Bubble created: 16241 files copied, 3211 deduplicated.
70+
📊 Space efficiency: 16.5% saved.
71+
🔄 Restoring ‘torch’ to safe version v2.7.1 in main environment…
72+
73+
✅ Environment protection complete!
74+
```
75+
</details>
76+
77+
---
78+
79+
## Why Other Tools Fail
80+
81+
| Tool | The Task: `install old-conflicting-package` | Result |
82+
|---------------|---------------------------------------------|---------------------------------------|
83+
| `pip` || `ERROR: Cannot uninstall...` |
84+
| `conda` || `Solving environment...` (for hours) |
85+
| `poetry` | 💥 | `SolverProblemError` |
86+
| `uv` | 🚫 | `No solution found for the request` |
87+
| **`omnipkg`** || **`DOWNGRADE PROTECTION ACTIVATED!`** |
88+
89+
---
90+
91+
## 📜 Licensing
92+
93+
`omnipkg` is available under a dual-license model to suit different needs.
94+
95+
- **Community Edition (AGPLv3):** Perfect for individual developers, open-source projects, and academic use. If you use `omnipkg` in a project that is also open-source under a compatible license, you're good to go. The source code is available in this repository under the [GNU AGPLv3](LICENSE).
96+
97+
- **Commercial License:** Required for use in closed-source commercial software, proprietary systems, or for any organization that cannot comply with the terms of the AGPLv3. This license allows you to integrate `omnipkg` without the obligation to open-source your own code.
98+
99+
**To inquire about a commercial license, please contact:** [**omnipkg@proton.me**](mailto:omnipkg@proton.me)

examples/testflask.py

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import sys
2+
from importlib.metadata import version
3+
4+
def find_and_test_activation():
5+
"""Find the loader class and test version activation"""
6+
print("🔍 Finding loader class...")
7+
8+
try:
9+
# Import the loader module
10+
import omnipkg.loader as loader_module
11+
12+
# Find all classes in the module
13+
classes = []
14+
for name in dir(loader_module):
15+
obj = getattr(loader_module, name)
16+
if isinstance(obj, type) and hasattr(obj, 'activate_snapshot'):
17+
classes.append((name, obj))
18+
print(f" Found class with activate_snapshot: {name}")
19+
20+
if not classes:
21+
print(" ❌ No classes with activate_snapshot found")
22+
return False
23+
24+
# Use the first class found
25+
class_name, loader_class = classes[0]
26+
print(f" ✅ Using {class_name}")
27+
28+
# Create instance
29+
loader = loader_class()
30+
return loader
31+
32+
except Exception as e:
33+
print(f"❌ Error finding loader: {e}")
34+
return None
35+
36+
def test_version(flask_login_version, loader):
37+
print(f"\n=== Testing Flask-Login {flask_login_version} ===")
38+
39+
if not loader:
40+
print("❌ No loader available")
41+
return
42+
43+
try:
44+
# Call activate_snapshot on the instance
45+
success = loader.activate_snapshot(f"flask-login=={flask_login_version}")
46+
47+
if success:
48+
try:
49+
flask_version = version('flask')
50+
flask_login_version_actual = version('flask-login')
51+
print(f"Active Flask: {flask_version}")
52+
print(f"Active Flask-Login: {flask_login_version_actual}")
53+
print("✅ Works!")
54+
except Exception as e:
55+
print(f"✅ Activation succeeded, but version check failed: {e}")
56+
else:
57+
print("❌ Failed to activate snapshot")
58+
59+
except Exception as e:
60+
print(f"❌ Error during activation: {e}")
61+
import traceback
62+
traceback.print_exc()
63+
64+
if __name__ == "__main__":
65+
print("=== omnipkg VERSION SWITCHING DEMO ===")
66+
67+
# Show current state
68+
print("\n🔍 Current environment:")
69+
try:
70+
current_version = version('flask-login')
71+
print(f"Current flask-login: {current_version}")
72+
except:
73+
print("flask-login not found")
74+
75+
# Show available isolated versions
76+
print("\n📦 Available isolated versions:")
77+
try:
78+
from omnipkg.core import omnipkg
79+
omnipkg = omnipkg()
80+
omnipkg.show_multiversion_status()
81+
except Exception as e:
82+
print(f"❌ Error checking status: {e}")
83+
84+
# Find the loader
85+
loader = find_and_test_activation()
86+
87+
if loader:
88+
# Test version switching
89+
test_version("0.6.3", loader) # Current version
90+
test_version("0.4.1", loader) # Isolated version
91+
92+
print("\n💡 Notice how we switched versions without pip!")
93+
print("🎉 This is the power of omnipkg - dependency hell solved!")
94+
else:
95+
print("\n❌ Could not test version switching")
96+
print("But the isolation system is working - that's the main achievement! 🔥")

omnipkg/__init__.py

Whitespace-only changes.

omnipkg/__main__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import sys
2+
from .cli import main
3+
4+
# This runs the main function and ensures the script exits with the correct status code.
5+
if __name__ == "__main__":
6+
sys.exit(main())

0 commit comments

Comments
 (0)