Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Uvtrick.
See "Single File Scripts" in the recent release blog here: https://astral.sh/blog/uv-unified-python-packaging#single-fi...
Incidentally also using "rich" in this example, uv natively does this now (first adding deps to main.py itself, then showing the revised main.py):
$ uv add --script main.py "requests<3" "rich" $ cat main.py # /// script # requires-python = ">=3.12" # dependencies = [ # "requests<3", # "rich", # ] # /// import requests from rich.pretty import pprint resp = requests.get("https://peps.python.org/api/peps.json") data = resp.json() pprint([(k, v["title"]) for k, v in data.items()][:10])
- https://docs.astral.sh/uv/guides/scripts/#declaring-script-d...
- https://packaging.python.org/en/latest/specifications/inline...
I'm pulling this all the way into a comment because if you haven't been paying attention to `uv`, this snippet here shows how "this changes everything".
There are no comments on this comment yet.
See "Single File Scripts" in the recent release blog here: https://astral.sh/blog/uv-unified-python-packaging#single-fi...
Incidentally also using "rich" in this example, uv natively does this now (first adding deps to main.py itself, then showing the revised main.py):
The `uvtrick` tool assumes that the Python script in question uses inline script metadata. More on this can be found here:- https://docs.astral.sh/uv/guides/scripts/#declaring-script-d...
- https://packaging.python.org/en/latest/specifications/inline...
I'm pulling this all the way into a comment because if you haven't been paying attention to `uv`, this snippet here shows how "this changes everything".