Skip to main content

Advanced requirements.txt generator for Django. Self-healing, PyPI dynamic mapping, and venv validation.

Project description

django-req-generator

Generador avanzado de requirements.txt / Advanced requirements.txt generator


🇲🇽 Español

Descripción

Este plugin para Django sirve para empaquetar tu proyecto e instalarlo de forma limpia en otros entornos (Docker, Servidores de Producción, CI/CD). Está específicamente diseñado para manejar proyectos Django complejos donde no basta con un simple pip freeze.

Características Principales

  • 🔍 Análisis Estático (AST): Detecta imports reales en todo el árbol de tu código fuente.
  • 🧩 Inspección Profunda de Django: Analiza INSTALLED_APPS, MIDDLEWARE, DATABASES (detecta drivers como oracledb), y CACHES (detecta django-redis y pymemcache).
  • 🧹 Limpieza Automática: Filtra la librería estándar de Python y tus propios módulos locales (apps, models, serializers, etc.).
  • 🔗 Resolución Dinámica PyPI: No usa mapeos manuales fallidos; pregunta directamente a la API de PyPI para encontrar el paquete correcto.
  • 🤖 Auto-curación Interactiva: Durante la validación, si detecta un módulo faltante (ModuleNotFoundError) o un fallo de Pip, te pregunta si quieres corregirlo y reintenta la validación en caliente.
  • 🧪 Validación en Venv: Crea un entorno virtual temporal para asegurar que el archivo generado permite que el proyecto arranque.
  • 🌎 Multilingüe: Soporta comandos y mensajes en Español e Inglés.

Instalación

  1. Instala el paquete:
pip install django-req-generator
  1. Regístralo en Django: Añade django_req_generator a tus INSTALLED_APPS en tu archivo settings.py:
# settings.py
INSTALLED_APPS = [
    ...,
    'django_req_generator',
    ...,
]

Nota: El plugin se detectará automáticamente a sí mismo y se incluirá en tu requirements.txt al generar el archivo.

Uso

# Generación estándar con backup automático
python manage.py generate_reqs

# Generación con validación y settings específicos
python manage.py generate_reqs --validate --settings=mi_proyecto.settings_docker

# Modo Desarrollo (instala el plugin desde código fuente en la validación)
python manage.py generate_reqs --validate -d /ruta/al/plugin

🇺🇸 English

Description

This Django plugin is designed to package your project and install it cleanly in other environments (Docker, Production Servers, CI/CD). It is specifically built for complex Django projects where a simple pip freeze isn't enough.

Key Features

  • 🔍 Static Analysis (AST): Deep-scans your entire source code to detect actual imports.
  • 🧩 Deep Django Inspection: Analyzes INSTALLED_APPS, MIDDLEWARE, DATABASES (detects drivers like oracledb), and CACHES (detects django-redis and pymemcache).
  • 🧹 Automatic Cleanup: Filters out Python's standard library and your own local modules (apps, models, serializers, etc.).
  • 🔗 Dynamic PyPI Resolution: Replaces outdated manual mappings by querying the PyPI API directly for the correct package name.
  • 🤖 Interactive Self-Healing: During validation, if a missing module (ModuleNotFoundError) or a Pip failure is found, it asks if you want to fix it and retries the validation on the fly.
  • 🧪 Venv Validation: Creates a temporary virtual environment to ensure the generated file allows the project to start.
  • 🌎 Multilingual: Supports commands and console messages in both Spanish and English.

Installation

  1. Install the package:
pip install django-req-generator
  1. Register it in Django: Add django_req_generator to your INSTALLED_APPS in your settings.py file:
# settings.py
INSTALLED_APPS = [
    ...,
    'django_req_generator',
    ...,
]

Note: The plugin will automatically detect itself and include it in your requirements.txt when generating the file.

Usage

# Standard generation with automatic backup
python manage.py generate_reqs

# Generation with validation and specific settings
python manage.py generate_reqs --validate --settings=my_project.settings_docker

# Development Mode (installs plugin from source during validation)
python manage.py generate_reqs --validate -d /path/to/plugin

Made with ❤️ and AI Collaboration | Creado con ❤️ y el apoyo de IA

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

django_req_generator-0.1.5.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

django_req_generator-0.1.5-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file django_req_generator-0.1.5.tar.gz.

File metadata

  • Download URL: django_req_generator-0.1.5.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for django_req_generator-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f699e406e9974df69d1c72df80dc0c713907d3586d5eb1ad49480223be36bb2c
MD5 81e4f267f36962fa6a0fb637563f3726
BLAKE2b-256 fb2426f9310a085799e956dbcf5b387b79c25a2de94c7b6d609bd0a63a36758f

See more details on using hashes here.

File details

Details for the file django_req_generator-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for django_req_generator-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3a022f2b401bea8fddd1c4d78ab1e8f8918480aae795afb50a0f6b91eaa70c44
MD5 c620deb1f38dce6951157ebfcc099091
BLAKE2b-256 d4addf70456b308a8a27f82bbdeb6d87a121f35afb9ee5a5f7ca6f79fd4a7f99

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