Repolode
jaraco

jaraco/pip-run

A Python launcher that installs packages into a temporary environment for a single run, then discards them.

Stars
143
Forks
21
Open issues
12
Last commit
8 days ago

What is it?

pip-run is a command-line tool for running Python code with dependencies that are installed on demand and removed after the process exits. You pass package names to pip-run, followed by optional arguments to pip install, then `--` and the script, module, or command to execute. It replaces the usual sequence of creating a virtualenv, installing packages, running the code, and deleting the environment.

The tool can infer dependencies from a script's imports, read requirements declared in a `__requires__` variable or inline script metadata, and run modules with `-m`, console scripts, or an interactive interpreter. Installed packages are staged in a temporary location, while pip's download cache is reused. An optional persistence mode keeps environments in the user cache between runs, with an optional maximum age.

It is aimed at one-off work such as running scripts, test runners, experiments, and bug triage rather than production dependency management. Editable (`-e`) requirements are not supported.

Key features

  • 01Infers script dependencies from imports or declared metadata.
  • 02Installs packages into a temporary location that is removed after the run.
  • 03Runs modules, console scripts, scripts, or an interactive interpreter with dependencies.
  • 04Passes install options through to pip and reuses pip's download cache.
  • 05Offers an optional persistent mode with a configurable maximum age.

Use cases

  • Running a single Python script that needs third-party packages without setting up a project.
  • Trying out a library in an interactive session without touching the system environment.
  • Running test runners or build tools with temporary dependencies.
  • Creating self-contained single-file Python tools with a shebang line.

Quick start

  1. 1

    Install pip-run alongside pip in the system site packages (see the README Installation section)

  2. 2

    Run a module with a temporary dependency, here cowsay

    pip-run cowsay -- -m cowsay "moove over, pip-run"
  3. 3

    Run a script that has its dependencies inferred from its imports

    pip-run requests myscript.py

Things to know

  • The README says it is not intended for production dependency management.
  • No license is listed in the project metadata.

Topics

FAQ

What is pip-run?
A Python launcher that installs packages into a temporary environment for a single run, then discards them. pip-run is a command-line tool for running Python code with dependencies that are installed on demand and removed after the process exits. You pass package names to pip-run, followed by optional arguments to pip install, then `--` and the script, module, or command to execute. It replaces the usual sequence of creating a virtualenv, installing packages, running the code, and deleting the environment.
Is pip-run free to use? What license does it have?
pip-run has no declared license. Its code is public, but without a license you have no explicit permission to reuse it; ask the author before relying on it.
Is pip-run still maintained?
Actively maintained. The last commit to pip-run was on Oct 29, 2026.
What can I use pip-run for?
Running a single Python script that needs third-party packages without setting up a project. Trying out a library in an interactive session without touching the system environment. Running test runners or build tools with temporary dependencies. Creating self-contained single-file Python tools with a shebang line.
How do I install pip-run?
Install pip-run alongside pip in the system site packages (see the README Installation section) Run a module with a temporary dependency, here cowsay: pip-run cowsay -- -m cowsay "moove over, pip-run" Run a script that has its dependencies inferred from its imports: pip-run requests myscript.py
Where can I get pip-run?
The source code and installation instructions are on GitHub: https://github.com/jaraco/pip-run

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects