uv Script
uv
script is a great tool for running scripts with out having concern about dependencies, you need just add the following at top of the document and then write your script
# /// script
# dependencies = [
# "requests<3",
# "rich",
# ]
# ///
a uv
script example
# /// script
# dependencies = [
# "requests<3",
# "rich",
# ]
# ///
import requests
from rich.console import Console
from rich.table import Table
# Amsterdam coordinates
lat, lon = 52.37, 4.89
url = (
"https://api.open-meteo.com/v1/forecast"
f"?latitude={lat}&longitude={lon}"
"¤t=temperature_2m,wind_speed_10m"
)
resp = requests.get(url)
data = resp.json()["current"]
table = Table(title="Amsterdam Weather")
table.add_column("Time")
table.add_column("Temperature (°C)")
table.add_column("Wind Speed (km/h)")
table.add_row(
data["time"],
str(data["temperature_2m"]),
str(data["wind_speed_10m"])
)
Console().print(table)
save that in a file like amsterdam_weather.py
then run
$ uv run amsterdam_weather.py
and it’s done!
Amsterdam Weather
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ ┃ Temperature ┃ Wind Speed ┃
┃ Time ┃ (°C) ┃ (km/h) ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ 2025-06-10T… │ 16.1 │ 26.3 │
└──────────────┴──────────────┴──────────────┘
Best Part: Gist
Just upload your code in a gist and run like this
uv run https://gist.githubusercontent.com/ghodsizadeh/476e1d3833ac5bca817125c0c59294ce/raw/b65be020a9cf59fd29dba380baad550f37cf5f69/amsterdam_weather.py
And of course you can add argparse if you want!