asdf-community / asdf-python

Python plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
667 stars 58 forks source link

Python2/Python3 side-by-side problems #33

Closed Qqwy closed 6 years ago

Qqwy commented 6 years ago

Currently, when using asdf-python, if you have configured the version of Python to be 3.x.x in some directory, the command python2 will return:

No such command in 3.x.x of python

Whereas when you configure it to use python 2.x.x, it will return, when calling python3:

No such command in 2.x.x of python

I have come across problems were a build script attempted to find out if python 2 or python 3 was installed. (they use which python2 to see if we use Python 2, which succeeds as this returns /home/yourusername/.asdf/shims/python2. But then actually calling this binary will fail with above error.)

I think it would be better behaviour if the ASDF wrapper for these binaries would:

  1. Check if the current folder's version of Python has the same major version as the wrapper.
  2. If not, print a warning to alert the user what is going on, and pass on through to the system-configured (outside of ASDF)'s python2 resp. python3.
danhper commented 6 years ago

Hi, I configure asdf to use both python 3 and 2 in parallel:

asdf global python 3.6.2 2.7.13

There are still some issues with multi-versions support of asdf, but no dealbreaker for me. Would that work for you?

Qqwy commented 6 years ago

Wow! That is amazing! Yes, that is exactly what I was looking for. I did not know that it was possible to configure multiple versions in parallel.

Would it be possible to add this to the README.md?

danhper commented 6 years ago

I will add this to this README. asdf support for multiple versions still kind of experimental (missing tests, broken features, such as asdf current), so we will need to fix this before adding it to asdf README.