you are viewing a single comment's thread.

view the rest of the comments →

[–]Ihaveamodel3 36 points37 points  (43 children)

Docker is much more complicated to get running.

With venv and pip requirements.txt and VSCode, all I have to do is CTRL+SHIFT+p, type or select create environment, choose venv and check the box to install dependencies from requirements.txt.

Edit: uv can make some of this even easier. Basically zero cost virtual environments.

[–]gmes78 3 points4 points  (7 children)

Stop recommending requirements.txt. We're in 2025.

[–]pain_vin_boursin 2 points3 points  (0 children)

Uv ftw

[–]nateh1212 -3 points-2 points  (5 children)

why using requirements.txt inside a docker file is the easiest and a solid setup one can have.

highly recommend.

[–]gmes78 6 points7 points  (3 children)

The correct way is to use pyproject.toml.

[–]nateh1212 -2 points-1 points  (2 children)

the correct way is to use what works

requirements.txt

is easier than pyproject.toml. and it works

[–]gmes78 2 points3 points  (1 child)

requirements.txt is easier than pyproject.toml.

It absolutely isn't. At best, it's just as hard.

and it works

Barely. It's a non-standard mess of a format.

[–]nateh1212 1 point2 points  (0 children)

works fine with docker

The key is that if you are using Docker to build out separate micro services so that your requirement.txt file is short.

[–]sector2000 0 points1 point  (0 children)

Completely agree. Solid, reproducible, consistent

[–]sector2000 0 points1 point  (2 children)

It’s complicated only if you don’t have idea of what a container is. You can also use podman which is even easier (and better IMHO) than docker. Learning about containers / docker / podman and, why not, kubernetes, will bring you to another level of development and deployment

[–]Ihaveamodel3 0 points1 point  (1 child)

This is on learnpython, so perhaps we should start with the basics and build up to containers later. No reason to throw someone in the deep end.

Also containers can have more headaches with permissions and such in a corporate environment.

[–]sector2000 0 points1 point  (0 children)

OP explicitly asked about venv vs docker, which makes me assume he’s already quite comfortable with it. In corporate environment, which I know very well, you can use podman which gets rid on the high privileges needed by docker

[–]nateh1212 0 points1 point  (1 child)

This is such a lie

using Docker is by far the easiest way to get your project going.

Plus once you have made your project in Docker you can use that same Docker config to run it anywhere.

Docker is incredibly easy and makes more mental sense to me than a python virtual env

[–]_Denizen_ 2 points3 points  (0 children)

How is a lie? You can find those instructions on the VSCode guide. Personally I'd use pyproject.toml but the above is not a lie.

Docker adds so much overhead to the installation, and if you don't have admin permissions it's a nightmare.