Skip to main content

Do Interactive Git deploY - Deploy Python applications from Git repositories in isolated environments with interactive menu

Project description

DIGY - Do Interactive Git deploY

Docker Configuration

DIGY supports running projects in isolated Docker containers with RAM-based storage for maximum performance. This ensures that:

  • Projects run in complete isolation
  • No local filesystem changes are made
  • Resources are cleaned up automatically
  • Execution is as fast as possible using RAM storage

Configuration

DIGY uses a manifest file (digy/manifest.yml) to configure Docker settings. You can override these settings either:

  1. In the manifest file
  2. Using environment variables
  3. Through command-line arguments

Volume Types

DIGY supports two types of volumes:

  1. RAM Volumes

    • Stored in RAM for maximum speed
    • Automatically cleaned up after use
    • Size configurable in GB
    • Example: /tmp/digy_ram
  2. Local Volumes

    • Mount local directories into containers
    • Can be read-only or read-write
    • Useful for:
      • Persistent data storage
      • Local development
      • Configuration files

Usage Examples

  1. Basic Usage
# Run a repository from GitHub
digy run github.com/pyfunc/digy

# Run with 4GB RAM
digy run --ram-size 4 github.com/pyfunc/digy
  1. Local File Mount
# Mount local directory into container
digy run --mount ./data:/app/data:ro github.com/pyfunc/digy
  1. Custom Docker Configuration
# Build and run with custom Dockerfile
digy build -f Dockerfile .
digy run --image myapp:latest github.com/pyfunc/digy

# Or in one command
digy run --build -f Dockerfile github.com/pyfunc/digy

Performance Tips

  1. RAM Size

    • Default: 2GB (--ram-size 2)
    • Adjust based on project needs
    • Example: digy run --ram-size 4 github.com/user/repo
  2. Volume Mounts

    • Read-only mount: --mount ./config:/app/config:ro
    • Read-write mount: --mount ./data:/app/data:rw
    • RAM disk: --ram-disk /cache
  3. Cleanup

    • Automatic cleanup: --cleanup
    • Remove all data: digy clean --all
    • List resources: digy ls

Environment Configuration

DIGY supports configuration through environment variables. You can create a .env file in your project root based on the example:

# Initialize with default configuration
digy init

Key environment variables:

  • DIGY_RAM_SIZE: RAM disk size in GB (default: 1)
  • DIGY_RAM_PATH: RAM disk mount path (default: /tmp/digy_ram)
  • DIGY_DOCKER_IMAGE: Default Docker image (default: python:3.12-slim)
  • DIGY_LOCAL_VOLUMES: Local volume mounts (format: host:container:mode)
  • DIGY_RAM_VOLUMES: RAM volume mounts
  • DIGY_ENV_VARS: Default environment variables
  • DIGY_AUTO_CLEANUP: Automatic cleanup after execution (true/false)
  • DIGY_LOG_LEVEL: Logging level (DEBUG, INFO, WARNING, ERROR)

Example .env file:

DIGY_RAM_SIZE=2
DIGY_DOCKER_IMAGE=python:3.12-slim
DIGY_LOCAL_VOLUMES=/app:/app:rw
DIGY_LOG_LEVEL=INFO

Security

  • All execution happens in isolated containers
  • No changes are made to the host system
  • RAM volumes are ephemeral
  • Local mounts can be made read-only
  • Environment variables can be configured per project

Troubleshooting

  1. Not enough RAM

    • Increase RAM size in manifest
    • Use --ram-size flag
    • Monitor container memory usage
  2. Volume permissions

    • Check Docker volume permissions
    • Use --user flag to match UID
    • Verify mount points are accessible
  3. Resource cleanup

    • Use --cleanup flag
    • Check Docker volume usage
    • Monitor RAM disk usage

Basic Usage

DIGY is a tool for deploying Python applications from Git repositories in isolated environments with interactive menu support.

Features

  • Load repositories from Git
  • Run Python applications in isolated environments
  • Interactive menu for easy navigation
  • RAM-based storage for maximum speed
  • Docker container isolation
  • Local volume support
  • Automatic cleanup

Installation

