python-uv
(166) uv: An Extremely Fast Python Package Manager - YouTube
-
Trio: a friendly Python library for async concurrency and I/O — Trio 0.29.0 documentation
-
why uv is that fast
✅ What is uv venv
?
uv venv
is a faster alternative to python -m venv
or virtualenv
, built into the uv
tool. It creates a virtual environment and installs dependencies blazingly fast.
🔧 Prerequisite
Make sure uv
is installed:
curl -Ls https://astral.sh/uv/install.sh | sh
🧪 How to use uv venv
1. Create a new virtual environment
uv venv .venv
This creates a .venv
folder in the current directory.
2. Activate the environment
On macOS/Linux:
source .venv/bin/activate
On Windows (PowerShell):
.venv\Scripts\Activate.ps1
📦 Install packages
Once activated, use uv pip
just like pip
:
uv pip install fastapi uvicorn
Check installed packages:
uv pip list
💾 Save dependencies
To generate requirements.txt
:
uv pip freeze > requirements.txt
📁 Typical Workflow
# Create and enter project
mkdir my-fastapi-app && cd my-fastapi-app
# Create a virtual env
uv venv .venv
# Activate it
source .venv/bin/activate
# Install packages
uv pip install fastapi uvicorn
# Save deps
uv pip freeze > requirements.txt
Let me know if you want a clean project template using uv
, FastAPI, and PostgreSQL — I can generate one for you to get started fast 🔥
I just :
uv pip (pypy support version): uv add ipdb dubugger(better) uv init/ source it
Great question — uv
currently does not support installing alternative Python interpreters like PyPy (as of early 2025). It’s mainly focused on being a drop-in faster replacement for pip, pip-tools, and virtualenv, but not a Python version manager like pyenv
.
✅ So, what’s possible with uv
?
- ✔️ Fast
pip
-style installs (uv pip install fastapi
) - ✔️ Blazing-fast
venv
creation (uv venv .venv
) - ✔️ Works with your existing Python interpreter (system or virtualenv)
- ❌ Does NOT install other Python versions or interpreters (like PyPy, CPython 3.12, etc.)
🚀 If you want to use PyPy with uv
You can manually install PyPy, then run uv
from that interpreter:
Step-by-step:
-
Download PyPy:
https://www.pypy.org/download.html -
Extract and set it up:
tar -xf pypy3.10-v7.3.12-linux64.tar.bz2 cd pypy3.10-v7.3.12-linux64
-
Use PyPy as your Python interpreter with uv:
./bin/pypy3 -m uv venv ../pypy-env source ../pypy-env/bin/activate uv pip install fastapi
✅ uv
will work as long as you’re in a virtual environment created with a PyPy interpreter.
🔁 Summary
Tool | Python Version Management | Package/Env Speed | PyPy Support |
---|---|---|---|
pyenv | ✅ Yes | ❌ Slower | ✅ Yes |
uv | ❌ No | ✅ Super Fast | ⚠️ Manual |
asdf | ✅ Yes (via plugin) | ⚠️ Okay | ✅ Yes |
Let me know if you want a ready-to-run PyPy + uv environment template or script — I can set that up for your system!
Effective Use of Python ‘logging’ Module - Yuxin’s Blog
#!/usr/bin/env python
import sys
import subprocess
import time
import os
import argparse
def write(b: bytes):
os.write(1, b)
def has_tmux():
return "TMUX" in os.environ
def tmux_passthrough(b: bytes):
return b'\x1bPtmux;' + b.replace(b'\x1b', b'\x1b\x1b') + b'\x1b\\'
def tmux_passthrough_pipe(buf: bytes):
curr = 0
while True:
start = buf.find(b'\x1b', curr)
if start < 0:
break
end = buf.find(b'\x1b\\', start + 1)
if end < 0:
break
write(buf[curr:start])
write(tmux_passthrough(buf[start:end + 2]))
curr = end + 2
def clear_kitty():
sys.stdout.buffer.write(b'\033Ptmux;\033' + b'\033_Ga=d,d=A\033\033\\' + b'\033\\')
if __name__ == "__main__":
parser = argparse.ArgumentParser()
cmds = parser.add_subparsers(title="subcommands", dest="command")
p = cmds.add_parser("kittyimg",
help="Show an image using kitty protocol. Works OKish in tmux.")
p.add_argument("input", help="image file")
p.add_argument("--ttl", type=int, default=3, help="time to clear the image, if in tmux")
p = cmds.add_parser("passthrough", help="tmux-passthrough for stdin. for debugging.")
p = cmds.add_parser("clearimg", help="clear kitty image")
p = cmds.add_parser("notify", help="send desktop notifications (OSC99)")
p.add_argument("message", help="notification message")
args = parser.parse_args()
if args.command == "passthrough":
buf = sys.stdin.buffer.read()
tmux_passthrough_pipe(buf)
elif args.command == "kittyimg":
fname = args.input
if not has_tmux():
cmd = f'timg -C -pk "{fname}"'
os.system(cmd)
else:
cmd = f'timg -C -g x100 -pk "{fname}"'
buf = subprocess.check_output(cmd, shell=True)
write(tmux_passthrough(buf))
if args.ttl > 0:
time.sleep(args.ttl)
clear_kitty()
elif args.command == "clearimg":
clear_kitty()
elif args.command == "notify":
payload = b'\x1b]99;;' + args.message.encode('utf-8') + b'\x1b\\'
if has_tmux():
payload = tmux_passthrough(payload)
write(payload)
write(b'\a') # bell
- tmux escape config for pass through , ssh with kitty image
-
Hydra | Hydra 🔥 two video kythe/kythe: Kythe is a pluggable, (mostly) language-agnostic ecosystem for building tools that work with code.
abseil/abseil-py: Abseil Common Libraries (Python) abseil / Python Developer Guide Python Rules | Bazel
source: https://abseil.io/docs/python/guides/testing
The Abseil testing library contains many more methods than the five above; some are in Python’s built-in unittest.TestCase while others are in Abseil Python’s subclass absl.testing.absltest. GoogleTest User’s Guide | GoogleTest
Example Code
More examples are forthcoming, but for now please see absl-py’s own tests for examples of how to use absltest
.