astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
13.82k stars 467 forks source link

pyd type dependencies are not downloaded correctly #1400

Open x-haose opened 1 month ago

x-haose commented 1 month ago

Steps to Reproduce

pyd type dependency download is incorrect

Initialize the project

rye init rye_test
cd rye_test
rye pin 3.11
rye add pydantic
ls ./.venv/Lib/site-packages/pydantic_core/

This is displayed as correct:

Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2024/9/28 18:05 4337 __init__.py
-a--- 2024/9/28 18:05 5031936 _pydantic_core.cp311-win_amd64.pyd
-a--- 2024/9/28 18:05 46790 _pydantic_core.pyi
-a--- 2024/9/28 18:05 145622 core_schema.py
-a--- 2024/9/28 18:05 0 py.typed

Switch version to 3.12

rye pin 3.12
rye sync -f
ls ./.venv/Lib/site-packages/pydantic_core/

It still shows cp311 at this time:

Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2024/9/28 18:05 4337 __init__.py
-a--- 2024/9/28 18:05 5031936 _pydantic_core.cp311-win_amd64.pyd
-a--- 2024/9/28 18:05 46790 _pydantic_core.pyi
-a--- 2024/9/28 18:05 145622 core_schema.py
-a--- 2024/9/28 18:05 0 py.typed

View python-version content:

cat .\.python-version
3.12.3

Actual run to view the version:

PS E:\rye_test> .\.venv\Scripts\python.exe
Python 3.12.3 (main, Apr 15 2024, 17:48:16) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Switch version to 3.10

rye pin 3.10
rye sync -F
ls ./.venv/Lib/site-packages/pydantic_core/

The last version displayed is 3.11


Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2024/9/28 18:05 4337 __init__.py
-a--- 2024/9/28 18:05 5031936 _pydantic_core.cp311-win_amd64.pyd
-a--- 2024/9/28 18:05 46790 _pydantic_core.pyi
-a--- 2024/9/28 18:05 145622 core_schema.py -a--- 2024/9/28 18:05 0 py.typed ````

### Expected Result

When using pin to switch versions, rye sync should download the package of the switched version instead of the package before the switch.

### Actual Result

Logs

### Version Info

rye 0.40.0
commit: 0.40.0 (a928cd53a 2024-09-22)
platform: windows (x86_64)
self-python: cpython@3.12.3
symlink support: true
uv enabled: true

### Stacktrace

_No response_