3 ms·
Fascinating! It looks like PEP 723 (the one that was accepted provisionally) will allow you to embed a comment in your script that looks like this, to specify d
by Flimm 3y ago
Fascinating! It looks like PEP 723 (the one that was accepted provisionally) will allow you to embed a comment in your script that looks like this, to specify dependencies on request and rich:
# /// pyproject
# [run]
# requires-python = ">=3.11"
# 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])