If you don’t use a venv at all, do you add every new requirement to your main config.nix?
If it matters, I’m not a real developer. I don’t deploy or package anything. I’m just making tools for my own work. I’m not concerned about Nix-like reproducibility for my python scripts because they’re pretty simple and only live on my machine.
In ‘proper’ software development projects, you (ideally) want all information checked into the repo for what is needed to run the software:
which dependencies you need,
what particular versions of the dependencies,
as well as which runtime/compiler version to use.
And then you’d use a package manager which can automatically install all these.
Python projects are currently heavily moving towards uv for this. Traditionally, you’d use pip + virtualenv + sometimes pipx for this.
You can check out a commit from months ago and just run it right away. Well, or just a commit from yesterday, which is on a different Git branch, where you haven’t yet started your big dependency upgrade. As soon as upgrading a dependency requires changes in your code, you want the dependency version change tracked together with the respective code change.
Your different team mates can all work on the repository, even though one of them might be on Debian, the next on Arch and the third is on macOS. By defining all your dependencies in the repo, you can avoid “works on my machine” scenarios, where a bug occurs on one PC, but not on the dev’s PC where you try to reproduce it.
No, not to my nixos configuration. In fact I don’t even have a global / system / user-wide Python interpreter. I rely on nix shells and package closures; no imperative use of python.
I’m not a big python dev; my meaningful experience is with systems languages. But for a release or project i intend to be consumed outside of nix, I’ll use venvs and a requirements file because that’s just the right way to do things.
But what I meant was that I’d use a nix shell or build package that uses py libs that are already packaged for nix, or package the ones that aren’t myself, and just use the nix closure as my venv; no regular venv or pip workflow.
Devenv seems to let you just point at a requirements file and it builds the venv for you. Very clean for portability beyond nix consumers that way. But most of my Python projects are personal utilities and can target nix exclusively.
If you don’t use a venv at all, do you add every new requirement to your main config.nix?
If it matters, I’m not a real developer. I don’t deploy or package anything. I’m just making tools for my own work. I’m not concerned about Nix-like reproducibility for my python scripts because they’re pretty simple and only live on my machine.
In ‘proper’ software development projects, you (ideally) want all information checked into the repo for what is needed to run the software:
And then you’d use a package manager which can automatically install all these.
Python projects are currently heavily moving towards
uvfor this. Traditionally, you’d usepip+virtualenv+ sometimespipxfor this.Using
nix developwith flakes is also valid for this, if your team agrees on it: https://nixos.wiki/wiki/Development_environment_with_nix-shell#nix_developWhichever way you solve it, the idea is that:
No, not to my nixos configuration. In fact I don’t even have a global / system / user-wide Python interpreter. I rely on nix shells and package closures; no imperative use of python.
I’m not a big python dev; my meaningful experience is with systems languages. But for a release or project i intend to be consumed outside of nix, I’ll use venvs and a requirements file because that’s just the right way to do things.
But what I meant was that I’d use a nix shell or build package that uses py libs that are already packaged for nix, or package the ones that aren’t myself, and just use the nix closure as my venv; no regular venv or pip workflow.
Devenv seems to let you just point at a requirements file and it builds the venv for you. Very clean for portability beyond nix consumers that way. But most of my Python projects are personal utilities and can target nix exclusively.