A Python-based CLI package manager that works like npm.
Project description
pkpm - The Python Package Manager
A Python-based CLI package manager that works like npm, designed to bring modern package management workflows to the Python ecosystem. pkpm simplifies dependency management, virtual environments, graph visualization, and environment variable handling.
Features
- Project Initialization: Instantly scaffold
pkpm.json, create an isolated virtual environment (.pkpm/venv), and setup.gitignore/.pkpmignore. - NPM-like CLI: Familiar commands like
install,remove,update, andrun. - Smart Visualizations: Built-in AST-based import scanning to visualize your project's dependency graph in the terminal or export it as an interactive HTML graph.
- Environment Management: Auto-generate
.envfiles based on static analysis of your source code. - Shell Auto-activation: Optional shell hooks to automatically activate your virtual environment when you
cdinto your project directory.
Installation
You can install pkpm from PyPI using pip:
pip install pkpm
Usage
🚀 Getting Started
pkpm init
Initialize a new project in the current directory.
- Generates a
pkpm.jsonmanifest file. - Creates an isolated virtual environment in
.pkpm/venv. - Generates
.gitignoreand.pkpmignorefiles.
📦 Package Management
pkpm install [packages]...
Install one or multiple packages.
- If no packages are provided, it installs all dependencies listed in
pkpm.json. - Uses
--dry-runto preview what would be installed without modifying the system.
pkpm remove <packages>...
Uninstall one or multiple packages from the project's virtual environment.
- Uses
--dry-runto preview removal.
pkpm update [packages]...
Update specific packages or all packages if none are specified.
pkpm run <script>
Execute a custom script defined in the scripts section of your pkpm.json.
🔍 Visualization & Analysis
pkpm viz [OPTIONS]
Visualize your project's structure or dependencies.
--mode folder(default): Prints a visual folder tree in the terminal.--mode imports: Scans the AST to detect imports and generates an interactive, browser-based HTML dependency graph. Highlights circular imports if detected!--depth <int>: Set the maximum depth for the visualization (0 for infinite).
pkpm scan
Perform a fast scan of the project and print a file-level import graph directly in your terminal.
pkpm tree
Show the package dependency tree (similar to npm list). Available with --depth option.
pkpm doctor
Detect conflicts with existing package managers globally or locally within your project.
--global: Scan the globalpkpmregistry for conflicts.
⚙️ Environment Variables (pkpm env)
pkpm includes experimental tools to statically analyze your code for os.environ or python-dotenv usage and scaffold .env files automatically.
pkpm env generate
Auto-generate .env files based on a project scan.
--env <name>: Specify the environment target (e.g.,development,production). Defaults todevelopment.--all: Generate variants fordevelopment,production, andtestsimultaneously.
pkpm env check
Validate your current .env file against the variables actually expected by the codebase.
pkpm env export
Export your .env configuration.
--format <docker|shell|json>: Export format.
💻 Shell Integration (pkpm shell)
Say goodbye to manually typing source venv/bin/activate!
pkpm shell init
Initialize shell hooks for auto-activation. Supports bash, zsh, and fish.
--shell <name>: Target shell (default isbash). Provides a script snippet to add to your~/.bashrcor~/.zshrc. Once added, changing into apkpminitialized directory will automatically activate your environment.
pkpm shell status
Check if you currently have a pkpm virtual environment active.
📄 License
MIT
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 pkpm-1.0.0.tar.gz.
File metadata
- Download URL: pkpm-1.0.0.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a215ddaefadc7df6e66c17527415f64355ee926cb63ab9e5d164a1edebb429ab
|
|
| MD5 |
69deb61a6d022e27761322c2bb4e3117
|
|
| BLAKE2b-256 |
cbbc726f89ce5bbe057e21728f4dae1da0bde87b378c20eedbe911f3fbe49108
|
File details
Details for the file pkpm-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pkpm-1.0.0-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7c67eccdff6627e81b55c394b295cc54eca3b6cfaa4138ef3676c3647240556
|
|
| MD5 |
d273ee8c4123d1a47d7a371d0a7f5988
|
|
| BLAKE2b-256 |
9d3fe6da8b5390a85feaee0f8d893d9e69a44e3e8dd6b82bdf43e775857c446b
|