Dependency Management
PPM revolutionizes dependency management for polyglot projects by providing a unified interface for JavaScript and Python packages while maintaining the full power and compatibility of each ecosystem.Core Concepts
Unified Configuration
Instead of managing separatepackage.json
and requirements.txt
files, PPM uses a single project.toml
file:
Ecosystem Isolation
PPM maintains proper isolation between language ecosystems:- JavaScript packages →
node_modules/
directory - Python packages → Virtual environment (
.venv/
or custom location) - No cross-contamination between package managers
Smart Resolution
PPM intelligently resolves dependencies:- Analyzes your project structure
- Detects language-specific files (
package.json
,requirements.txt
) - Merges configurations when importing existing projects
- Maintains compatibility with existing toolchains
Installation Process
How ppm install
Works
1
Environment Detection
PPM scans your project to understand the structure:
- Checks for existing
package.json
orrequirements.txt
- Identifies language-specific directories
- Detects Node.js and Python versions
2
Environment Setup
For JavaScript:
- Uses existing
node_modules/
or creates new one - Respects
.nvmrc
or Node.js version constraints
- Creates virtual environment (
.venv/
by default) - Uses specified Python version or system default
- Activates environment for all Python operations
3
Dependency Installation
Parallel Installation:
- JavaScript packages installed via npm/yarn/pnpm
- Python packages installed via pip
- Both processes run simultaneously for speed
4
Lock File Generation
- Generates
ppm.lock
with exact dependency tree - Includes both JavaScript and Python package versions
- Ensures reproducible builds across environments
JavaScript Dependencies
Package Manager Support
PPM supports all major JavaScript package managers:Package Manager | Detection | Usage |
---|---|---|
npm | package-lock.json | Default choice |
Yarn | yarn.lock | Automatic detection |
pnpm | pnpm-lock.yaml | Automatic detection |
Version Specifications
PPM supports standard npm semantic versioning:Scoped Packages
Handle scoped packages with proper quoting:Development Dependencies
Separate production and development dependencies:Python Dependencies
Version Constraints
PPM supports PEP 440 version specifiers:Package Extras
Include optional dependencies with extras:Development Dependencies
Virtual Environment Management
PPM automatically manages Python virtual environments:Dependency Resolution
Conflict Resolution
When conflicts arise, PPM provides intelligent resolution:JavaScript Version Conflicts
JavaScript Version Conflicts
PPM uses npm’s resolution algorithm:Resolution:
- PPM installs React 18.2.x as primary dependency
some-lib
gets React 17.x in its own dependency tree- No conflict due to npm’s nested dependency structure
Python Version Conflicts
Python Version Conflicts
Python uses flat dependency resolution:Resolution:
- PPM installs numpy 1.24.x (satisfies both requirements)
- Reports successful resolution
- Warns if no compatible version exists
Cross-Language Dependencies
Cross-Language Dependencies
Some packages exist in both ecosystems:Resolution:
- Each package manager handles its own namespace
- No conflicts between different ecosystems
- PPM tracks versions separately
Dependency Updates
Keep dependencies up to date:Lock Files and Reproducibility
Lock File Format
PPM generates a comprehensive lock file:Reproducible Builds
Ensure identical environments across systems:Advanced Features
Custom Package Sources
Configure private registries:Environment-Specific Dependencies
Different dependencies for different environments:Dependency Analysis
Analyze your dependency tree:Migration Strategies
From Existing Projects
Import from existing dependency files:Gradual Migration
Migrate large projects incrementally:1
Start with PPM
2
Verify Compatibility
3
Update Workflows
Replace existing scripts with PPM commands:
4
Clean Up
Best Practices
Dependency Organization
-
Group related packages together with comments:
- Pin exact versions in production environments
- Use ranges for development to catch compatibility issues early
- Regular dependency updates with proper testing
- Security scanning as part of CI/CD pipeline
Performance Optimization
- Parallel installation (PPM does this automatically)
- Dependency caching in CI/CD systems
- Selective installation for specific environments
- Bundle analysis for JavaScript applications
PPM’s dependency management eliminates the complexity of polyglot projects while maintaining full compatibility with existing package managers and workflows. The unified approach saves time, reduces errors, and improves team productivity.