asdf-community / asdf-community/asdf-python

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

オープン
#207 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Shell
スター
729
フォーク
65
PR マージ指標
30日以内にマージされた PR はありません

説明

### 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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、asdf 0.16.7 で `asdf set`、`asdf which`、および `python` と `python3` の両方の shim を使って、報告されたケースを再現します。Python プラグインが `path:` エントリをどのように解決し、バージョンの優先順位を適用するかを追跡します。完了条件は、有効なパスバージョンが両方の shim で機能し、フォールバックバージョンよりも優先されたままであることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python, shell
領域
cli, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。