PyDepM — Python Dependency Manager
Project description
PyDepM — Python Dependency Manager
PyDM is a modern Python project manager that simplifies dependency management, script execution, and project construction with an intuitive command-line interface.
Key Features
- 🚀 Easy project initialization with
pydep init - 📦 Dependency management with
pypackage.json - 🛠️ Create standalone executables with PyInstaller
- 📝 Project configuration with
pyproject.toml(PEP 621) for module-type projects - 🔧 Run scripts with
pydep run - 🌍 Global mode for system-wide tool installation
- ⚡ Fast and efficient dependency resolution
- 🔍 Security audit for dependencies
- 📊 Outdated dependencies visualization
- 🎛️ Advanced
pyproject.tomlcustomization for module projects
Requisitos
- Python 3.9 o superior
- pip (incluido con Python)
Instalación
pip install pydepm
Quick Start Guide
Create a New Project
# Initialize a new application project
pydep init my-app --type app
# Or initialize a new module project
pydep init my-module --type module
# Navigate to the project directory
cd my-app
Advanced pyproject.toml Configuration (Module Projects Only)
For module-type projects, you can customize the generated pyproject.toml in two ways:
- Structured Format: Define sections using JSON keys in
[section]format - Raw Format: Provide direct TOML content in the
_rawfield
Example pypackage.json with custom pyproject configuration:
{
"type": "module",
"name": "my-module",
"version": "0.1.0",
"pyproject": {
"[project.scripts]": {
"my-command": "my_module.cli:main",
"another-command": "my_module.other:cli"
},
"[tool.black]": {
"line-length": 100,
"target-version": ["py39"]
},
"[tool.mypy]": {
"python_version": "3.9",
"strict": true
},
"_raw": "# Direct TOML content here\n[tool.poetry]\nname = \"my-package\"\nversion = \"0.1.0\"\ndescription = \"My package description\"\n"
}
}
When you run pydep convert --to toml, this will generate a pyproject.toml file with all the custom configurations merged together.
Manage Dependencies
# Add dependencies
pydep add requests pytest
# Añadir dependencias de desarrollo
pydep add --dev black flake8
# Instalar dependencias
pydep install
# Actualizar dependencias
pydep update
# Eliminar dependencias
pydep remove nombre-del-paquete
Ejecutar scripts
Añade scripts a pypackage.json:
{
"scripts": {
"iniciar": "python main.py",
"probar": "pytest",
"formatear": "black ."
}
}
Ejecuta los scripts con:
pydep run iniciar
pydep run probar
pydep run formatear
Construir ejecutables independientes (solo para proyectos de aplicación)
Añade la configuración de compilación a pypackage.json:
{
"executable": {
"target": "main.py",
"parameters": ["--onefile"],
"output": "dist/ejecutable"
}
}
Construye el ejecutable:
pydep --helpd
Estructura del proyecto
Proyectos de aplicación (type: "app" en pypackage.json)
- Estructura de proyecto simple
- Enfoque en la creación de ejecutables independientes
- Sin
pyproject.tomlpor defecto (puede habilitarse con"pyprojectUse": true) - Ideal para aplicaciones de usuario final
Proyectos de módulo (type: "module" en pypackage.json)
- Estructura de paquete Python
- Incluye
pyproject.tomlpara metadatos del paquete - Soporta puntos de entrada (entry points) y scripts de consola
- Ideal para bibliotecas y paquetes reutilizables
Comandos disponibles
Inicialización y configuración
pydep init [NOMBRE] --type {app|module}: Crea un nuevo proyectopydep install [-e|--editable] [--global]: Instala dependencias del proyecto
Gestión de dependencias
pydep add [PAQUETE]... [--dev] [--global]: Añade paquetes al proyectopydep remove [PAQUETE]... [--global]: Elimina paquetes del proyectopydep update [PAQUETE]... [--global]: Actualiza paquetespydep outdated: Muestra paquetes desactualizadospydep audit [--json] [--extended]: Audita vulnerabilidades de seguridadpydep list: Lista paquetes instaladospydm why PAQUETE: Muestra por qué está instalado un paquete
Construcción y publicación
pydep --helpd: Construye el proyecto (ejecutable o paquete)pydm publish [--repository NOMBRE]: Publica el paquete en PyPI
Ejecución
pydep run SCRIPT: Ejecuta un script definido en pypackage.jsonpydm version: Muestra la versión de PyDM
Utilidad pydepx
PyDM incluye una utilidad pydepx para ejecutar herramientas Python con salida enriquecida:
# Ejecutar black con salida mejorada
pydepx black .
# Ejecutar un módulo como script
pydepx -m http.server 8000
# Ejecutar tests con pytest
pydepx -m pytest tests/
pypackage.json
El archivo pypackage.json es el archivo de configuración principal de PyDM. Aquí tienes un ejemplo completo:
{
"type": "app",
"name": "mi-proyecto",
"version": "0.1.0",
"description": "Una descripción de mi proyecto",
"authors": [{"name": "Tu Nombre"}],
"license": "MIT",
"dependencies": {
"requests": "^2.31.0"
},
"devDependencies": {
"pytest": "^8.0.0",
"black": "^24.0.0"
},
"scripts": {
"start": "python main.py",
"test": "pytest"
},
"executable": {
"target": "main.py",
"parameters": ["--onefile"],
"output": "dist/ejecutable"
},
"useGlobalDeps": false,
"pyprojectUse": false
}
Uso avanzado
Modo global
Puedes instalar paquetes globalmente con la bandera --global:
# Instalar un paquete globalmente
pydep add -g black
# Listar paquetes globales
pydep list --global
Variables de entorno
PyDM respeta las siguientes variables de entorno:
PYDM_VERBOSE: Activa el modo detallado (equivalente a--logs)PYDM_GLOBAL_DEPS: Usa dependencias globales (equivalente a--global)
Contribuir
¡Las contribuciones son bienvenidas! Por favor, lee nuestra guía de contribución antes de enviar pull requests.
Licencia
Este proyecto está licenciado bajo la Licencia MIT - ver el archivo LICENSE para más detalles.
Agradecimientos
- A la comunidad de Python por su increíble ecosistema
- Proyectos que nos inspiran: npm, pip, pipenv, poetry
- A todos los contribuyentes que ayudan a mejorar PyDM
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydepm-1.0.1.tar.gz.
File metadata
- Download URL: pydepm-1.0.1.tar.gz
- Upload date:
- Size: 30.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6387833e0d73e10de3fb5421f2a58e66b10f7d6f6e19bbd38241649d48045988
|
|
| MD5 |
357e00952f6066f41a62d6c370d728f1
|
|
| BLAKE2b-256 |
ce1cba9f7ab42fb08aed25ea08955471f7cbc10278e3f27e4bae38e3fa2a3d81
|
File details
Details for the file pydepm-1.0.1-py3-none-any.whl.
File metadata
- Download URL: pydepm-1.0.1-py3-none-any.whl
- Upload date:
- Size: 29.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a033ab8202f86db4ae63eb4cfc287150e1aced2a520d1b8a1904457ea20366ad
|
|
| MD5 |
255f89f5adffba718efaf12a4644d2db
|
|
| BLAKE2b-256 |
6a596e15ac69de87466d9c9de92aabc4fad677835a54a13ab8bbf6d5f224db6e
|