PyDepM — Python Dependency Manager
Project description
PyDepM — Python Dependency Manager
PyDepM 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 - 📝 Project configuration with
pyproject.toml(PEP 621) for module-type projects - 📦 Build standalone executables with PyInstaller using
pydep buildfor application projects andpydep buildgenerates pyproject.toml and build with python -m build for module 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
Requirements
- Python 3.9 or higher
- pip (included with Python)
Installation
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",
"description": "This is a simple module autogenerated with PyDM.",
"authors": [
{
"name": "PyDM User"
}
],
"license": "MIT",
"dependencies": {},
"scripts": {
"start": "python -m my-module"
},
"cli": {
"my-module": {
"name": "my-module",
"target": "my-module.main:main"
}
},
"pyproject": {
"[project.scripts]": {
"my-module": "my-module.main:main"
},
"[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
# Add development dependencies
pydep add --dev black flake8
# Install dependencies
pydep install
# Update dependencies
pydep update
# Remove dependencies
pydep remove nombre-del-paquete
# Build
pydep build
Ejecutar scripts
Add scripts to pypackage.json:
{
"scripts": {
"iniciar": "python main.py",
"probar": "pytest",
"formatear": "black ."
}
}
Run scripts with:
pydep run iniciar
pydep run probar
pydep run formatear
Build standalone executables (only for application projects)
Add the compilation configuration to pypackage.json:
{
"executable": {
"target": "main.py",
"parameters": ["--onefile"],
"output": "dist/ejecutable"
}
}
Build the executable:
pydep build
Project structure
Application projects (type: "app" in pypackage.json)
- Simple project structure
- Focus on creating standalone executables
- Without
pyproject.tomlby default (can be enabled with"pyprojectUse": true) - Ideal for final user applications
Module projects (type: "module" in pypackage.json)
- Python package structure
- Includes
pyproject.tomlfor package metadata - Supports entry points and console scripts
- Ideal for reusable libraries and packages
Commands
Initialization and configuration
pydep init [NAME] --type {app|module}: Creates a new projectpydep install [-e|--editable] [--global]: Installs project dependenciespydep build: Build the project
Dependency management
pydep add [PACKAGE]... [--dev] [--global]: Adds packages to the projectpydep remove [PACKAGE]... [--global]: Removes packages from the projectpydep update [PACKAGE]... [--global]: Updates packagespydep outdated: Shows outdated packagespydep audit [--json] [--extended]: Audits security vulnerabilitiespydep list: Lista paquetes instaladospydep why PAQUETE: Muestra por qué está instalado un paquete
Execution
pydep run SCRIPT: Ejecuta un script definido en pypackage.jsonpydep version: Muestra la versión de PyDM
Utility pydepx
PyDM includes a utility pydepx to run Python tools with enriched output:
# Run black with improved output
pydepx black .
# Run a module as a script
pydepx -m http.server 8000
# Run tests with pytest
pydepx -m pytest tests/
pypackage.json
The pypackage.json file is the main configuration file of PyDM. Here is a complete example:
{
"type": "app",
"name": "my-project",
"version": "0.1.0",
"description": "A description of my project",
"authors": [{"name": "Your Name"}],
"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
}
Advanced usage
Global mode
You can install packages globally with the -g|--global flag:
# Install a package globally
pydep add -g black
# List .venv or global packages
pydep list
Environment variables
PyDepM respects the following environment variables:
PYDM_VERBOSE: Activates verbose mode (equivalent to--logs)PYDM_GLOBAL_DEPS: Uses global dependencies (equivalent to--global)
Contributing
Contributions are welcome! Please read our contribution guide before submitting pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- To the Python community for their incredible ecosystem
- Projects that inspire us: npm, pip, pipenv, poetry
- To all contributors who help improve 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.3.tar.gz.
File metadata
- Download URL: pydepm-1.0.3.tar.gz
- Upload date:
- Size: 29.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e273f203c9f86585b4165f83b9b4ad150d05e9e1495211a8e8d944c47f22805
|
|
| MD5 |
97c3d7d264f1662e6c75de0b5f7c3b3c
|
|
| BLAKE2b-256 |
fb9c61d3856b90e139eacbc0fc0d35fde5ca9b20268f79e1a64bb660f684e9d2
|
File details
Details for the file pydepm-1.0.3-py3-none-any.whl.
File metadata
- Download URL: pydepm-1.0.3-py3-none-any.whl
- Upload date:
- Size: 29.8 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 |
ac1bbb0fa20baf408a9d6704d0ee6b82704edf150efded18312867cb1b390a24
|
|
| MD5 |
b99b8f602c92e6d393b6b3b7563d9dc0
|
|
| BLAKE2b-256 |
1cdc168c61d71b6d3d241ec533a4f7c72c7817cb6010b4753e5536d29fc77257
|