HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
jaraco
pip-run
Python2023–2024
jaraco / pip-run

pip-run

pip-run - dynamic dependency loader for Python

4Distinct people
7Mentions
0Explicit recommenders
143GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

pip-run - dynamic dependency loader for Python

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

  • pyar/fades · linked in 3 of the same discussions
  • pypa/pipx · linked in 2 of the same discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by month7 dated mentions

Observed mentions: 2023-07-22 20:54:34 UTC to 2024-06-23 10:22:50 UTC.

012023-07-01 00:00:00 UTC to 2023-08-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsJul 20232023-08-01 00:00:00 UTC to 2023-09-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023-09-01 00:00:00 UTC to 2023-10-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-10-01 00:00:00 UTC to 2023-11-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023-11-01 00:00:00 UTC to 2023-12-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023-12-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsDec 20232024-01-01 00:00:00 UTC to 2024-02-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments2024-02-01 00:00:00 UTC to 2024-03-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments2024-03-01 00:00:00 UTC to 2024-04-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-04-01 00:00:00 UTC to 2024-05-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-05-01 00:00:00 UTC to 2024-06-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-06-01 00:00:00 UTC to 2024-07-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsJun 2024

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Jul 20232023-07-01 00:00:00 UTC2023-08-01 00:00:00 UTC101
Aug 20232023-08-01 00:00:00 UTC2023-09-01 00:00:00 UTC101
Sep 20232023-09-01 00:00:00 UTC2023-10-01 00:00:00 UTC000
Oct 20232023-10-01 00:00:00 UTC2023-11-01 00:00:00 UTC101
Nov 20232023-11-01 00:00:00 UTC2023-12-01 00:00:00 UTC101
Dec 20232023-12-01 00:00:00 UTC2024-01-01 00:00:00 UTC000
Jan 20242024-01-01 00:00:00 UTC2024-02-01 00:00:00 UTC110
Feb 20242024-02-01 00:00:00 UTC2024-03-01 00:00:00 UTC110
Mar 20242024-03-01 00:00:00 UTC2024-04-01 00:00:00 UTC000
Apr 20242024-04-01 00:00:00 UTC2024-05-01 00:00:00 UTC000
May 20242024-05-01 00:00:00 UTC2024-06-01 00:00:00 UTC000
Jun 20242024-06-01 00:00:00 UTC2024-07-01 00:00:00 UTC101

What Hacker News says

7 sources
I wish an easy cross-platform PEX or shiv [1] were a thing. Binary dependencies are the biggest reason I prefer the new inline script metadata spec (https://packaging.python.org/en/latest/specifications/inline...) and `pipx run`. Luckily, they're pretty great. They have changed how I write Python scripts. The way inline script metadata works is that your script declares arbitrary dependencies in a structured top comment, and a compliant script runner must provide them. Here is an example from a real script: #! /usr/bin/env -S pipx run # /// script # dependencies = [ # "click==8.*", # "Jinja2==3.*", # "tomli==2.*", # ] # requires-python = ">=3.8" # /// pipx implements the spec with cached per-script virtual environments. It will download the dependencies, create a venv for your script, and install the dependencies
Read the rest
in the venv the first time you invoke the script. The idea isn't new: you could do more or less the same with https://github.com/PyAr/fades (2014) and https://github.com/jaraco/pip-run (2015). However, I only adopted it after I saw https://peps.python.org/pep-0722/, which PEP 723 replaced and became the current standard. It is nice to have it standardized and part of pipx. For really arbitrary hosts with no guarantee of recent pipx, there is https://pip.wtf and my venv version https://github.com/dbohdan/pip-wtenv. Personally, I'd go with `pipx run` instead whenever possible. [1] I recommend shiv over PEX for pure-Python dependencies because shiv builds faster. Have a look at https://shiv.readthedocs.io/en/stable/history.html.
In Ruby: A great language for shell scripts
You can try https://github.com/jaraco/pip-run or https://github.com/PyAr/fades (or eventually pipx: https://github.com/pypa/pipx/issues/913). They don't require a build step. For example, #! /usr/bin/env -S pip-run Jinja2==3.* from jinja2 import Environment env = Environment(autoescape=True) template = env.from_string("Hello, {{ name }}!") print(template.render(name="world")) There is a downside. Because pip-run recreates the virtualenv every time, the script takes a second to start up. pipx will cache virtualenvs once the single-file script feature is released. I haven't used fades yet. Edit: fades caches virtualenvs. #! /usr/bin/env fades from jinja2 import Environment # fades Jinja2==3.* env = Environment(autoescape=True) template = env.from_string("Hello, {{ name }}!") print(template.render(name="world"))
In Show HN: Pypipe – A Python command-line tool for pipeline processing
pipx has merged, though not yet released, support for single-file scripts with dependencies (https://github.com/pypa/pipx/issues/913). There is also pip-run (https://github.com/jaraco/pip-run) with similar functionality to the new feature in pipx and other options. Their approach of listing dependencies in a comment at the top pf the script has been standardized (with minor differences) in a recent PEP: https://peps.python.org/pep-0722/. All of this looks good for the future of Python scripts. I have already adopted pipx run script.py in a project: https://github.com/dbohdan/structured-text-tools/blob/d8dc1a.... It has been convenient and has not caused me problems so far.
In Ask HN: Share a shell script you like
> To be recognised as a “comment line”, the line must start with a # symbol. Leading and trailing whitespace on the comment line is ignored. If a line is " # Requirements:" a comment line? I can remove leading whitespace on a comment line, but since it does not start with a "#" symbol, it is not a comment line. In fact, according to this line, there's no such thing as a comment line with leading whitespace. Or is "leading" meant to be the spaces between the "#" and the "Requirements:"? On a broader topic, I certainly haven't followed this issue. I'm curious why an embedded string with a special name wasn't used, like: __pyproject_toml__ = """\ [build-system] requires = ["requests", "rich ~= 58.0"] """ where only '[build-system.requires]' is supported. I think this could be extracted statically, through the AST, so no eval needed
Read the rest
. One of the links lead me to alternative proposals at https://github.com/jaraco/pip-run/issues/44 but none of them fit this form. (It's "Variant 1: single variable" with '__pyproject_toml__' as the variable name, "Option 2: Requirements.txt in comments" but in a string, and as TOML.) The main objection seems to be 'Users may be tempted to dynamically construct the list (through runtime execution), but only static values are supported.' replacing 'list' with 'string'. I have such a poor grasp one what "users" want that I can't judge.
In PEP 722: Python dependencies for single-file scripts

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.