astral-sh / rye

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

0.28.0 has ruff 0.2.2 when update #859

Closed phi-friday closed 7 months ago

phi-friday commented 7 months ago

Steps to Reproduce

export RYE_VERSION=0.27.0
export RYE_INSTALL_OPTION="--yes"
curl -sSf https://rye-up.com/get | bash
source "$HOME/.rye/env"
rye self update
~/.rye/self/bin/ruff --version

Expected Result

ruff 0.3.0

Actual Result

ruff 0.2.2

Version Info

rye 0.28.0 commit: 0.28.0 (c44dc7ec8 2024-03-07) platform: linux (aarch64) self-python: cpython@3.12.2 symlink support: true uv enabled: true

Stacktrace

No response

mitsuhiko commented 7 months ago

Looks like for whatever reason the bootstrapping process does not detect an outdated self venv here. I verified that the version was bumped between 0.27 (https://github.com/astral-sh/rye/blob/0.27.0/rye/src/bootstrap.rs#L34) and 0.28 (https://github.com/astral-sh/rye/blob/0.28.0/rye/src/bootstrap.rs#L34)

bluss commented 7 months ago

@phi-friday I think it will simply be updated when it's first needed, the next rye sync (or even rye lint) you do. I think that's the design right now, is it working?

phi-friday commented 7 months ago

@mitsuhiko same problem when I run it in a docker container.

❯ docker run -it --rm python:3.12 bash
Unable to find image 'python:3.12' locally
3.12: Pulling from library/python
c2964e85ea54: Pull complete
d3436c315a5d: Pull complete
603ae72c83b1: Pull complete
bcabfc6c415b: Pull complete
f22e038e21dd: Pull complete
3ae45c5f75be: Pull complete
2107f7596de6: Pull complete
13322359dbd4: Pull complete
Digest: sha256:e83d1f4d0c735c7a54fc9dae3cca8c58473e3b3de08fcb7ba3d342ee75cfc09d
Status: Downloaded newer image for python:3.12
root@a79ee28fc1de:/# export RYE_VERSION=0.27.0
root@a79ee28fc1de:/# export RYE_INSTALL_OPTION="--yes"
root@a79ee28fc1de:/# curl -sSf https://rye-up.com/get | bash
This script will automatically download and install rye (0.27.0) for you.
warning: this script is running as root.  This is dangerous and unnecessary!
######################################################################## 100.0%
Welcome to Rye!

This installer will install rye to /root/.rye
This path can be changed by exporting the RYE_HOME environment variable.

Details:
  Rye Version: 0.27.0
  Platform: linux (aarch64)

Installed binary to /root/.rye/shims/rye
Bootstrapping rye internals
Downloading cpython@3.12.2
Checking checksum
Unpacking
Downloaded cpython@3.12.2
Updated self-python installation at /root/.rye/self

The rye directory /root/.rye/shims was not detected on PATH.
It is highly recommended that you add it.
Added to PATH.
note: for this to take effect you will need to restart your shell or run this manually:

    source "$HOME/.rye/env"

For more information read https://rye-up.com/guide/installation/

All done!
root@a79ee28fc1de:/# source "$HOME/.rye/env"
root@a79ee28fc1de:/# rye self update
Updating to latest
Checking checksum
Updated!

rye 0.28.0
commit: 0.28.0 (c44dc7ec8 2024-03-07)
platform: linux (aarch64)
self-python: cpython@3.12.2
symlink support: true
uv enabled: false
root@a79ee28fc1de:/# ~/.rye/self/bin/ruff --version
ruff 0.2.2

@bluss I did as you said and found it working fine.

root@a79ee28fc1de:/# rye init
success: Initialized project in /.
  Run `rye sync` to get started
root@a79ee28fc1de:/# rye sync
Detected outdated rye internals. Refreshing
Bootstrapping rye internals
Found a compatible Python version: cpython@3.12.2
Initializing new virtualenv in /.venv
Python version: cpython@3.12.2
Generating production lockfile: /requirements.lock
Creating virtualenv for pip-tools
Generating dev lockfile: /requirements-dev.lock
Installing dependencies
Looking in indexes: https://pypi.org/simple/
Obtaining file:///. (from -r /tmp/tmpyu88d_2z (line 1))
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: unknown
  Building editable for unknown (pyproject.toml) ... done
  Created wheel for unknown: filename=unknown-0.1.0-py3-none-any.whl size=958 sha256=e6e545dc9ad044742c68c1736196d9228174a8330223c7899c467e43409a16c3
  Stored in directory: /tmp/pip-ephem-wheel-cache-h_et4zep/wheels/8b/19/c8/73a63a20645e0f1ed9aae9dd5d459f0f7ad2332bb27cba6c0f
Successfully built unknown
Installing collected packages: unknown
Successfully installed unknown-0.1.0
Done!
root@a79ee28fc1de:/# ~/.rye/self/bin/ruff --version
ruff 0.3.0

Using ruff directly before the first command is not recommended, nor is it likely to happen. If this is what you intended, i can close the issue. Should i close it?

mitsuhiko commented 7 months ago

What's puzzling is that the installation step should also check for an outdated venv. That does not seem to work here.

bluss commented 7 months ago

I quickly skimmed the code and I think it corresponds, I don't see a self venv check in the update code. So here it would be install with 0.27.0 (self venv was brought up to this state), update with 0.28.0 (self venv left alone - until rye sync or similar.)

mitsuhiko commented 7 months ago

Indeed. I missed that this actually runs update and not install. Will fix that.