Asdf: virtualenv like pyenv

Created on 7 Mar 2017  ·  15Comments  ·  Source: asdf-vm/asdf

Is there any plan to add virtualenv function just like in pyenv?

Most helpful comment

@vic can you open this? I think this feature is rather essential for asdf, and should be pretty easy to add. Without this feature, any language that has some concept of global packages will need to use a separate environment manager, which totally defeats the point of asdf as being the extensible version manager. (Why would I bother with asdf for python when I’ll need some other env manager anyways? I’ll just install conda and be done with it.)
This will also help languages that do not have an established virtual environment manager.
It’s also probably trendy in today’s container frenzied world. :))

All 15 comments

not really familiar with pyenv here, could you elaborate a bit on what features you are asking for, and how you envision them making asdf more useful to you? :)

pyenv has a functionality to make a "child" environment based on installed python. If we install python 3.6.0, we can make another environment based on python 3.6.0. But I think some people will use "venv" for everyday use, so what I ask is not really important for now.
I think we can close this issue, thank you for your reply. :)

@vic can you open this? I think this feature is rather essential for asdf, and should be pretty easy to add. Without this feature, any language that has some concept of global packages will need to use a separate environment manager, which totally defeats the point of asdf as being the extensible version manager. (Why would I bother with asdf for python when I’ll need some other env manager anyways? I’ll just install conda and be done with it.)
This will also help languages that do not have an established virtual environment manager.
It’s also probably trendy in today’s container frenzied world. :))

This is out of scope of asdf, as I think package management is too language specific to be able to come up with a good general solution. I think it could potentially be managed by asdf-python.
Unfortunately, I do not have time to work on it but I am very happy to review PRs.
If you want to continue the discussion, please open an issue in asdf-python rather than here.

No, I am not talking about package management! That’s indeed completely out
of the question.
I’m just asking asdf to be able to create named environments based on a
version. For example, I want to create three different environments based
on ruby 2.6.4. I can then use each environment’s own package manager (gem
in this case) to manage the packages.

On Tue, Sep 10, 2019 at 8:10 PM Daniel Perez notifications@github.com
wrote:

This is out of scope of asdf, as I think package management is too
language specific to be able to come up with a good general solution. I
think it could potentially be managed by asdf-python
https://github.com/danhper/asdf-python.
Unfortunately, I do not have time to work on it but I am very happy to
review PRs.
If you want to continue the discussion, please open an issue in
asdf-python rather than here.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/asdf-vm/asdf/issues/167?email_source=notifications&email_token=AIUL56UQJAQVFHQBZ7PIPKLQI65VXA5CNFSM4DCT6ZW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6LRT2Q#issuecomment-529996266,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIUL56T6FZTXZFSVQPOWSTLQI65VXANCNFSM4DCT6ZWQ
.

@NightMachinary I think we'd need some specifics on what that is and how it would work. Everything in asdf must be generic and serve multiple plugin use cases. So an asdf environment feature that only worked with the python plugin would not be something we would consider in asdf itself.

There is some discussion on the asdf-ruby plugin about gemsets - https://github.com/asdf-vm/asdf-ruby/pull/82

@NightMachinary Ok, I think I understand better what you are requesting.
Basically the idea would be to allow something like

asdf install python 3.7.2 my-env
asdf install python 3.7.2 my-other-env

and then

asdf global python my-other-env

could be used instead of a virtual environment, right?
I think this could be helpful and is simple enough to stay in the scope of asdf.
Unless I am missing something, a small change to the install command should be enough.
@Stratus3D What do you think?

This is exactly what I’m saying! 👍🏽

On Wed, Sep 11, 2019 at 8:20 PM Daniel Perez notifications@github.com
wrote:

@NightMachinary https://github.com/NightMachinary Ok, I think I
understand better what you are requesting.
Basically the idea would be to allow something like

asdf install python 3.7.2 my-env
asdf install python 3.7.2 my-other-env

and then

asdf global python my-other-env

could be used instead of a virtual environment, right?
I think this could be helpful and is simple enough to stay in the scope of
asdf.
Unless I am missing something, a small change to the install command
should be enough.
@Stratus3D https://github.com/Stratus3D What do you think?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/asdf-vm/asdf/issues/167?email_source=notifications&email_token=AIUL56S2MPC3HDSVRUCSXWDQJEHTTA5CNFSM4DCT6ZW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6O6YFQ#issuecomment-530443286,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIUL56UWVM3YYHPU66PQXKLQJEHTTANCNFSM4DCT6ZWQ
.

I would love to see this feature in asdf, managing virtual environments manually defies all purpose of having version manager.

@Stratus3D I think generic approach with shimming would play nicely with virtualenvs. If you would look at pyenv-virtualenv approach to the problem: they creating symlinks to venvs in a same directory where actual python versions are stored, so from the perspective of pyenv it's just regular version.

@dmgening the only way this feature is going to get added is if someone contributes code for this. If you aren't able to contribute code, a detailed issue explaining how the feature could be implemented might also help move things along. I'm too busy with misc. other issues and features to dedicate any time to this.

I agree that for some languages (Ruby and Python come to mind in particular), the way that package management has a tendency to be somewhat global means that a version manager that doesn't allow you to have multiple "copies" of a language environment has less value. I'd be happy if someone did contribute the code for this, but I understand this isn't currently the core focus for asdf. ;)

i am just using asdf-direnv to manage this for now

@dagadbm how does asdf-direnv help with managing virtualenvs? What's your setup like?

Yeah, I'm not seeing the connection either. If there's a way to use asdf-direnv to have not only multiple versions of Python / Ruby, but also multiple environments (in particular a project-specific set of ruby gems or pypi modules attached to the language version), I'd like more details. ;)

Incidentally, I recently ran into gv, which I guess is the go equivalent of wanting venv-like project-specific virtual environments (which I bring up as more evidence that there are more languages where something like this could be considered important)

So on the root of my project I create two files

.envrc and .tool-versions (I have a global gitignore file for this)

On the .tool-versions I put the python/nodejs wathever versions are
specific to that project.

On the .envrc I do
use asdf .tool-versions
layout python python2/3

I have asdf-direnv installed and configured similar to the readme of the
repo. (Just don't comment out any asdf code setup you did on zshrc)

I also use powerline10k for zsh. With this when I open up a folder I will
get on the prompt the python/node version I am using because of the
.tool-versions file and also get a little icon saying this folder is used
with direnv.

It works amazingly well , just a bit slow when entering the folder but only
way to fix is to migrate everything to zinit and that is god damn awful for
someone who knows 0 about zsh under the hood (I use oh my zsh).

On Fri, Aug 7, 2020, 20:04 Geoffrey Wiseman notifications@github.com
wrote:

Yeah, I'm not seeing the connection either. Incidentally, I recently ran
into gv, which I guess is the go equivalent of wanting venv-like
project-specific virtual environments (which I bring up as more evidence
that there are more languages where something like this could be considered
important)


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/asdf-vm/asdf/issues/167#issuecomment-670666426, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AD7WGR6JUAVCDVFFYT4LS43R7RF4JANCNFSM4DCT6ZWQ
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomsquest picture tomsquest  ·  4Comments

jayvdb picture jayvdb  ·  4Comments

Antiarchitect picture Antiarchitect  ·  3Comments

jthegedus picture jthegedus  ·  3Comments

johnjelinek picture johnjelinek  ·  3Comments