asdf-community / asdf-community/asdf-python

`path:` version does not work reliably (asdf v0.16)

Abierto
#207 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Shell
Estrellas
729
Forks
65
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### Provide environment information

```bash
OS:
Linux ad-user-ads-11.s.xx.xxx 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

SHELL:
GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

BASH VERSION:
5.2.37(1)-release

ASDF VERSION:
0.16.7

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/usr/lusers/jacktose/.asdf
ASDF_CONFIG_FILE=/usr/lusers/jacktose/.asdfrc

ASDF INSTALLED PLUGINS:
python https://github.com/danhper/asdf-python.git 5e277e24ec2b6739728f458c1c25eeb2a8b8bb79
```

### To Reproduce

1. Have a non-asdf python installation:
```
$ /netops/local/python-3.9.2/bin/python3.9 -V
Python 3.9.2
```
1. Configure asdf to use it, [with `path:` syntax][doc]:
```
$ asdf set python path:/netops/local/python-3.9.2
$ cat .tool-versions
python path:/netops/local/python-3.9.2
$ asdf current python
Name Version Source Installed
python path:/netops/local/python-3.9.2 /usr/lusers/jacktose/code/l2/.tool-versions true
```
1. Check which `python` is used:
```
$ asdf which python
No python executable found for python path:/netops/local/python-3.9.2
$ python -V
No executable python found for current version. Please select a different version or install python manually for the current version
```
1. Compare to `python3`:
```
$ asdf which python3
/netops/local/python-3.9.2/bin/python3
$ python3 -V
Python 3.9.2
```
1. Try `path:` with asdf-installed fallback version:
```
$ asdf set python path:/netops/local/python-3.9.2 3.9.15
$ asdf current python
Name Version Source Installed
python path:/netops/local/python-3.9.2 3.9.15 /usr/lusers/jacktose/code/l2/.tool-versions true

$ asdf which python
/usr/lusers/jacktose/.asdf/installs/python/3.9.15/bin/python
$ python -V
Python 3.9.15

$ asdf which python3
/usr/lusers/jacktose/.asdf/installs/python/3.9.15/bin/python3
$ python3 -V
Python 3.9.15
```

Note that shims are fine:
```
$ which python
~/.asdf/shims/python
$ which python3
~/.asdf/shims/python3
```

And both shims work as expected for asdf-installed python:
```
$ asdf set python 3.9.15
$ asdf current python
Name Version Source Installed
python 3.9.15 /usr/lusers/jacktose/code/l2/.tool-versions true

$ asdf which python
/usr/lusers/jacktose/.asdf/installs/python/3.9.15/bin/python
$ python -V
Python 3.9.15

$ asdf which python3
/usr/lusers/jacktose/.asdf/installs/python/3.9.15/bin/python3
$ python3 -V
Python 3.9.15
```

### Describe the Bug

[`path:` version][doc] is ignored, unless it is the only version listed and you use the `python3` shim.

`asdf set python` ... | expected | `python -V` | `python3 -V`
-----------------------------------------|----------|-------------|-------------
`3.9.15` | `3.9.15` | `3.9.15` ✅ | `3.9.15` ✅
`path:/netops/local/python-3.9.2` | `3.9.2` | error ❌ | `3.9.2` ✅
`path:/netops/local/python-3.9.2 3.9.15` | `3.9.2` | `3.9.15` ❌ | `3.9.15` ❌

### Expected Behaviour

[`path:` versions][doc] (assuming there's a valid python there) should work with both `python` & `python3` shims, and follow normal precedence rules. See “expected” column above.

[doc]: https://asdf-vm.com/manage/configuration.html#:~:text=path%3A~%2Fsrc%2Felixir

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza reproduciendo los casos reportados con `asdf set`, `asdf which` y ambos shims `python` y `python3` en asdf 0.16.7. Rastrea cómo el plugin de Python resuelve las entradas `path:` y aplica la precedencia de versiones; se considera terminado cuando una versión de ruta válida funciona mediante ambos shims y sigue teniendo preferencia sobre una versión de respaldo.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python, shell
Área
cli, tooling
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.