uv & Python Virtual Environment Tools

uv is a super fast Python package and project manager, written in Rust. It purports to be a drop-in replacement for many of the familiar tools we use, such as Pip, Conda, Poetry, Virtualenv, Pipx, etc… But how realistic is this? What is the developer experience if we ditch our existing tools for uv? Kevin Renskers wrote a nice comparison between Poetry and uv, and came to the conclusion that the number one strength of uv is in how it manages virtual environments. So in this brain dump, I’ll focus on virtual environment management aspect of uv, and compare it to other tools like poetry, conda, and virtualenv.

Read More

Pytest Fixtures

Fixtures in pytest are functions that provide a fixed baseline for tests, allowing resources (like database connections, input data, etc.) to be accessed and reused across multiple test cases. They can also handle setup and teardown for each test. Upon test initialization, fixtures are executed, and their results cached to be used and reused. The persistence of this cache depends on a specified “scope”. In this note, my intention is to jot down important concepts about fixtures and show some common ways in which they’re used.

Read More

Pytest Markers & Parametrization

Pytest markers are like tags. Tag your tests to keep them organized. Use markers to indicate test priority, or group them by performance, integration, or acceptance. Use them to skip tests under certain conditions, or mark them as expected failures. Use parametrization to run your test under different parameters.

Read More