logoalt Hacker News

Alifatiskyesterday at 9:56 PM2 repliesview on HN

I like the message the article is trying to convey, Python is good alternative to complicated shell scripts in my opinion.

I do wonder, let's say the scripting file is using lots of libraries, do you have to include some kind of requirements.txt file with it aswell when you want to share it with other people?

In Ruby, there is inline bundler which makes sharing a single Ruby script very portable.

https://bundler.io/guides/bundler_in_a_single_file_ruby_scri...


Replies

bccdeetoday at 4:17 AM

uv does that these days:

  # /// script
  # dependencies = [
  #   "requests<3",
  #   "rich",
  # ]
  # ///
  
  import requests
zelphirkalttoday at 2:39 AM

One would be well-advised to provide not only a requirements.txt file, but also a lock file, if the use case is important enough.