Skip to main content

A zero-config CLI tool that automatically infers dependencies from your Python source code.

Project description

pypm

pypm – Python Package Manager

PyPI version Python versions License CI Code style: ruff

pypm is a zero-config CLI tool that automatically infers dependencies from your Python source code.

⚡ Lightning-Fast Performance

pypm is optimized for speed and efficiency:

  • Sub-200ms Inference: Scans and parses projects in milliseconds.
  • Overlapping Pipeline: Directory scanning and file parsing run in parallel.
  • Smart Caching: mtime-based import caching skips unchanged files.
  • Memory-Aware: Dynamic worker scaling for systems with limited RAM (e.g., 4GB).

🐍 Supported Python Versions

Version Status
Python 3.5 – 3.7 ✅ Compatible (vermin verified)
Python 3.8 – 3.14 ✅ Fully supported (CI tested)

🚀 Installation

Install from PyPI:

pip install pypm-cli

After installation, you can run:

pypm --help

⚡ Quick Start

Scan the current directory and generate/update pyproject.toml:

pypm infer

2️⃣ Benchmarking speed

Measure precisely how fast pypm is on your project:

pypm infer --bench

3️⃣ Dry Run (Preview Only)

See what would be added without modifying files:

pypm infer --dry-run

4️⃣ Infer + Install Dependencies

Infer and install packages automatically:

pypm install --bench

Note: If uv is available, it will be used for faster installs. Otherwise, it falls back to pip.

✨ Features

  • Blazing Fast: Sub-200ms execution on typical projects using overlapping I/O pipelines and mtime caching.
  • Offline-First Mapping: Uses a bundled database of 200+ popular packages to resolve dependencies instantly without network.
  • Smart Inference: Recursively scans your project for .py and .ipynb files and extracts all imports.
  • Automatic Resolution: Maps module names to actual PyPI packages (e.g., PILPillow, zmqpyzmq, attrattrs).
  • Standard Library Detection: Automatically ignores 150+ Python built-in and stdlib modules.
  • Try/Except Import Detection: Handles try: import ujson except: import json patterns correctly.
  • Database DSN Detection: Automatically detects database dependencies from connection strings.
  • Dynamic Import Detection: Catches importlib.import_module() and __import__() calls.
  • Framework-Aware: Adds extras for FastAPI, Django, Flask, Celery, SQLAlchemy, etc.
  • Modern Standards: Generates PEP 621–compliant pyproject.toml.
  • Secure: Validates all package names before shell execution, sanitizes PyPI URLs, hardens cache files.

🔒 Security

pypm 0.0.6 includes built-in protections:

  • Command injection prevention: All package names are validated against PEP 508 and checked for shell metacharacters before being passed to pip/uv.
  • URL sanitization: Import names are validated before being used in PyPI API URLs to prevent path traversal.
  • Cache hardening: Cache files use restrictive permissions (600 on Unix) and entries are validated on load.
  • Symlink protection: Symlinked directories and files are skipped during scanning.
  • File size limits: Files larger than 10MB are skipped to prevent resource exhaustion.

📌 Example Workflow

# Inside your Python project
pypm infer

# Review generated pyproject.toml
cat pyproject.toml

# Install dependencies
pypm install

🧠 Why pypm?

Manually maintaining dependencies leads to:

  • Duplicate effort
  • Forgotten imports
  • Mismatched environments
  • Dirty requirements.txt files

pypm makes your imports the single source of truth.

📚 Documentation

See full documentation in: docs/

🔧 Development Setup

If you want to contribute or run locally:

git clone https://github.com/Suriyakumardurai/pypm.git
cd pypm
pip install -e .[dev]

📦 Project

Available on PyPI: https://pypi.org/project/pypm-cli/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypm_cli-0.0.6.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypm_cli-0.0.6-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file pypm_cli-0.0.6.tar.gz.

File metadata

  • Download URL: pypm_cli-0.0.6.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for pypm_cli-0.0.6.tar.gz
Algorithm Hash digest
SHA256 86f6e07c06b52e38ad6f602124a9106b9dabd98fdc758083fc2b0f7d7d1b416d
MD5 31fdd4d0b8f02cbce173a76152e7ffb2
BLAKE2b-256 841a2976669a885f819bde69be4e893fa1093c34e097056688e97fa42a4fdc6a

See more details on using hashes here.

File details

Details for the file pypm_cli-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: pypm_cli-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for pypm_cli-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fd3b19cdd932a689649779aa3c4324931ed4d661c04fde9db35fc8cd09591138
MD5 f7b4ac4ccf11ff67f1330d5b8c768e86
BLAKE2b-256 d38296b07c0a674c73256a0c0f40003ae7f75ab47ec21111560abf7b7e05a9ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page