Comment

Comment by js2

Yes, uv is well suited to that use case by declaring your Python version and/or dependencies right in the script itself:

https://docs.astral.sh/uv/guides/scripts/#declaring-script-d...

You can use an alternate shebang line so you can run the script directly:

  #!/usr/bin/env -S uv run --script
  # /// script
  # requires-python = ">=3.12"
  # dependencies = [
  #   "requests",
  #   "typer-slim",
  # ]
  # ///
  import requests
  import typer
  # ...
parent js2 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton