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.local('github.com/pyfunc/free-on-pypi')

Wiersz poleceń

# Uruchomienie w środowisku lokalnym
digy local github.com/pyfunc/free-on-pypi

# Uruchomienie w pamięci RAM (najszybsze)
digy ram github.com/pyfunc/free-on-pypi

# Uruchomienie w kontenerze Docker
digy docker github.com/pyfunc/free-on-pypi

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

# Szybkie uruchomienie konkretnego pliku
digy ram 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 lokalnie
digy.local('github.com/pyfunc/free-on-pypi')

# Lub w pamięci RAM
digy.ram('github.com/pyfunc/free-on-pypi')

# Albo w Dockerze
digy.docker('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

# Uruchomienie z kodu Pythona
# Lokalnie
result = digy.local('github.com/user/repo', 'script.py', ['arg1', 'arg2'])

# W pamięci RAM
result = digy.ram('github.com/user/repo', 'script.py', ['arg1', 'arg2'])

# W Dockerze
result = digy.docker('github.com/user/repo', 'script.py', ['arg1', 'arg2'])

# Wynik zawiera (success, stdout, stderr)
print(f"Sukces: {result[0]}")
print(f"Wyjście: {result[1]}")
if result[2]:
    print(f"Błędy: {result[2]}")

🛠️ 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.7.tar.gz (30.6 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.7-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: digy-0.1.7.tar.gz
  • Upload date:
  • Size: 30.6 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.7.tar.gz
Algorithm Hash digest
SHA256 8f53b17d19b389c046f0089468450d85f29905f4dfe5229e178306057083b21a
MD5 39e733ff898ee74dc78e273da8448070
BLAKE2b-256 4054aade0aaa6a926dc9fc945b79c859fec67140ee499d81cfdb5ec4f0f95d09

See more details on using hashes here.

File details

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

File metadata

  • Download URL: digy-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 32.6 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2e831a9242ac0d1ea8cc4f18fe79613657967e8f078784bc6f1d8ababa0b28b4
MD5 d9649d55c7aec517c6bf2932de55ad8f
BLAKE2b-256 029e0e4c8eeaa38de5b424f4d826996e6fbdc44f9326ff2290f7bff4a38c86c1

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