Skip to main content

pypins

Professional Runtime Package Manager for Python

pypins provides a clean, secure, and powerful interface to manage Python packages directly from your code.
It eliminates the need for fragile subprocess calls while offering a simple and elegant API.

import pypins as pip

# Install packages programmatically
pip.install("requests>=2.31")

# Smart installation (only if missing)
pip.ensure_installed(["pandas", "numpy"])

# Check for outdated packages
outdated = pip.outdated()
for pkg in outdated[:3]:
    print(f"{pkg['name']}: {pkg['current_version']} → {pkg['latest_version']}")

# Full control with custom indexes
pip.install("torch", index_url="https://download.pytorch.org/whl/cpu")

pypins is designed for developers who need reliable, auditable, and maintainable dependency management inside applications, scripts, notebooks, and deployment tools.

Key Features

  • Simple and Intuitive API — Perform complex pip operations with minimal code.
  • Security First — Executes pip through the official python -m pip interface. No shell execution.
  • Robust Input Validation — Prevents invalid or malicious package specifiers.
  • Advanced Capabilities — Support for custom indexes, constraints, editable installs, and requirements files.
  • High Performance — Leverages importlib.metadata for fast read operations.
  • Rich Feedback — Detailed PipResult objects and a complete exception hierarchy.
  • Special Utilities — outdated(), ensure_installed(), install_requirements(), and more.
  • Zero External Dependencies — Lightweight and reliable in any environment.
  • Production Ready — Fully typed, well-documented, and suitable for critical systems.

Installation

pip install pypins

Quick Examples

Basic Usage

from pypins import pip

# Install
pip.install("requests")

# Install with version constraint
pip.install("django>=4.2,<5.0")

# Install multiple
pip.install(["fastapi", "uvicorn[standard]"])

# Upgrade
pip.install("requests", upgrade=True)

# Quiet mode
pip.install("black", quiet=True)

Working with Custom Mirrors

pip.install(
    "torch",
    index_url="https://download.pytorch.org/whl/cpu"
)

# Multiple extra indexes
pip.install(
    "some-private-package",
    extra_index_urls=[
        "https://pypi.company.com/simple",
        "https://another-mirror.com/simple"
    ]
)

Checking Installed Packages

from pypins import pip

print(pip.is_installed("requests"))        # True / False
print(pip.get_version("requests"))         # "2.32.3"

for pkg in pip.list_installed():
    print(f"{pkg.name}=={pkg.version}")

print(pip.freeze())   # requirements.txt style string

Error Handling

from pypins import pip, PipError, PackageNotFoundError

try:
    pip.install("nonexistent-package-xyz")
except PipError as e:
    print("Installation failed:", e)
    print("stderr:", e.stderr)

API Reference

Function Description Returns
install() Install package(s) PipResult
uninstall() Uninstall package(s) PipResult
is_installed() Check if package exists bool
get_version() Get installed version str
list_installed() List all installed packages list[PackageInfo]
freeze() Get pip freeze output str

Security

  • Never uses shell=True
  • All package names are validated
  • Uses the current Python interpreter (sys.executable -m pip)
  • No arbitrary command execution

Roadmap (planned)

  • Async support (async def install(...))
  • Progress callbacks / rich live output
  • requirements.txt support (pip.install_requirements("requirements.txt"))
  • Virtual environment management helpers
  • Better error messages with suggestions

License

MIT License


pypins — Because running pip from code should be simple and safe.

Metadata

Release files for pypins 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypins 1.0.0
File Size Uploaded Provenance Actions
pypins-1.0.0.tar.gz 9.3 kB Without provenance Details for pypins-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pypins 1.0.0
File Interpreter ABI Platform Actions
pypins-1.0.0-py3-none-any.whl Python 3 none any Details for pypins-1.0.0-py3-none-any.whl

Total release size: 17.3 kB

Release files / pypins-1.0.0.tar.gz

Download URL pypins-1.0.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f78f7f1a66934c2c51d9e24d3fdaaa8936c8c3dab1ec7c2c2e6195b800a166e9
BLAKE2b-256 checksum
How to use checksums
2b2969814d87894200d4958e0e97b4b185f986af6b11599d0ee93e8630950150
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / pypins-1.0.0-py3-none-any.whl

Download URL pypins-1.0.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e458250d384b0bf66ab39806a9ff8358732efa1727c1be7b4f94673f2449c2ff
BLAKE2b-256 checksum
How to use checksums
d806fd71a3d5e17c4f42f8ef249ba288b288fe42d9994378cf5151a19dc8cf81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Security for pypins 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page