News for hackers. Stuff that matters.
Re:Switching from pyenv, rbenv, goenv and nvm to asdf by d3k on Tuesday April 05, 2022 @07:55AM (#30917850)
It seems nice. When programming envs tend too complicated though, I tend to switch to docker: a given image will handle a given version and it's mostly hassle free. That probably would not make sense on macOS or Windows, if you want to run native versions.
Re:Switching from pyenv, rbenv, goenv and nvm to asdf by matsemann on Tuesday April 05, 2022 @08:29AM (#30918135)
Same. Getting a python environment up and running can be a multi-day endeavor if you're unlucky. Just using docker compose on the existing Dockerfile for the project and mounting the local filesystem, means everything just works. PyCharm now works nicely with a remote interpreter inside docker compose.

I've even tried doing that with all the devtools we have. Like normally a developer here has to install gcloud, terraform, kubectl, apt-get lots of stuff, and then 3-4 internal tools. Then configure all of it, and of course some stuff will just not work on someone's computer. But creating a docker image including all that means that I can grab a new computer and be up and running in minutes.

Re:Switching from pyenv, rbenv, goenv and nvm to asdf by antholeole on Tuesday April 05, 2022 @08:57AM (#30918368)
Hijacking this: does anyone know how to get vscode to use a python interpreter inside a docker container for linting? I’ve resorted to using the docker container, but also having a python env so that I can tell vscode to point to the python interpreter in the env to get linting. Otherwise, dependencies come up unresolved.

I did some googling, but I’m unfortunately not experienced enough to be able to describe the problem succinctly to google.

Using pylance, btw.

TIA!

Re:Switching from pyenv, rbenv, goenv and nvm to asdf by matsemann on Tuesday April 05, 2022 @10:01AM (#30919072)
Have you tried VSCode's remote abilities? Should do exactly as you describe. https://code.visualstudio.com/docs/remote/remote-overview or https://devblogs.microsoft.com/python/remote-python-developm...
Re:Switching from pyenv, rbenv, goenv and nvm to asdf by antholeole on Tuesday April 05, 2022 @10:58AM (#30919861)
I’ve seen these and got it to work this way. I’m not too fond of working inside the container as it’s just a little more friction, but I’ve been working this way for a little bit now. I was hoping to avoid working in the container.
Re:Switching from pyenv, rbenv, goenv and nvm to asdf by nevalsar on Tuesday April 05, 2022 @09:57AM (#30919027)
Try this: 1. Bring up command palette using `Ctrl+Shift+p` 2. Search and select "Python: Select Interpreter" 3. Select your Python environment.

This works in VSCode over SSH perfectly fine - the locally running VSCode is able to detect and select Python environments in the remote server.

Re:Switching from pyenv, rbenv, goenv and nvm to asdf by antholeole on Tuesday April 05, 2022 @10:56AM (#30919837)
The trouble with this is that the python environment is in the container - In step 2, id need to type path to the interpreter that it inside the container.

Although, now you’ve got me thinking what would happen if I mounted the interpreter inside the container to something local that I can point to? Might try this later, thanks for the help!

Re:Switching from pyenv, rbenv, goenv and nvm to asdf by hushpuppy on Tuesday April 05, 2022 @08:43AM (#30918246)
I regularly use asdf-vm to manage kubectl, python, nodejs, and a bunch of other stuff.

"Setting up a Python environment" takes about 10 minutes and it's dead nuts reliable.

It is a very effective package manager.

Re:Switching from pyenv, rbenv, goenv and nvm to asdf by Ajedi32 on Tuesday April 05, 2022 @09:58AM (#30919043)
This. Docker not only solves the language-specific venv problem, but also encapsulates other system-level dependencies that may not be covered by stuff like pyenv or nvm. Plus with docker-compose you can trivially satisfy other, way more complicated dependencies like "fully functional PostgreSQL DB is accessible over the network", and you can deploy the entire thing to production with a few simple commands.
Re:Switching from pyenv, rbenv, goenv and nvm to asdf by brightball on Tuesday April 05, 2022 @11:00AM (#30919897)
One thing that I realized after finally dabbling with Python after years in other languages was just how much Python needs Docker in development. There are so many details to get the right version of python working on a project because of system level assumptions that using Python without Docker is a huge pain.

Conversely, the experience of using Ruby within Docker for development is often clunky and awkward by comparison.

Re:Switching from pyenv, rbenv, goenv and nvm to asdf by 0xedd on Tuesday April 05, 2022 @05:58PM (#30925586)
Installing dependencies, per the docs, before installing python works well. Installing library dependencies for packages also works well. It's not dissimilar to compiling c/c++ where you have to read the installation docs. And the docs better be updated.
Re:Switching from pyenv, rbenv, goenv and nvm to asdf by robertlagrant on Tuesday April 05, 2022 @04:55PM (#30924897)
I've not found this; pyenv and poetry sort it all out for me, and I could simplify and just make do with one.