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), te pregunta si quieres añadirlo 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 is found (ModuleNotFoundError), it asks if you want to add 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.4.tar.gz (11.2 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.4-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_req_generator-0.1.4.tar.gz
  • Upload date:
  • Size: 11.2 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.4.tar.gz
Algorithm Hash digest
SHA256 204a17e8ff5577a16ddde778f6cf153828e37e4d608cc67e0dc2c3d414a0c613
MD5 7bcf6ee970c0a87ae1c0f37cffb94d0f
BLAKE2b-256 ac3111aa487b2a340c9ca674c0785d11ea4d72b5bb38ea2d8521d8138cdf03ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_req_generator-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 62825b5ccffcecd085bf5998515996c05e3fc60e98d02562476557a3bb492ce5
MD5 97b23d3048ef8108fc26aed61c02cf5d
BLAKE2b-256 ab1c7ff96378ead77bc21b7c998fd027304577b5c3e4206ab582bb6a39d980e2

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