# Install globally
pip install digy

# Or use Poetry
poetry install

DIGY to narzędzie do deploymentu aplikacji Python z repozytoriów Git w izolowanych środowiskach z interaktywnym menu nawigacyjnym.

🎯 Akronim DIGY

DIGY = Dynamic Interactive Git deploY

  • Dynamic - Dynamiczne ładowanie repozytoriów
  • Interactive - Interaktywne menu z nawigacją strzałkami
  • Git - Integracja z repozytoriami Git
  • deploY - Deployment w izolowanych środowiskach

🚀 Funkcjonalności

  • Szybkie ładowanie - Pobieranie repozytoriów bezpośrednio do pamięci RAM (100MB bazowo)
  • 🔒 Izolowane środowiska - Automatyczne tworzenie virtual environment
  • 🎮 Interaktywne menu - Nawigacja strzałkami z pomocą
  • 🐍 Uruchamianie kodu - Wykonywanie plików Python z wyświetlaniem wyników
  • 📊 Zarządzanie pamięcią - Monitoring i kontrola użycia RAM
  • 🔍 Inspekcja kodu - Przeglądanie plików z podświetlaniem składni

📦 Instalacja

# Instalacja z pip (gdy będzie dostępne)
pip install digy

# Lub instalacja z źródeł
git clone https://github.com/pyfunc/digy
cd digy
poetry install

🎯 Użycie

Podstawowe użycie

from digy import digy

# Załaduj repozytorium i uruchom interaktywne menu
digy('github.com/pyfunc/free-on-pypi')

Wiersz poleceń

# Proste uruchomienie (automatycznie wykrywa repo URL)
digy github.com/pyfunc/free-on-pypi

# Lub z komendą start
digy start github.com/pyfunc/free-on-pypi

# Z określoną gałęzią
digy start github.com/user/repo --branch develop

# Szybkie uruchomienie konkretnego pliku
digy run github.com/pyfunc/free-on-pypi pypi.py --args "from_file"

# Status i informacje
digy status
digy info

📋 Interaktywne Menu

Po załadowaniu repozytorium DIGY wyświetli interaktywne menu z opcjami:

📋 Show Repository Info    - Informacje o repozytorium
📖 View README            - Wyświetl plik README
🔧 Setup Environment      - Skonfiguruj środowisko
📁 List Python Files      - Lista plików Python
🚀 Run Python File        - Uruchom plik Python
🔍 Inspect File           - Zbadaj zawartość pliku
💻 Interactive Shell      - Interaktywna powłoka Python
🧹 Cleanup & Exit         - Wyczyść i wyjdź

Nawigacja

  • ↑/↓ lub j/k - Poruszanie się po menu
  • Enter - Wybór opcji
  • 1-8 - Bezpośredni wybór numerem
  • q - Wyjście

🔧 Przykład użycia z repozytorium free-on-pypi

from digy import digy

# Załaduj repozytorium
digy('github.com/pyfunc/free-on-pypi')

Po załadowaniu zobaczysz menu z opcjami uruchomienia:

  1. pypi.py from_file - Sprawdzenie nazw z pliku
  2. pypi.py generator - Generator kombinacji nazw
  3. github.py from_file - Sprawdzenie nazw na GitHub

Każde uruchomienie pokaże:

  • Pełne wyjście konsoli
  • Błędy (jeśli wystąpią)
  • Pytanie o uruchomienie kolejnej komendy

🎮 Funkcje interaktywne

Uruchamianie plików Python

  • Wybór pliku z listy
  • Podanie argumentów
  • Wyświetlenie pełnego wyjścia
  • Monitoring czasu wykonania

Inspekcja kodu

  • Podświetlanie składni
  • Informacje o pliku (linie, rozmiar)
  • Lista importów
  • Wykrywanie bloku if __name__ == "__main__"

Zarządzanie środowiskiem

  • Automatyczne tworzenie virtual environment
  • Instalacja requirements.txt
  • Instalacja pakietu w trybie deweloperskim
  • Monitoring pamięci RAM

🔧 Konfiguracja

Zmienne środowiskowe

