Skip to main content

AutoPyPack

AutoPyPack is a zero-config tool that automatically installs missing Python packages in your project — whether you're running a script, a notebook, or from the command line.

✨ Works as both a CLI tool, an importable module, and supports magic commands inside Jupyter notebooks.


🚀 Features

  • 📦 Automatically installs missing packages from import statements
  • 🧠 Smart mapping from import names to PyPI package names
  • 🛠️ Use it via CLI, Python, or inside Jupyter notebooks with %%autopypack magic
  • 🔍 Detects local modules and standard libraries — no false installs
  • 🧪 Includes dev tools for testing and linting

📦 Installation

Install from PyPI:

pip install autopypack

Or install from source:

git clone https://github.com/harshRaj1601/AutoPyPack
cd AutoPyPack
pip install -e .

🧠 Usage

✅ Method 1: As an importable module (auto-scans your script)

import AutoPyPack  # 👈 Automatically scans and installs packages

# Your usual imports
import numpy as np
import pandas as pd

Manual usage

import AutoPyPack

AutoPyPack.install()                        # Scan current directory
AutoPyPack.install("/path/to/project")      # Scan specific directory
AutoPyPack.scan_file("example.py")          # Scan a specific file

🧪 Method 2: Inside a Jupyter Notebook

Enable magic with a single import:

import AutoPyPack

Use it in a cell:

%%autopypack
import pandas as pd
import sklearn
print("All imported successfully!")

✨ AutoPyPack will:

  • Detect missing packages in that cell
  • Install them with pip
  • Execute the cell code

🖥️ Method 3: As a CLI tool

Install missing packages in your project

autopypack install
autopypack i  # Short form

List all external packages

autopypack list
autopypack l  # Short form

Options

  • --dir, -d: Target a specific directory (default: .)
  • --quiet, -q: Suppress detailed logs (useful for scripts)

Example: generate requirements.txt

autopypack list --quiet > requirements.txt

⚙️ How it works

  1. Scans .py or notebook cell for import statements
  2. Identifies unique modules
  3. Uses mappings.json to resolve correct package names
  4. Installs anything missing via pip
  5. Skips local modules and stdlib

🪪 License

MIT © Harsh Jaiswal


🔗 Links

PyPI Downloads

Metadata

Release files for autopypack 1.3.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 autopypack 1.3.0
File Size Uploaded Provenance
autopypack-1.3.0.tar.gz 23.8 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 45.8 kB

Release files / autopypack-1.3.0.tar.gz

Download URL autopypack-1.3.0.tar.gz
Size 23.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c7ba99040c26e99d6204ddaa3de1379c3c583ab4d8400a07a2e5af2dbfc1966f
BLAKE2b-256 checksum
How to use checksums
97b36b569bc9f9b3f9a63597a1764a7d0b48a6bd81d2ded0b395f3ec824a3bdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / autopypack-1.3.0-py3-none-any.whl

Download URL autopypack-1.3.0-py3-none-any.whl
Size 22.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a51fc5151906deedbd6d0ac8d7e878e9590d6cc4f1724ee184959a60c3893ce
BLAKE2b-256 checksum
How to use checksums
41537c55c6eed0460316cc53d50f276dfd448eb2f1e4ba9f6c1f2e5b733cfc10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for autopypack 1.3.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.

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