Coming from npm and node_modules, Python tooling felt alien until I found uv. Here is the 1:1 mapping that made it click.
Python has an npm now
uv, from a Node dev's point of view
I have started learning Python and there are so many new things, specially around tooling. Coming from a frontend background, I found it essential to have some form of mapping to navigate this new landscape. That's when I discovered uv, which feels quite similar to npm.
uv is a single tool that covers project dependencies, virtual environments, Python version management, and publishing.
Here is the 1:1 mapping:
| npm / Node.js | Python / uv |
|---|---|
package.json | pyproject.toml |
package-lock.json | uv.lock |
node_modules/ | .venv/ |
npm init | uv init |
npm install zod | uv add pydantic |
npx | uvx |
uv installed dependencies way faster than npm. We do not need to activate anything, uv run will handle the environment for us.
That's it for today. I will post more things about my learning journey soon.
The type hints are the middleware
FastAPI, from an Express developer's point of view
The last post in the series. I rebuilt my Express reflexes in FastAPI, found the type hints doing the validation, the docs, and the serializing, then made it stream.
You start it
async/await, but the event loop is not ambient anymore
async/await transfers almost 1:1 from JS, but Python's event loop is not ambient. Two gotchas from wiring up token-by-token streaming.
Stop writing JavaScript in Python
Comprehensions, a reversed join(), and KeyError
List comprehensions, a reversed join(), and KeyError instead of undefined. Small syntax, but the idioms took real unlearning.