export DIGY_MEMORY_BASE=100    # Bazowa alokacja pamięci w MB
export DIGY_TIMEOUT=300        # Timeout wykonania w sekundach

Programowa konfiguracja

from digy.loader import memory_manager

# Zmień bazową alokację pamięci
memory_manager.base_size_mb = 200

# Sprawdź dostępną pamięć
available = memory_manager.check_available_memory()
print(f"Dostępne: {available} MB")

📝 API Reference

digy(repo_url, branch='main')

Główna funkcja ładująca repozytorium i uruchamiająca interaktywne menu.

Parametry:

  • repo_url (str): URL repozytorium (github.com/user/repo lub pełny URL)
  • branch (str): Gałąź do pobrania (domyślnie 'main')

Zwraca:

  • str | None: Ścieżka do lokalnego repozytorium lub None przy błędzie

Klasa Deployer

Zarządza deploymentem aplikacji w izolowanych środowiskach.

Klasa InteractiveMenu

Zapewnia interaktywne menu z nawigacją strzałkami.

Klasa MemoryManager

Zarządza alokacją pamięci dla załadowanych repozytoriów.

🔍 Przykłady zaawansowane

Niestandardowa ścieżka

from digy.loader import GitLoader
from digy.deployer import Deployer

loader = GitLoader("/custom/path")
local_path = loader.download_repo("github.com/user/repo")
deployer = Deployer(local_path)

Programowe uruchamianie

from digy import digy
from digy.deployer import Deployer

# Załaduj bez menu
deployer = Deployer("/path/to/repo")
deployer.setup_environment()

# Uruchom konkretny plik
success, stdout, stderr = deployer.run_python_file("script.py", ["arg1", "arg2"])

🛠️ Rozwój

Wymagania deweloperskie

  • Python 3.8+
  • Poetry
  • Git

Instalacja deweloperska

git clone https://github.com/pyfunc/digy
cd digy
poetry install
poetry run pytest

Struktura projektu

digy/
├── digy/
│   ├── __init__.py      # Główny moduł
│   ├── loader.py        # Ładowanie repozytoriów
│   ├── deployer.py      # Deployment i uruchamianie
│   ├── interactive.py   # Interaktywne menu
│   ├── cli.py          # Interface wiersza poleceń
│   └── version.py      # Informacje o wersji
├── tests/              # Testy
├── pyproject.toml      # Konfiguracja Poetry
└── README.md          # Dokumentacja

📄 Licencja

Apache Software License - Zobacz plik LICENSE dla szczegółów.

🤝 Wkład

Zapraszamy do współpracy! Prosimy o:

  1. Forkowanie repozytorium
  2. Tworzenie feature branch
  3. Commit zmian
  4. Push do branch
  5. Tworzenie Pull Request

📞 Wsparcie


DIGY - Twój interaktywny asystent do deploymentu aplikacji Python! 🚀

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

digy-0.1.6.tar.gz (30.0 kB view details)

Uploaded Source

Built Distribution

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

digy-0.1.6-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

Details for the file digy-0.1.6.tar.gz.

File metadata

  • Download URL: digy-0.1.6.tar.gz
  • Upload date:
  • Size: 30.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.12 Linux/6.14.11-300.fc42.x86_64

File hashes

Hashes for digy-0.1.6.tar.gz
Algorithm Hash digest
SHA256 1d18645795c8d4d5d5b3d26f9938f2c00473219f73d4cad9179e2a53823967fc
MD5 eac61706e9cad6444c7ce9d8b854f7ce
BLAKE2b-256 c4cd62ba5aeb0872018e0cd3404b3fb84658f1304aebfb24e587bf92632ea38b

See more details on using hashes here.

File details

Details for the file digy-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: digy-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 32.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.12 Linux/6.14.11-300.fc42.x86_64

File hashes

Hashes for digy-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 46c8de15344b92385b3ac25fa1443f136af611b3cab78eeb6936edf8b8955ad6
MD5 dd8339c2c935d3c677cf534dcdb0c613
BLAKE2b-256 b20a5f37fdc8711a408d534bf070767ab337eebb8dac9f034e5e878c5a65af03

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