4 ms·
Are virtual environments still needed now that we have containers? I just run everything in a container and never need a virtual environment. Am I missing out
by TekMol 4y ago
Are virtual environments still needed now that we have containers?
I just run everything in a container and never need a virtual environment. Am I missing out on anything?
- molly0 4y agoFor me it's the debug experience that is lacking when only using containers, I have some work arounds but they are still not good enough.
- TekMol 4y agoCan you give an example? I don't experience any difference, whether I am inside a container or on the host os.
- pnt12 4y agoCan you debug in a container, eg VS code debugger with breakpoints and steps?
- TekMol 4y agoI have no experience with that as I use pudb for debugging, which I simply run inside the container.
- 0x008 4y agoYea it is a supported use case. VS code remote extension can work with every container just like remote ssh development.
- crucialfelix 4y agoyes, devcontainers work very well. Full debugger. It's also possible to run the container in the cloud and still get a full local debugger. I did have some issues with some projects and want to revisit this soon.
- tsbischof 4y agoNot all Python users run containers, especially in the sciences. When you are teaching basics of data manipulation to people that have barely touched any programming language before, getting people to grok even virtual environments is not trivial.
- TekMol 4y agoTo me, containers are simpler than virtual environments. Just do "docker run --rm -it debian:11" and you are ready to go.
- alisonatwork 4y agoThis is the version of containers where they are most useful - a clean, throwaway environment with exactly the one application or userspace you want to test inside it. Unfortunately as a developer it's more fiddly than that. You need to mount your code into it. Then if you try commit changes to your code, you're a different user, so the commit is now messed up. Also you lost your dotfiles, so none of your aliases or other shortcuts work when you're in the container. You might need to connect to other services which now need to run in their own containers, and then they all need to talk to each other. Before you know it there's a whole litany of commands you need to run and configuration files you need to put together just to get started in the morning. Imo using containers on development machines is a big step backwards for developer productivity. Virtual environment is just... cd in the directory. Run magic incantation to set that directory as the canonical one for your current shell. The end. IDEs will pick it up automatically. The Python virtual environment and package management experience is still worse than pretty much any other programming language, but for me it's far and away better than using containers on a development machine.
- TekMol 4y agoYou make it sound like you have to edit your code inside the container. I don't do that. I edit it on the host OS. I just run the code inside the container.
- z3c0 4y agoI use both. Containers for server code, environments for scripting. Containerizing scripts is a bit excessive, especially if it's only going to run on your machine.
- fbdab103 4y agoAt $WORK, I more or less can only develop on a Windows machine. Getting Docker approval is needlessly painful. Until Docker and WSL are Microsoft standard tools, then yes, these solutions are required.
- Kwpolska 4y agoHow is WSL not a Microsoft standard tool? What makes it different from Visual Studio or VSCode or whatever, which is also never going to be built into Windows? Why can you get Python installed but not WSL?
- 323 4y agoWSL is a full Linux/Ubuntu? So you can install whatever you can apt-get/wget into it? I can see that being a problem in restricted environments.
- Kwpolska 4y agoFor a software developer, who can run any software they want (because they need to be able to run the software they’re paid to work on), including software that could subvert all the restrictions anyway?
- eddsh1994 4y agoIf that's really an issue, corporate IT can have an air gapped repo used for apt-get. I use purely air gapped systems at $WORK and it's not too bad.
- pauljurczak 4y ago> I just run everything in a container and never need a virtual environment. Am I missing out on anything? I don't think it is practical for compute heavy scientific visualization. Setting up GUI with docker was a nightmare for me. There is also some overhead for CPU/GPU heavy code.