19 ms·
Switching from pyenv, rbenv, goenv and nvm to asdf
- xwowsersx 5y ago> And then one day, I found out about asdf-vm. FYI, the link to asdf there is a link to google.com
- KptMarchewa 5y agoI thought it's a joke post after that, but apparently this is a real project: https://github.com/asdf-vm/asdf https://github.com/asdf-vm/asdf
- xwowsersx 5y agohaha, I have to admit I also started to wonder if this was an April Fools' joke about how Google searches are a developer's main tool.
- blunte 5y agoHappy asdf user for several years now. Unfortunately, there are still cases where it either can't be used or it would take a great deal of hacky stuff to make it work. One such case is getting PyCharm to understand it. I found it works well for Ruby, Elixir/Erlang, and Node.
- pmontra 5y agoAnd PostgreSQL too. I tend to use the PostgreSQL plugin for projects in which I use asdf. It creates the data directory somewhere and I can use that exact version of the database without docker. Then it's pg_ctl start / stop from within the project directory. The version coming with the OS is never the right one.
- oauea 5y agoThe link to adsf-vm just points to Google. Is this a broken link, or just wasting the readers time by telling them to "just google it"?
- tosh 5y agohttps://asdf-vm.com https://asdf-vm.com
- bin_bash 5y agoI used asdf but found it caused a 200ms hit to launching any of the binaries: https://github.com/asdf-vm/asdf/issues/290 https://github.com/asdf-vm/asdf/issues/290 Personally that's not something I can live with as these binaries are sometimes launched many times in subprocesses.
- lapser 5y agoSeems the direnv plugin aims to resolve, but I struggled to get it working. 200ms for hasn't been a huge issue (yet), but not having the proper paths set up has been. Using shims isn't the greats experience (something direnv plugin also aims to address).
- noitpmeder 5y agoDirenv is actually amazing
- samgranieri 5y agoyeah, I love direnv combined with bundler binstubs. saves me from having to type bundle exec (whatever), or even using a shell alias for it
- thejosh 5y agodirenv worked for me on both linux/mac. They just released a major new version (asdf-direnv), so might be worth giving that a shot and see if it works for you with asdf?
- bin_bash 5y agoI had the same experience. To be clear since I think it might not be obvious: lapser is talking about asdf-direnv, not direnv by itself. See https://github.com/asdf-community/asdf-direnv https://github.com/asdf-community/asdf-direnv
- tomatowurst 5y agowow, this needs to be top comment. This is a no go for me. since I use only pyenv and nvm, not too big of a problem.
- password4321 5y agoBoth my thumbs up for the asdf extendable version manager, a big help when brew leaves older macOS editions behind. Previously: https://news.ycombinator.com/item?id=26018684 https://news.ycombinator.com/item?id=26018684 (Feb 2021: 98 comments)
- vbrandl 5y agoIf you are looking for a language agnostic version manager, the nix package manager [0] might be worth a try. In combination with lorri [1] you will be dropped into a shell with all required development dependencies available, when you enter the project directory. This does not only include the interpreter/compiler versions but also any other dependency you can think of, like specific libraries the project links against (well almost any, it has to be available as a nix expression, best case directly in upstream nixpkgs). For me, it has come so far that I don't have any interpreters or compilers in my main OS environment and even for one off REPL sessions, I'll use `nix shell nixpkgs#python3 -c python3`. [0]: https://nixos.org/ https://nixos.org/ [1]: https://github.com/nix-community/lorri/ https://github.com/nix-community/lorri/
- pmarreck 5y agois there a reason why this couldn't just be `nix shell python3`? like "nixpkgs" is almost always the default, from what I can tell, so it could be omitted and simply be assumed to be the default, and not sure what the -c param does but perhaps it could also assume that the specified package(s) are also the ones to install/choose, in which case the whole thing could be like `nix shell -c python3`?
- paskozdilar 5y agoFor those who like the concept of Nix, but don't like the Nix language, the Guix package manager [0] might also be worth a try. It's an official GNU project, inspired by Nix, and it uses Guile Scheme instead of Nix language. [0] https://guix.gnu.org/ https://guix.gnu.org/
- javajosh 5y agoEventually someone will implement Nix in Javascript, and then it will explode.
- rgoulter 5y agoThe code in nixpkgs does contain some code that uses relatively sophisticated programming language constructs, such as lazy evaluation, partial function application, or fixpoints. -- So I'll say there's at least some friction to Nix from the language being pure/functional. Mostly I think Nix would be just as hard if packages were expressed in any language. Stuff like "this program compiled by nix is using a different glibc than this library" is going to be confusing regardless of whether Nix expressions can be written with JavaScript; or stuff like some program assumes it can write to $HOME in its build script not playing nicely with Nix. A lot of why Nix is hard is because it's weird, and that even as an end user when things go wrong it may require understanding more about what's going on than what other solutions require.
- d3k 5y agoIt 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.
- matsemann 5y agoSame. 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.
- hushpuppy 5y agoI 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.
- antholeole 5y agoHijacking 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!
- nevalsar 5y agoTry 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.
- vorticalbox 5y agothe nodejs plugin fails on version asdf v0.7.8 use v0.8.0 or higher to avoid the unbound variable error
- twic 5y agoSo is asdf good then? I have been using SDKMAN! to install JDKs, but i noticed that Gradle will automatically detect JDKs installed using SDKMAN!, asdf, and Jabba [1], which signals to me that the other two are worth a look. Although now i dig into it, asdf does not have a first-party Java plugin, so the support is through a third-party plugin maintained by three people and a robot [2]. [1] https://docs.gradle.org/current/userguide/toolchains.html#sec:auto_detection https://docs.gradle.org/current/userguide/toolchains.html#se... [2] https://github.com/halcyon/asdf-java/graphs/contributors https://github.com/halcyon/asdf-java/graphs/contributors
- SingAlong 5y agoI wouldn't go by whether a plugin is first-party or third-party. The only plugins under the asdf-vm github org are for Ruby, Node.js, Elixir and Erlang, because those are the only languages I needed.
- vips7L 5y agoJabba never worked on windows for me. So now I just install jdks globally via scoop and have a powershell plugin that automatically detects a .env file in each directory.
- e12e 5y agoTBH I've had a bit mixed experiences with asdf and java (mostly big enterprise apps like Oracle SQL Developer needing some hand-holding to work properly, and issues with http kit intercepting network traffic used by SoapUI). Not sure the error lies at the feet of asdf, though. For ruby/node it's a relief to be able to easily "activate" a certain version of ruby and a certain version of nodejs - at the same time, via simply "asdf local ruby ... and asdf local node ...".
- whalesalad 5y agoI think of myself as a pretty experienced hacker but asdf has never really worked for me on any platform. It’s always a kludge. Love the idea, but I’m sticking with pyenv for now.
- this_is_not_you 5y agoFunny, had the exact opposite experience. I could pyenv not get to work with my Linux VM and VSCode terminal (zsh).
- CraigJPerry 5y agoI just raided the project git repo and there is definitely no common lisp in there. Unfortunate name clash! https://asdf.common-lisp.dev/ https://asdf.common-lisp.dev/
- chobytes 5y agoMy first thought as well! From the title I was intrigued to see how CL was being used for this.
- omaranto 5y agoRenaming because of this name clash has been suggested but the suggestion wasn't taken up: - https://github.com/asdf-vm/asdf/issues/383 https://github.com/asdf-vm/asdf/issues/383 - https://github.com/asdf-vm/asdf/issues/547 https://github.com/asdf-vm/asdf/issues/547 They did do something to ameliate this though: now they refer to the proect as asdf-vm as much as possible, to distinguish it from Common Lisp asdf.
- d110af5ccf 5y agoI actively dislike this project even though I've never used it because Common Lisp asdf is a de facto standard that's been around since forever. There's no way you fail to notice the name clash with even a cursory search. They're both software projects and they're both build tools it's scummy behavior in my view to say the least.
- peterhil 5y agoMy first reaction was to see if the project is made with Commnon Lisp's ASDF, and cool now it has plugins for different languages. Common Lisp ASDF is very well thought out, but not the easiest package management system.
- ravi-delia 5y agoYeah I was really wondering who found it easier to hack ASDF to work with other languages than just use a few separate package management solutions. It's an incredible library, but man I would not want to push its limits or it would go from odd to unusable pretty quick.
- wyuenho 5y agoasdf is not a replacement for pyenv, rbenv, goenv and nvm, it's yet another abstraction on top of them. Nvm is a fork of rbenv for node, and pyenv is a fork of rbenv for python, the core of all of these asdf plugins are exactly ruby-build, python-build and node-build, which came from rbenv, pyenv and nodeenv. For go, you don't need any kind of environment, you can switch between versions with just a change of an environment variable. Also, a much simpler solution is to simply install these language runtime versions with your favorite package manager like Homebrew or Macports, and use direnv and dotenv to switch between them as you cd into different directories. All of these languages have convenient environment variables you can control to put the right things in your paths.
- lapser 5y ago> asdf is not a replacement for pyenv, rbenv, goenv and nvm, it's yet another abstraction on top of them No, asdf is a replacement for them. It's not an abstraction on top of them. It uses its own plugin system, and everything is written purely in bash. Everything gets installed in `~/.asdf/installs`
- wyuenho 5y agoTheir "plugins", are using exactly the same build plugins pyenv, rbenv and nodeenv use to build the language runtimes. All asdf does is set the point things to the right directories using various tricks like symlinks and shims and whatnot. This is something easily accomplished by direnv.
- rubyist5eva 5y agohttps://github.com/asdf-community/asdf-direnv https://github.com/asdf-community/asdf-direnv > asdf version resolution is slow which makes every command execution pay that penalty. asdf reshim is needed for finding new executables, and some tools are not happy with their executables being masked by shims. > Perform asdf version resolution only once and defer environment loading to direnv.
- 5y ago
- e12e 5y agoI've found asdf to be a reasonable choice when needing to manage more than one language - especially where there are good "native" version managers that asdf wrap (eg: python, ruby, node, to a certain extent rust/cargo). Not sure I'd do this, though: mkdir -p ~/.config/fish/completions cp ~/.asdf/completions/asdf.fish ~/.config/fish/completions But more probably add a symlink to the completions managed by git/asdf: ln -s ~/.asdf/completions/asdf.fish ~/.config/fish/completions/
- smokey_circles 5y agowhat in the actual horrifying toolset is this. pyenv I can understand. dunno the others. but goenv?? you deserve whatever hell this is. it's a single binary configurable with an envvar for gopher sake. just RTFM.
- samgranieri 5y agoI’ve used ASDF since 2016 and it’s been working beautifully. The only hiccups I’ve had with it aren’t related to ASDF, rather stuff like Erlang 24.0 not compiling on macOS (which was subsequently fixed). Every engineer at my company uses ASDF
- vlunkr 5y agoSame. We switched when we started an elixir project and pretty quickly switched all our codebases over. On top of languages we've used it for database systems in some cases.
- freedomben 5y agoasdf is indeed the best solution in the elixir/erlang world. I use it for node, ruby, and python now too and it's been great to have a consistent experience across languages.
- trey-jones 5y agoI see comments about Nix and I've heard rumblings about it before, so I might look into that. But Docker covers my needs for version management completely. To me it seems much more explicit, more portable, less error prone, less complex than any of these virtual environment managers. Never mind that I don't even want node.js on my system if I can help it at all (I can't, generally).
- hushpuppy 5y agoDocker doesn't allow for LSP servers in my text editor. Asdf "just works".
- trey-jones 5y agoThis is a reasonable point, and something that is being worked on. I definitely think Docker can provide LSP servers as necessary, we're just not quite there. This is something that I'm interested in working on, though I'm not the only one: https://github.com/emacs-lsp/lsp-docker https://github.com/emacs-lsp/lsp-docker For the most part, latest version linting is good enough for me, currently.
- dlisboa 5y agoIt's obviously doable, but it's very heavy for languages. Like someone else said, you immediately run into basic issues like readline, LSP compatibility, volume persistence, port forwarding, etc. Docker is better for version managing services like databases, caches (Postgres, Redis, etc), things that have little need for different configuration or exploration and persist through multiple sessions. Once they're up, they're done. Asdf is the next best thing for local development, where you need that kind of exploration.
- rkangel 5y agoThe main issue with docker is that you have to start from scratch with your environment. With Nix you can layer it over your existing Linux environment (or you can have it from-scratch by running `nix-shell --pure`). There are advantages to the docker approach, and Nix can be painful to get going, but a significant portion of the community (including me) find the pain to be worth it.
- this_is_not_you 5y agoI've wasted so much time trying to get pyenv to work properly and failed. Switched to asdf and things just worked.
- dangoor 5y agoI recently discovered Hermit[1], which is a really straightforward tool for managing versions of tools for a given project. From the FAQ[2]: > Hermit is probably most similar to asdf, but their goals differ. Hermit's goal is to make isolated cross-platform tooling consistent, self-bootstrapping, and reproducible at the project level. asdf's primary goal is to allow developers to install and switch between multiple versions of languages and tooling. The downside for the author of this post, though, is that Hermit doesn't yet support Ruby because it's not static/relocatable. [1]: https://cashapp.github.io/hermit/ https://cashapp.github.io/hermit/ [2]: https://cashapp.github.io/hermit/faq/#asdf https://cashapp.github.io/hermit/faq/#asdf
- uranusjr 5y agoThe lack of Ruby support instantly rings an alarm for me because CPython (on POSIX) also is not relocatable, but is listed as support. Turns pit Hermit is actually using a third-party build script[1] instead of the official one. While the python-build-standalone project is quite awesome and indeed useful for a lot of things, it has enough quirks I would recommend against any generic package distributor to advertise it as Python for general use. This in turn makes me lose most confidence on Hermit, unfortunately. Be careful if you’re also interested in Hermit. These kinds of things bit you up way down the road when you least expect them to. [1] https://github.com/indygreg/python-build-standalone https://github.com/indygreg/python-build-standalone
- huac 5y agoHermit is great!
- mjs7231 5y agoThis feels like Trillian for virtualenvs. So typical that as engineers we keep abstracting everything we can until we run out of people that understand the basics. This tool looks like a great resource until step 4 when we create a virtualenv protocol. In chat clients, the protocols came first. For development IDEs adding auto-complete, it seems the protocol LSP came second. It's happening to language virtualenvs now as well. 1. You need a tool for X to solve an issue so you write it. (AIM) 2. Guy over there needs a tool for Y to solve the same issue, so he writes it. (Yahoo Chat) 3. So many tools exist, we need to merge them all into one. (Trillian, Adium) 4. Merging all the tools created a monster, we need a common protocol they all understand. 5. No one remembers how tool X works anymore, updates become more sparse. 6. Both X and Y are no longer popular, big company took over. (Slack)
- folkrav 5y agoNot sure the comparison makes sense in this case. It doesn't have to do with virtualenvs. It's just a tool to install multiple interpreters/language runtimes in parallel and switch between them in an interactive shell with shims. In this case there are multiple tools that do the exact same for specific languages (pyenv/rbenv/goenv/...), this one does multiple runtimes, that's all. You'd still use your language's tooling for everything else.
- js2 5y ago> Everything was fine until I kinda felt my config.fish file got bloated and somehow nvm was kinda slowing down my shell startup. I'm quite happy with direnv to avoid this problem. https://direnv.net/ https://direnv.net/ Funny enough, it was submitted to HN most recently just yesterday: https://news.ycombinator.com/item?id=30908321 https://news.ycombinator.com/item?id=30908321 direnv is complementary to the various language-version tools, so it obviates needing asdf: https://github.com/direnv/direnv/wiki#project-layouts https://github.com/direnv/direnv/wiki#project-layouts But it seems some folks combine the two: https://blog.mikecordell.com/2021/12/18/better-project-environment-management-with-direnv-and-asdf/ https://blog.mikecordell.com/2021/12/18/better-project-envir...
- kot-behemoth 5y agoI use direnv myself, and it's great. However, for anyone trying it out I'd caution that it doesn't play well with conda - the Python package management system (see this open issue https://github.com/direnv/direnv/issues/326 https://github.com/direnv/direnv/issues/326). It can be a dealbreaker for some.
- wyufro 5y agoIndeed, direnv and asdf integrates, such that PATH is set to the values exposed by your .tool-config. This avoids the asdf shim and makes executing the tools slightly faster. Good when you have to run them over and over in a script.
- qbasic_forever 5y agodirenv is nice but it really makes me uneasy if it catches on for modern collaborative development. You are giving people a _ton_ of trust when cloning a repo or pull request that has a .envrc which will be automatically executed by direnv. This file could do anything from steal your SSH keys to delete your entire home directory or worse. And the only thing preventing that from happening is the suggestion of "oh be sure to eyeball the .envrc file and make sure it looks ok, then run this command to enable it". People will just google for the first "how to I unblock .envrc file" and blindly run the command, then oops. Or a determined attacker will just obfuscate what they're doing so the .envrc looks fine but you failed to realize some esoteric bash-isms were actually invoking an obfuscated script and... oops. It's just begging for a supply chain disaster on a similar scale as npm's infamous issues. VS code and some vim extensions have similar issues with automatic project-specific configurations that allow arbitrary code execution too, and neither have a good solution beyond 'just read all the code and understand it to make sure it's not going to hurt you'. It's not really a unique thing to direnv. We really need a better model for collaboration and consistent dev environments. I think containers and docker/chroot/etc. environments with explicit opt in of your local resources, configs, files, etc. are a much more sane and security conscious path towards it. A script executing to setup my python environment for a project should never, ever have access or even know about my personal password store database for example (unless I explicitly decide it should).
- twblalock 5y agoIt seems like a lot of these virtual environment tools are designed to work around the assumption that packages are installed globally on a system. I don’t see why this is so hard to avoid with per-project version pinning. I’ve never had this problem with Java. This seems like a lot of effort and complexity to work around global package installation. Just stop assuming that packages are global and this would all go away. How do we know that? Because other languages don’t require this kind of workaround!
- tootie 5y agoJava (well Maven) I believe does this the most clever and simple way. It does have a global folder of dependencies but will gladly stash multiple versions of the same library. Local projects just link to the right version. That saves downloads and allows for simple version pinning. And JVMs are backwards compatible so having a new JVM can still run bytecode for past versions with just a flag. Features like this are so much more valuable than anything that goes into the actual language syntax.
- npteljes 5y agoI come from the Java world and it's mindblowing to see that mature, widespread languages like Ruby, Python or JavaScript require all kinds of hackery to run properly. Dependency management with Maven is a breeze in comparison.
- Tainnor 5y agoWhat do you mean by Ruby "hackery"? I'll agree that how to do things properly with Ruby isn't obvious when you're new to the language - just as it isn't obvious how to do things in Java (or other JVM languages) when you're coming from Ruby or another language.[0] But Bundler doesn't work all that differently from Maven, in the end. Instead of running your commands through `./mwnw`, you run them through `bundle exec`[1]. Dependency management is straightforward and mostly hassle-free (the problems arise "only" when you use C extensions which, to be fair, is not that rare, but I don't really see a way around this in a language where you need C for certain fast things). In particular, Bundler by default[2] also stores dependencies centrally like maven to avoid duplication and then selects the appropriate version of a given dependency (unlike e.g. NPM which stores everything locally). Rbenv (or alternative tools such as chruby or asdf) solves a problem completely distinct from Bundler or Maven, it's about selecting the right Ruby version for your project, a problem that also needs to be solved with Java. IME, many developers just let the IDE deal with that, but Ruby developers are more used to running things from CLI, so that's why rbenv exists. In any case, the most popular analogue for Java would be sdkman which works, mostly, the same way (and which, IME, is even a bit hackier than rbenv). JS and Python are different. Node is a mess IMHO, and Python isn't able to agree on which package manager to use (I would hope people would migrate to Poetry, which seems to be doing things right). [0]: For example, one thing that I find very annoying over in Java-land is that it's a real hassle to make sure things behave the same way when called from the CLI as opposed to from the IDE, such as setting the active spring profile. This is because, mostly, the IDE circumvents maven/gradle (you can run things through the build system, but typically the output, e.g. test output, is better when using the IDE-internal system, at least with IntelliJ). [1]: There are "hackeries" to get rid of having to run everything through "bundle exec", such as binstubs and direnv, although I would mostly call them "shell script tricks", and anyway, if you instead just alias "bundle exec" to something shorter or create a wrapper script, it's not really worse than `./mwnw`. [2]: This can be overriden and is actually a good idea for production builds, especially if you use a multi-stage docker build since then it's easy to copy over all your dependencies.
- thejosh 5y agoThere is an issue that delays commands by 200ms, which isn't a massive issue for my usecase, but you might want to look into asdf-exec https://github.com/danhper/asdf-exec https://github.com/danhper/asdf-exec
- kaladin_1 5y agoI like the idea. A package manager that can be used on several languages but simple enough to pick up in 15mins or less. Just today on trying to get rvm to do something I got angry at the number of language-specific package managers I have installed: nvm, jenv, rvm, rbenv(after I couldn't get rvm...) Of course, I know about Nix but it is too complex for my use cases.
- ClumsyPilot 5y agoI am sorry for off-topic, but it i show this title to a normal person, they will conclude that our industry is a joke.
- kbd 5y agoTried asdf but can’t stand the global shims. I only want it to work on a per-directory basis with direnv. I tried to follow the asdf-direnv instructions but IIRC still wound up with asdf’s shim directory in my global PATH, and it needed to install its own copy of direnv. Disappointing that asdf expects to take over my system like it does.
- rubyist5eva 5y agoasdf is wonderful, been using it for 2 years and get everyone I see using one of those single-language tools to switch and they also love it. if asdf could have a plugin that hooks into their shims to also handle direnv I would be in heaven edit: just did a quick google search and it exists, i'm elated
- bjourne 5y agoCan someone give like the 120 seconds elevator pitch to why you need any of this stuff? I know how to use pyenv, virtualenv, Poetry, autoenv, you name it. I just never have found any practical use for it. But what if you want to have multiple versions of the same package installed? I don't. If some project I work on requires tf 2.x-1.0 and I only have tf 2.x.0 then I just rm -rf ~/.local/lib/python3.x and reinstall the dependencies anew. Furthermore, most Python maintainers do a terrific job in keeping up with breaking api changes in their dependencies (which I'm very grateful for) so it's quite rare that I need to use a Python package that is not the current release.
- dsabanin 5y agoWhat if you work on 2-10 different codebases that all use slightly different versions?
- deleted 5y ago[deleted]
- haolez 5y agoThis probably makes a difference for hugo enterprise monorepos. I myself have a workflow similar to yours, but with the following mindset: my local environment is an approximation of what will be in production. I don't need every version to match and if I ever encounter a corner case where this is not true, I'll just deal with it and move on.
- roesel 5y agoWhat if you're simultaneously working on two projects with different version requirements and don't want to rm -rf and reinstall every day?
- bjourne 5y agoI don't do that.
- derekzhouzhen 5y agoThere is a age old solution for managing multiple versions of the same software: gnu stow: https://www.gnu.org/software/stow/ https://www.gnu.org/software/stow/ No crazy settings in your profile. Downsides are: You need to have root, you can switch any time but different versions don't work at the same time, and it does not work in windows.
- thingification 5y ago> You need to have root This isn't true > different versions don't work at the same time Within one stow directory: true. But nothing prevents creating multiple directories (I don't think I've ever done that).
- derekzhouzhen 5y agoYou are right, I should have said to manipulate /usr/loca/ you need to be root.
- akira2501 5y agoI feel like hardcoding shebang paths and not implementing a good widespread PATH whitelisting/safety mechanism has created far more problems than we should ever have had to deal with. It strikes me that not for the two above items we might be able to solve this with $PATH resolution and directories filled with symlinks to our "development versions."
- yeti_or 5y ago[dead]
- synergy20 5y agofor bash I use venv, nvm and gvm(more popular than goenv and worked well), worked fine so far.
- deleted 5y ago[deleted]
- rsanheim 5y agoI switched to using asdf away from nvm/rbenv for a few projects in about a couple hours of time, and that included the install/build time for various versions of things and the time to re-run bootstrap and verify things worked from a fresh clone. It was really impressive how smooth and quick the process was. Great tool!
- orsenthil 5y agoI like this quote in asdf help. "Late but latest" -- Rajinikanth https://github.com/asdf-vm/asdf/blob/master/lib/commands/command-help.bash#L11 https://github.com/asdf-vm/asdf/blob/master/lib/commands/com... Thalaiva! :)
- burke 5y agoAt Shopify, we do a similar thing using a tool we wrote called Shadowenv[1], which evaluates little programs to manipulate the environment on directory entry/exit. It's a lot like direnv, but it can't do anything that makes it slow, and is guaranteed to run in at most 100ms (though it typically only takes a few) When I set `ruby: 2.6.8` in my `dev.yml` file, for example, I get this Shadowenv program written out to `.shadowenv.d/550_dev_ruby.lisp`: (provide "ruby" "2.6.8") (when-let ((ruby-root (env/get "RUBY_ROOT"))) (env/remove-from-pathlist "PATH" (path-concat ruby-root "bin")) (when-let ((gem-root (env/get "GEM_ROOT"))) (env/remove-from-pathlist "PATH" (path-concat gem-root "bin"))) (when-let ((gem-home (env/get "GEM_HOME"))) (env/remove-from-pathlist "PATH" (path-concat gem-home "bin")))) (env/set "BUNDLE_PATH" ()) (env/set "GEM_PATH" ()) (env/set "GEM_HOME" ()) (env/set "RUBYOPT" ()) (env/set "RUBYLIB" ()) (env/set "RUBY_ROOT" "/opt/rubies/2.6.8") (env/prepend-to-pathlist "PATH" "/opt/rubies/2.6.8/bin") (env/set "RUBY_ENGINE" "ruby") (env/set "RUBY_VERSION" "2.6.8") (env/set "GEM_ROOT" "/opt/rubies/2.6.8/lib/ruby/gems/2.6.0") (when-let ((gem-root (env/get "GEM_ROOT"))) (env/prepend-to-pathlist "GEM_PATH" gem-root) (env/prepend-to-pathlist "PATH" (path-concat gem-root "bin"))) (let ((gem-home (path-concat (env/get "HOME") ".gem" (env/get "RUBY_ENGINE") (env/get "RUBY_VERSION")))) (do (env/set "GEM_HOME" gem-home) (env/prepend-to-pathlist "GEM_PATH" gem-home) (env/prepend-to-pathlist "PATH" (path-concat gem-home "bin")))) I really like this strategy. It's really nicely generalizable to any of these language runtimes that need to change on a per-project basis. [1]: https://shopify.github.io/shadowenv/ https://shopify.github.io/shadowenv/
- ravi-delia 5y agoOh I like the look of this. Can't wait to try it out
- tptacek 5y agoI get pyenv and rbenv. I do not get why anyone would use goenv. I'm sure there's some corner-casey reason, but it's not a mainstream thing. I can't imagine working in Ruby or Python without wrappers, but Go, just keep the most recent version installed and that's pretty much it. If you're new to Go and installing something like goenv because you had to do that for all the other languages... reconsider!
- EscargotCult 5y ago+1 the only thing that's "surprised" me between Go releases has been their changes to build flags in 1.18, and gofmt takes care of that anyway. Now that I think of it, gofmt changes if you have autoformatting enabled is probably the only "breaking" change that might happen between minor releases, but I haven't seen any issues with this from 1.15 through 1.18. In any case, if gofmt changes are disruptive enough to block upgrading, then a team has some deeper-seated issues in how they ship.
- ryanschneider 5y agoI’m not sure if this is a feature or bug but `asdf` requires you to recompile every tool installed via `go install` (nee `go get`) when you change go versions. IIRC the main reason our team started tracking go versions was we were already using `asdf` for tracking other tools and it’s a nice way to ensure that everyone/everything was using the same to version (e.g. for unit tests which usually aren’t run in a container) but it is another spot to keep in sync with the Dockerfile.
- vmception 5y agoasdf for solution to package manager hell? missed opportunity for naming it fgsfds
- 3836293648 5y agoIs this just low effort low compatibility nix?
- sullyj3 5y agoAsdf seems cool, My issue with it is that it seems to be wedded to the paradigm of having a single compiler/interpreter version active at a time for the entire system. I would rather use tools that allows project specific compiler/interpreter versions, without having to manually switch each time you switch projects.
- robertwt7 5y agouh i'm on a similar position with another jenv lol. let's see if the change is as smooth as it says!
- deleted 5y ago[deleted]