TIL: uv and standalone python scripts

TIL: if you’re using uv everything packs itself you can feed your script to uv with the following she-bang invocation (the --script flag will process the balance of the script as the script. standalone scripts can run in a virtualenv within uv and internally resolve their dependencies. we needed this years ago. #!/usr/bin/env -S uv run --script # /// script # requires-python = ">=3.12" # dependencies = [ "requests" ] # /// uv allows you to package up your dependencies at the top of a script using TOML formatted structures in the comments....

January 30, 2025 · steve ulrich

TIL: about the python code module

well this module is hugely useful. invoke the REPL where you need it while you’re debugging something gnarly. for some reason, i’ve never quite grokked the use of pdb. i stumbled on this gem via this article.

April 19, 2020 · sulrich

pyenv reminder

you can have multiple pythons enabled at the same time so that those applications which you run which make assumptions about python2 being available work. (i’m looking at you gsutil and gcloud) elmo(~)% pyenv global 3.7.1 2.7.15 elmo(~)% pyenv versions system * 2.7.15 (set by /Users/sulrich/.pyenv/version) 2.7.15/envs/foo 2.7.5 * 3.7.1 (set by /Users/sulrich/.pyenv/version) 3.7.2 foo elmo(~)% which python2 /Users/sulrich/.pyenv/shims/python2 elmo(~)% which python3 /Users/sulrich/.pyenv/shims/python3 elmo(~)% which python /Users/sulrich/.pyenv/shims/python elmo(~)% python --version Python 3....

April 15, 2019 · sulrich

networks of reinvention

a very interesting article on splitting the protocol from the network plumbing (read, socket() interaction) in a library implementation - all of this is done using python 3 w/async i-o. really interesting approach. networks of reinvention, david beazley (;login:) - issue: fall 2016, vol. 41, no. 3 (personal copy)

November 6, 2016 · steve ulrich