Configuration
PPM uses a singleproject.toml
file to configure your entire polyglot project. This file defines dependencies, scripts, and project metadata in a simple, readable format.
Basic Structure
Every PPM project starts with aproject.toml
file in the root directory:
Project Metadata
The[project]
section contains basic information about your project:
Field Descriptions
Field | Type | Required | Description |
---|---|---|---|
name | String | ✅ | Project name, used for identification |
version | String | ✅ | Semantic version (e.g., “1.0.0”) |
description | String | ❌ | Brief project description |
author | String | ❌ | Project author or maintainer |
license | String | ❌ | License identifier (e.g., “MIT”, “GPL-3.0”) |
repository | String | ❌ | Repository URL |
JavaScript Dependencies
Define JavaScript and Node.js dependencies in the[dependencies.js]
section:
Version Specifications
PPM supports standard npm semantic versioning:Format | Example | Description |
---|---|---|
Exact | "1.2.3" | Exact version only |
Caret | "^1.2.3" | Compatible within major version |
Tilde | "~1.2.3" | Compatible within minor version |
Range | ">=1.2.0 <2.0.0" | Version range |
Latest | "latest" | Always use latest version |
Scoped Packages
Include scoped packages with quotes:Python Dependencies
Define Python packages in the[dependencies.python]
section:
Python Version Constraints
PPM supports PEP 440 version specifiers:Format | Example | Description |
---|---|---|
Exact | "==1.2.3" | Exact version |
Compatible | "~=1.2.3" | Compatible release |
Greater/Less | ">=1.2.0" | Minimum version |
Exclude | "!=1.2.3" | Exclude specific version |
Caret (npm-style) | "^1.2.3" | Compatible within major version |
Package Extras
Include optional dependencies with extras:Scripts
Define custom scripts in the[scripts]
section to automate common tasks:
Script Features
- Cross-platform: Scripts work on Windows, macOS, and Linux
- Environment-aware: Python scripts run in the virtual environment
- Parallel execution: Use
&
to run scripts simultaneously - Sequential execution: Use
&&
to run scripts in sequence - Namespacing: Use
:
to group related scripts
Built-in Script Variables
PPM provides several built-in variables for scripts:Variable | Description |
---|---|
$PPM_PROJECT_NAME | Project name from project.toml |
$PPM_PROJECT_VERSION | Project version from project.toml |
$PPM_PROJECT_ROOT | Absolute path to project root |
$PPM_PYTHON_PATH | Path to the Python virtual environment |
Environment Configuration
Python Virtual Environment
PPM automatically manages Python virtual environments, but you can customize the behavior:Node.js Configuration
Configure Node.js behavior for JavaScript projects:Advanced Configuration
Development Dependencies
Separate development-only dependencies:Environment-Specific Configuration
Define different configurations for different environments:Custom Package Sources
Configure custom package registries:Lock File Configuration
Control lock file behavior:File Structure Examples
Here are some complete examples for different project types:Full-Stack Web Application
Data Science Project
Microservices Project
Validation and Best Practices
Configuration Validation
PPM validates yourproject.toml
file and provides helpful error messages:
- Missing required fields (
name
,version
) - Invalid semantic versions
- Conflicting dependency versions
- Invalid script syntax
Best Practices
- Use semantic versioning for your project version
- Pin exact versions in production environments
- Group related scripts with namespaces (e.g.,
test:frontend
,test:backend
) - Document complex scripts with comments
- Keep dependencies organized by purpose (framework, utilities, development)
- Use lock files for reproducible builds
- Separate dev and production dependencies
Configuration Tips
- Start simple: Begin with basic dependencies and add complexity as needed
- Use consistent naming: Follow consistent patterns for script names
- Test your scripts: Ensure all scripts work across different platforms
- Version control: Always commit your
project.toml
and lock files - Document environment setup: Include setup instructions in your README
Migration from Other Tools
From package.json
Convert existing Node.js projects:From requirements.txt
Convert existing Python projects:From Both
For existing polyglot projects:Your
project.toml
file is the heart of your PPM project. Take time to structure it well, and you’ll enjoy a smooth development experience across your entire polyglot application.