Giter Club home page Giter Club logo

setup-rye's Introduction

setup-rye

Set up your GitHub Actions workflow with a specific version of rye.

  • Install a version of rye and add it to the path
  • Cache the installed version of rye to speed up consecutive runs on self-hosted runners
  • Register problem matchers for error output
  • Optional: Cache the virtual environment created by rye
  • Optional: Verify the checksum of the downloaded rye executable

Usage

Example workflow can be found in this repo

- name: Install the latest version of rye
  uses: eifinger/setup-rye@v4

Install latest version

By default this action installs the version defined as default in action.yml. This gets automatically updated in a new release of this action when a new version of rye is released. If you don't want to wait for a new release of this action you can use use version: latest.

Warning

Using the latest version means that the rye executable gets downloaded every single time instead of loaded from the tools cache. This can take up to 20s depending on the download speed. This does not affect the cached version of .venv when caching is enabled.

- name: Install a specific version
  uses: eifinger/setup-rye@v4
  with:
    version: 'latest'

Install specific version

You can also specify a specific version of rye

- name: Install a specific version
  uses: eifinger/setup-rye@v4
  with:
    version: '0.12.0'

Validate checksum

You can also specify a checksum to validate the downloaded file. Checksums of versions 0.12.0 and later are automatically verified by this action. The sha265 hashes can be found on the releases page of the rye repo.

- name: Install a specific version and validate the checksum
  uses: eifinger/setup-rye@v4
  with:
    version: '0.12.0'
    checksum: 'c48d850e90649d868d512f60af67c74aa844d80f951fdb38589220662e709da7'

Enable caching

If you enable caching the virtual environment which gets created by rye under .venv will be cached. This can speed up runs which can reuse the cache by several minutes.

You can optionally define a custom cache key prefix.

- name: Enable caching and define a custom cache key prefix
  id: setup-rye
  uses: eifinger/setup-rye@v4
  with:
    enable-cache: true
    cache-prefix: 'optional-prefix'

When the cache was successfully restored the output cache-hit will be set to true and you can use it in subsequent steps. For the example above you can use it like this:

- name: Do something if the cache was restored
  if: steps.setup-rye.outputs.cache-hit == 'true'
  run: echo "Cache was restored"

Working directory

If your rye project is not at the root of the repository you can specify the working directory relative to the repository root. This is useful for monorepos.

- name: Enable caching and define a working directory
  uses: eifinger/setup-rye@v4
  with:
    enable-cache: true
    working-directory: 'path/to/rye/project'

Local storage path

If you want to save the cache to a local path you can specify the path with the cache-local-storage-path input. This can be useful if you are on a self hosted runner and want to save time and network traffic.

- name: Enable caching and define a custom cache path
  uses: eifinger/setup-rye@v4
  with:
    enable-cache: true
    cache-local-storage-path: '/path/to/cache'

It is recommended to cleanup the storage path to avoid running out of disk space. One option is to use a cron job to delete files older than 7 days like below.

0 0 * * * find /home/ubuntu/setup-rye-cache -type d -mtime +7 -exec rm -rf {} \;

API rate limit

To avoid hitting the error API rate limit exceeded you can supply a GitHub token with the github-token input.

- name: Install rye and supply a GitHub token
  uses: eifinger/setup-rye@v4
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}

How it works

This action downloads rye from the releases of the rye repo and uses the GitHub Actions Toolkit to cache it as a tool to speed up consecutive runs especially on self-hosted runners.

The installed version of rye is then added to the runner path so other steps can just use it by calling rye. To prevent interfering the other rye processes on the same runner RYE_HOME gets set to the repository roots parent and is cleaned up after a workflow run.

FAQ

Do I still need actions/setup-python when using this action?

No! This action was modelled as a drop-in replacement for actions/setup-python when using rye.

A simple example workflow could look like this:

- name: Checkout the repository
  uses: actions/checkout@v2
- name: Install the latest version of rye
  uses: eifinger/setup-rye@v4
  with:
    enable-cache: true
- name: Sync dependencies
  run: rye sync
- name: Lint
  run: rye lint

setup-rye's People

Contributors

dependabot[bot] avatar eifinger avatar github-actions[bot] avatar he0119 avatar my1e5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

setup-rye's Issues

Enabling cache but it redownloads and reinstalls rye and python

I'm using this action with a self-hosted runner. I'm using Gitea actions with a Docker-in-Docker approach (https://github.com/vegardit/docker-gitea-act-runner). This is my .yaml:

name: CI/CD
run-name: CI/CD
on: [push, pull_request]

jobs:
  checks:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: eifinger/setup-rye@v2
        id: setup-rye
        with:
          enable-cache: true
          cache-local-storage-path: '/opt/hostedtoolcache'
      - name: Install dependencies
        if: steps.setup-rye.outputs.cache-hit != 'true'
        run: |
          rye sync --no-lock
      - name: Lint
        run: |
          rye run lint

I can get the whole action to run successfully. The only thing that I'm struggling with is getting the cache to work. Looking at the logs it seemed like it would look for a cached version at /opt/hostedtoolcache. And indeed if I set this as my cache-local-storage-path it will say Cache restored from key. I don't know if I'm doing this correctly? It will then skip installing dependencies, but when it runs rye run lint it will take time to re-download [email protected] - is this expected behaviour? Also everytime I run the action it re-downloads the latest Rye and re-installs it - and the installation step itself takes around 20 seconds. I've attached a screenshot of the logs and the full log text.

image

10:09:41 ⭐ Run Main eifinger/setup-rye@v2
10:09:41 [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
10:09:41 [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
10:09:41 [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
10:09:41 [DEBUG] Writing entry to tarball workflow/envs.txt len:0
10:09:41 [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0
10:09:41 [DEBUG] Extracting content to '/var/run/act'
10:09:41 [DEBUG] type=remote-action actionDir=/data/cache/actions/eifinger-setup-rye@v2 actionPath= workdir=/workspace/my1e5/Test actionCacheDir=/data/cache/actions actionName=eifinger-setup-rye@v2 containerActionDir=/var/run/act/actions/eifinger-setup-rye@v2
10:09:41 [DEBUG] /var/run/act/actions/eifinger-setup-rye@v2
10:09:41 [DEBUG] Removing /data/cache/actions/eifinger-setup-rye@v2/.gitignore before docker cp
10:09:41   🐳  docker cp src=/data/cache/actions/eifinger-setup-rye@v2/ dst=/var/run/act/actions/eifinger-setup-rye@v2/
10:09:41 [DEBUG] Writing tarball /tmp/act180939727 from /data/cache/actions/eifinger-setup-rye@v2/
10:09:41 [DEBUG] Stripping prefix:/data/cache/actions/eifinger-setup-rye@v2/ src:/data/cache/actions/eifinger-setup-rye@v2/
10:09:41 [DEBUG] Extracting content from '/tmp/act180939727' to '/var/run/act/actions/eifinger-setup-rye@v2/'
10:09:41 [DEBUG] executing remote job container: [node /var/run/act/actions/eifinger-setup-rye@v2/dist/setup/index.js]
10:09:41   🐳  docker exec cmd=[node /var/run/act/actions/eifinger-setup-rye@v2/dist/setup/index.js] user= workdir=
10:09:41 [DEBUG] Exec command '[node /var/run/act/actions/eifinger-setup-rye@v2/dist/setup/index.js]'
10:09:41 [DEBUG] Working directory '/workspace/my1e5/Test'
10:09:42   | Downloading Rye from "https://github.com/astral-sh/rye/releases/latest/download/rye-x86_64-linux.gz" ...
10:09:42 ::debug::Downloading https://github.com/astral-sh/rye/releases/latest/download/rye-x86_64-linux.gz
10:09:42   | ::debug::Downloading https://github.com/astral-sh/rye/releases/latest/download/rye-x86_64-linux.gz
10:09:42 ::debug::Destination /tmp/a84d8c2c-dab3-486c-8dae-24c74c3dfb7c
10:09:42   | ::debug::Destination /tmp/a84d8c2c-dab3-486c-8dae-24c74c3dfb7c
10:09:44 ::debug::download complete
10:09:44   | ::debug::download complete
10:09:44   | Extracting downloaded archive...
10:09:44   | [command]/usr/bin/gunzip /tmp/a84d8c2c-dab3-486c-8dae-24c74c3dfb7c.gz
10:09:45   | [command]/usr/bin/chmod +x /tmp/a84d8c2c-dab3-486c-8dae-24c74c3dfb7c
10:09:45 ::debug::Checksum not provided. Checking known checksums.
10:09:45   | ::debug::Checksum not provided. Checking known checksums.
10:09:45 ::debug::Checking checksum for x86_64-linux-0.33.0.
10:09:45   | ::debug::Checking checksum for x86_64-linux-0.33.0.
10:09:45 ::debug::Checksum for /tmp/a84d8c2c-dab3-486c-8dae-24c74c3dfb7c_for_validation.gz is valid.
10:09:45   | ::debug::Checksum for /tmp/a84d8c2c-dab3-486c-8dae-24c74c3dfb7c_for_validation.gz is valid.
10:09:45 ::debug::Created temporary directory /tmp/rye_temp_home
10:09:45   | ::debug::Created temporary directory /tmp/rye_temp_home
10:09:45 ::debug::Caching tool setup-rye-2024-03-04 0.33.0 x86_64
10:09:45   | ::debug::Caching tool setup-rye-2024-03-04 0.33.0 x86_64
10:09:45 ::debug::source dir: /tmp/rye_temp_home
10:09:45   | ::debug::source dir: /tmp/rye_temp_home
10:09:45 ::debug::destination /opt/hostedtoolcache/setup-rye-2024-03-04/0.33.0/x86_64
10:09:45   | ::debug::destination /opt/hostedtoolcache/setup-rye-2024-03-04/0.33.0/x86_64
10:09:46 ::debug::finished caching tool
10:09:46   | ::debug::finished caching tool
10:09:46   | Installing Rye into /opt/hostedtoolcache/setup-rye-2024-03-04/0.33.0/x86_64
10:10:07   | Added /opt/hostedtoolcache/setup-rye-2024-03-04/0.33.0/x86_64/shims to the path
10:10:07   | Set RYE_HOME to /opt/hostedtoolcache/setup-rye-2024-03-04/0.33.0/x86_64
10:10:07 ##[add-matcher]/run/act/actions/eifinger-setup-rye@v2/.github/python.json
10:10:07   | ##[add-matcher]/run/act/actions/eifinger-setup-rye@v2/.github/python.json
10:10:07   | Backed up /opt/hostedtoolcache/setup-rye-2024-03-04/0.33.0/x86_64/config.toml
10:10:07 ::debug::followSymbolicLinks 'true'
10:10:07   | ::debug::followSymbolicLinks 'true'
10:10:07 ::debug::followSymbolicLinks 'true'
10:10:07   | ::debug::followSymbolicLinks 'true'
10:10:07 ::debug::implicitDescendants 'true'
10:10:07   | ::debug::implicitDescendants 'true'
10:10:07 ::debug::matchDirectories 'true'
10:10:07   | ::debug::matchDirectories 'true'
10:10:07 ::debug::omitBrokenSymbolicLinks 'true'
10:10:07   | ::debug::omitBrokenSymbolicLinks 'true'
10:10:07 ::debug::Search path '/workspace/my1e5/Test'
10:10:07   | ::debug::Search path '/workspace/my1e5/Test'
10:10:07 ::debug::/workspace/my1e5/Test/requirements-dev.lock
10:10:07   | ::debug::/workspace/my1e5/Test/requirements-dev.lock
10:10:07 ::debug::/workspace/my1e5/Test/requirements.lock
10:10:07   | ::debug::/workspace/my1e5/Test/requirements.lock
10:10:07 ::debug::Found 2 files to hash.
10:10:07   | ::debug::Found 2 files to hash.
10:10:10   | Cache restored from key: setup-rye-5-Linux-x86_64-rye-0.33.0-bda4ca0d6567ae4648f6c76c0c4db389288003120eb31da3949b5987f2bdde5b
10:10:10   ✅  Success - Main eifinger/setup-rye@v2
10:10:10 ::set-env:: RYE_HOME=/opt/hostedtoolcache/setup-rye-2024-03-04/0.33.0/x86_64
10:10:10 ::set-output:: rye-version=0.33.0
10:10:10 ::set-output:: cache-hit=true
10:10:10 ::add-path:: /opt/hostedtoolcache/setup-rye-2024-03-04/0.33.0/x86_64/shims
10:10:11 [DEBUG] evaluating expression 'steps.setup-rye.outputs.cache-hit != 'true''
10:10:11 [DEBUG] expression 'steps.setup-rye.outputs.cache-hit != 'true'' evaluated to 'false'
10:10:11 [DEBUG] Skipping step 'Install dependencies' due to 'steps.setup-rye.outputs.cache-hit != 'true''
10:10:11 [DEBUG] evaluating expression ''
10:10:11 [DEBUG] expression '' evaluated to 'true'
10:10:11 ⭐ Run Main Lint
10:10:11 [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
10:10:11 [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
10:10:11 [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
10:10:11 [DEBUG] Writing entry to tarball workflow/envs.txt len:0
10:10:11 [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0
10:10:11 [DEBUG] Extracting content to '/var/run/act'
10:10:11 [DEBUG] Wrote command 
10:10:11 
10:10:11 rye run lint
10:10:11 
10:10:11  to 'workflow/3'
10:10:11 [DEBUG] Writing entry to tarball workflow/3 len:14
10:10:11 [DEBUG] Extracting content to '/var/run/act'
10:10:11   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/3] user= workdir=
10:10:11 [DEBUG] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/3]'
10:10:11 [DEBUG] Working directory '/workspace/my1e5/Test'
10:10:12   | Downloading [email protected]
10:10:30   | Checking checksum
10:10:30   | Unpacking
10:10:32   | Downloaded [email protected]
10:10:32   | 1 file left unchanged
10:10:32   | All checks passed!
10:10:32   ✅  Success - Main Lint
10:10:33 [DEBUG] evaluating expression 'always()'
10:10:33 [DEBUG] expression 'always()' evaluated to 'true'
10:10:33 ⭐ Run Post eifinger/setup-rye@v2
10:10:33 [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
10:10:33 [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
10:10:33 [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
10:10:33 [DEBUG] Writing entry to tarball workflow/envs.txt len:0
10:10:33 [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0
10:10:33 [DEBUG] Extracting content to '/var/run/act'
10:10:33 [DEBUG] run post step for 'eifinger/setup-rye@v2'
10:10:33 [DEBUG] executing remote job container: [node /var/run/act/actions/eifinger-setup-rye@v2/dist/save-cache/index.js]
10:10:33   🐳  docker exec cmd=[node /var/run/act/actions/eifinger-setup-rye@v2/dist/save-cache/index.js] user= workdir=
10:10:33 [DEBUG] Exec command '[node /var/run/act/actions/eifinger-setup-rye@v2/dist/save-cache/index.js]'
10:10:33 [DEBUG] Working directory '/workspace/my1e5/Test'
10:10:33   | Cache hit occurred on key setup-rye-5-Linux-x86_64-rye-0.33.0-bda4ca0d6567ae4648f6c76c0c4db389288003120eb31da3949b5987f2bdde5b, not saving cache.
10:10:33   | Restored /opt/hostedtoolcache/setup-rye-2024-03-04/0.33.0/x86_64/config.toml
10:10:33   ✅  Success - Post eifinger/setup-rye@v2

Rate limit error

Rye's CI seems to run into rate limit issues using this action (correct me if I'm wrong on the source).

Here's the error from your recent contribution (v2) astral-sh/rye@fa0b306.

Run eifinger/setup-rye@v2
  with:
    version: latest
    enable-cache: false
Error: API rate limit exceeded for 20.97.191.142. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)

Changing .python-version with enable cache causes error

I bumped my .python-version from 3.12.2 to 3.12.3. I ran rye sync after doing this but it didn't change my requirements.lock or requirements-dev.lock. I pushed this change to my remote git server and it ran my CI workflow. setup-rye restored from cache (because the lock files were the same) so it skipped the install dependencies step. It was able to run rye fmt and rye lint without errors. But then when it tried to run rye run mypy . it detected a mismatch with the python version and I ended up getting this error:

2024-06-05 11:34:59 [ci/ci] ⭐ Run Main Static type checks
2024-06-05 11:34:59 [ci/ci] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
2024-06-05 11:34:59 [ci/ci] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
2024-06-05 11:34:59 [ci/ci] [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
2024-06-05 11:34:59 [ci/ci] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
2024-06-05 11:34:59 [ci/ci] [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0
2024-06-05 11:34:59 [ci/ci] [DEBUG] Extracting content to '/var/run/act'
2024-06-05 11:34:59 [ci/ci] [DEBUG] Wrote command 
2024-06-05 11:34:59 
2024-06-05 11:34:59 rye run mypy .
2024-06-05 11:34:59 
2024-06-05 11:34:59 
2024-06-05 11:34:59  to 'workflow/5'
2024-06-05 11:34:59 [ci/ci] [DEBUG] Writing entry to tarball workflow/5 len:17
2024-06-05 11:34:59 [ci/ci] [DEBUG] Extracting content to '/var/run/act'
2024-06-05 11:34:59 [ci/ci]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/5] user= workdir=
2024-06-05 11:34:59 [ci/ci] [DEBUG] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/5]'
2024-06-05 11:34:59 [ci/ci] [DEBUG] Working directory '/workspace/Research/Python'
2024-06-05 11:34:59 [ci/ci]   | Python version mismatch (found [email protected], expected [email protected]), recreating.
2024-06-05 11:34:59 [ci/ci]   | Initializing new virtualenv in /workspace/Research/Python/.venv
2024-06-05 11:34:59 [ci/ci]   | Python version: [email protected]
2024-06-05 11:35:00 [ci/ci]   | Generating production lockfile: /workspace/Research/Python/requirements.lock
2024-06-05 11:35:01 [ci/ci]   | Generating dev lockfile: /workspace/Research/Python/requirements-dev.lock
2024-06-05 11:35:07 [ci/ci]   | Installing dependencies
2024-06-05 11:35:07 [ci/ci]   | Built 1 editable in 218ms
2024-06-05 11:35:07 [ci/ci]   | Resolved 6 packages in 6ms
2024-06-05 11:35:18 [ci/ci]   | Downloaded 6 packages in 11.13s
2024-06-05 11:35:18 [ci/ci]   | Installed 7 packages in 99ms
2024-06-05 11:35:18 [ci/ci]   |  + attrs==23.2.0
2024-06-05 11:35:18 [ci/ci]   |  + cffi==1.16.0
2024-06-05 11:35:18 [ci/ci]   |  + mypackage==0.2.0 (from file:///workspace/Research/Python)
2024-06-05 11:35:18 [ci/ci]   |  + numpy==1.26.4
2024-06-05 11:35:18 [ci/ci]   |  + pycparser==2.22
2024-06-05 11:35:18 [ci/ci]   |  + scipy==1.13.0
2024-06-05 11:35:18 [ci/ci]   |  + soundfile==0.12.1
2024-06-05 11:35:18 [ci/ci]   | error: invalid or unknown script 'mypy'
2024-06-05 11:35:18 [ci/ci]   ❌  Failure - Main Static type checks
2024-06-05 11:35:18 [ci/ci] exitcode '1': failure

I'm not 100% sure what has happened. I have mypy listed in my pyproject.toml file under dev-dependencies. Did it not install the dev dependencies? Those 6 packages it downloaded are all my non-dev requirements.

jobs:
  ci:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout repository
      uses: actions/checkout@v4
      with:
        fetch-depth: 0
    - name: Setup Rye
      uses: eifinger/setup-rye@v3
      id: setup-rye
      with:
        enable-cache: true
    - name: Install dependencies
      if: steps.setup-rye.outputs.cache-hit != 'true'
      run: |
        rye sync --no-lock
    - name: Format
      run: |
        rye fmt --check
    - name: Lint
      run: |
        rye lint
    - name: Static type checks
      run: |
        rye run mypy .

Maybe set uv as the default?

Shall we switch to uv as the default now? Related: astral-sh/rye#1071

Originally posted by @SichangHe in #202 (comment)

Sorry for the confusing comment. I am not exactly clear what the situation is. I'll try to explain.

Background: So, my CI using setup-rye and PyPy3 failed, and in the discussion linked above we found that pip-tools + PyPy3 does not work, but uv + PyPy3 does.

My guess: setup-rye defaults to using pip-tools, causing the above CI failure. Rye itself defaults to use uv when it could (that was what happened when I installed it locally), so defaulting to pip-tools is a choice by setup-rye.

I don't know why uv is not the default here. Because it was experimental?

use uv?

Hi and thanks for the action. currently, I'm doing this to use uv:

      - name: Install rye
        uses: eifinger/setup-rye@v2

      - name: Install library
        run: |
          rye config --set-bool behavior.use-uv=true
          rye sync

is that the recommended approach or am I missing a feature?

Is it needed to set the toolchain to avoid two python downloads?

I am wondering if there is a need to set the RYE_TOOLCHAIN_VERSION from the rye documentation. From the logs it does not appear like a toolchain is installed when using the action, so I guess the only install happens during rye sync (which would be perfect for me). I couldn't find any information in the docs on this, so I'd highly appreciate any information on that :)

Cache pip cache

Determine pip cache dir and add it to the GitHub actions cache.

Cache not working

ci.yml:

  check:
    name: 'check'
    runs-on: ubuntu-latest
    if: github.event_name != 'push'
    steps:
      - uses: actions/checkout@v4
      - uses: mozilla-actions/[email protected]
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - uses: webfactory/[email protected]
        with:
          ssh-private-key: ${{ secrets.XXXX_SSH_KEY }} ${{ secrets.XXXX_SSH_KEY }}
      - uses: taiki-e/install-action@just
      - uses: baptiste0928/cargo-install@v3
        with:
          crate: cargo-cranky
      - uses: eifinger/setup-rye@v1
        with:
          enable-cache: true
      - uses: docker/setup-qemu-action@v3
        with:
          platforms: 'arm64'
      - run: |
          just install
          just check

The run basically does:

rye sync --no-lock
rye lint
rye run mypy

Run eifinger/setup-rye@v1:

  with:
    enable-cache: true
    version: latest
  env:
    CARGO_INCREMENTAL: 0
    CARGO_NET_GIT_FETCH_WITH_CLI: true
    RUSTC_WRAPPER: sccache
    RUSTFLAGS: -Dwarnings
    SCCACHE_GHA_ENABLED: true
    SCCACHE_PATH: /opt/hostedtoolcache/sccache/0.7.7/x64/sccache
    ACTIONS_CACHE_URL: https://acghubeus1.actions.githubusercontent.com/XXXXXXXXXXXXXXXXXX/
    ACTIONS_RUNTIME_TOKEN: ***
    CARGO_TERM_COLOR: always
    SSH_AUTH_SOCK: /tmp/ssh-XXXXXXRYONL9/agent.1718
    SSH_AGENT_PID: 1719
Latest version is 0.24.0
Downloading Rye from "https://github.com/mitsuhiko/rye/releases/download/0.24.0/rye-x86_64-linux.gz" ...
Extracting downloaded archive...
/usr/bin/gunzip /home/runner/work/_temp/785c558a-0255-4e63-9161-ssssssssssss.gz
/usr/bin/chmod +x /home/runner/work/_temp/785c558a-0255-4e63-9161-ssssssssssss
Installing Rye into /home/runner/work/_temp/rye_temp_home
/home/runner/work/_temp/785c558a-0255-4e63-9161-ssssssssssss self install --yes
Welcome to Rye!

This installer will install rye to /home/runner/work/_temp/rye_temp_home
This path can be changed by exporting the RYE_HOME environment variable.

Details:
  Rye Version: 0.24.0
  Platform: linux (x86_64)

Installed binary to /home/runner/work/_temp/rye_temp_home/shims/rye
Bootstrapping rye internals
Downloading [email protected]
Checking checksum
success: Downloaded [email protected]
Upgrading pip
Installing internal dependencies
Updated self-python installation at /home/runner/work/_temp/rye_temp_home/self

The rye directory /home/runner/work/_temp/rye_temp_home/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/runner/work/_temp/rye_temp_home/env"

error: process ID out of range

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).
For more information read https://mitsuhiko.github.io/rye/guide/installation

All done!
Moved Rye into /opt/hostedtoolcache/rye/0.24.0/x86_64
Added /opt/hostedtoolcache/rye/0.24.0/x86_64/shims to the path
Cache is not found

bug?: Drops `.rye` in current location

The current iteration of the action seems to drop the .rye folder in the project directory. When doing type-checking or other actions, this causes a lot of side effects.

For example, rye check has a lot of noise:

| error: Failed to parse .rye/py/[email protected]/lib/python3.12/idlelib/idle_test/example_stub.pyi:1:66: EOL while scanning string literal
| error: Failed to parse .rye/py/[email protected]/lib/Tix8.4.3/pref/WmDefault.py:86:2: unindent does not match any outer indentation level
| error: Failed to parse .rye/py/[email protected]/lib/python3.11/lib2to3/tests/data/crlf.py:1:7: Unexpected token "hi"
| error: Failed to parse .rye/py/[email protected]/lib/Tix8.4.3/pref/WmDefault.py:86:2: unindent does not match any outer indentation level
| error: Failed to parse .rye/py/[email protected]/lib/python3.11/lib2to3/tests/data/different_encoding.py:3:7: Unexpected token u"ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ"
| error: Failed to parse .rye/py/[email protected]/lib/python3.11/lib2to3/tests/data/py2_test_grammar.py:31:27: Invalid Token
| error: Failed to parse .rye/py/[email protected]/lib/python3.11/lib2to3/tests/data/false_encoding.py:2:7: Unexpected token "#coding=0"
| error: Failed to parse .rye/py/[email protected]/lib/python3.11/lib2to3/tests/data/bom.py:2:7: Unexpected token "BOM BOOM!"
| error: Failed to parse .rye/py/[email protected]/lib/python3.12/test/tokenizedata/badsyntax_3131.py:2:1: Got unexpected token €
| error: Failed to parse .rye/py/[email protected]/lib/python3.12/test/test_lib2to3/data/py2_test_grammar.py:31:27: Invalid Token
| error: Failed to parse .rye/py/[email protected]/lib/python3.12/test/test_lib2to3/data/false_encoding.py:2:7: Unexpected token "#coding=0"
| error: Failed to parse .rye/py/[email protected]/lib/python3.12/test/test_lib2to3/data/bom.py:2:7: Unexpected token "BOM BOOM!"
| error: Failed to parse .rye/py/[email protected]/lib/python3.12/test/test_lib2to3/data/crlf.py:1:7: Unexpected token "hi"
| error: Failed to parse .rye/py/[email protected]/lib/python3.12/test/test_lib2to3/data/different_encoding.py:3:7: Unexpected token u"ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ"
| error: Failed to parse .rye/py/[email protected]/lib/python3.11/test/badsyntax_3131.py:2:1: Got unexpected token €

Could you please consider adding a method to control the location where .rye is placed? Or just put it in $HOME? Thanks for the helpful Action! :)

Docs request: do we need `actions/setup-python`?

Do we still need actions/setup-python when using this action? Or if we are only using rye, can we just use setup-rye?

Also, do you mind documenting the answer in the README somewhere? This seems to be a replacement for setup-python

Use `uv` in the setup

Hi @eifinger thanks a lot for this useful action.

I would like to know if the current action is using uv or pip-tools for now and also if it would be painful to configure it to use uv ?

I know uv might be instable for now, but I would like to test if it makes the CI even faster.

Cache dependencies

Like Setup-Python does, this action might cache dependencies or at least wheels

.rye folder location

Some time with the latest release of this action, a new .rye folder showed up in the checkout location which now confuses calls like rye fmt etc. I had to add that folder to the pyproject.toml as excluded. This does not seem ideal.

astral-sh/rye#822

Cache toolchains

Currently only the default toolchains rye itself uses is cached. Others installed during rye sync should be cached as well

Process ID out of range

Hey!

I tested to use your action in my flow for setting up Rye. Everything works fine, but when looking in the logs of the Action, I see an error that probably shouldn't be there. Not sure why or how, and it doesn't seem to interfere with the action itself.

Run eifinger/setup-rye@v1
  with:
    version: latest
    enable-cache: false
Latest version is 0.[2](https://github.com/ToolSense/toolsense-flespi/actions/runs/7943851823/job/21688690377#step:3:2)4.0
Downloading Rye from "https://github.com/mitsuhiko/rye/releases/download/0.24.0/rye-x86_64-linux.gz" ...
Extracting downloaded archive...
/usr/bin/gunzip /home/runner/work/_temp/a5baccdf-[3](https://github.com/ToolSense/toolsense-flespi/actions/runs/7943851823/job/21688690377#step:3:3)[4](https://github.com/ToolSense/toolsense-flespi/actions/runs/7943851823/job/21688690377#step:3:4)9a-4d49-a6[5](https://github.com/ToolSense/toolsense-flespi/actions/runs/7943851823/job/21688690377#step:3:6)b-5adc7dbca1bf.gz
/usr/bin/chmod +x /home/runner/work/_temp/a5baccdf-349a-4d49-a[6](https://github.com/ToolSense/toolsense-flespi/actions/runs/7943851823/job/21688690377#step:3:7)5b-5adc[7](https://github.com/ToolSense/toolsense-flespi/actions/runs/7943851823/job/21688690377#step:3:8)dbca1bf
Installing Rye into /home/runner/work/_temp/rye_temp_home
/home/runner/work/_temp/a5baccdf-349a-4d49-a65b-5adc7dbca1bf self install --yes
Welcome to Rye!

This installer will install rye to /home/runner/work/_temp/rye_temp_home
This path can be changed by exporting the RYE_HOME environment variable.

Details:
  Rye Version: 0.24.0
  Platform: linux (x[8](https://github.com/ToolSense/toolsense-flespi/actions/runs/7943851823/job/21688690377#step:3:9)6_64)

Installed binary to /home/runner/work/_temp/rye_temp_home/shims/rye
Bootstrapping rye internals
Downloading cpython@3.[12](https://github.com/ToolSense/toolsense-flespi/actions/runs/7943851823/job/21688690377#step:3:13).1
Checking checksum
success: Downloaded [email protected]
Upgrading pip
Installing internal dependencies
Updated self-python installation at /home/runner/work/_temp/rye_temp_home/self

The rye directory /home/runner/work/_temp/rye_temp_home/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/runner/work/_temp/rye_temp_home/env"

error: process ID out of range

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).
For more information read https://mitsuhiko.github.io/rye/guide/installation

All done!
Moved Rye into /opt/hostedtoolcache/rye/0.[24](https://github.com/ToolSense/toolsense-flespi/actions/runs/7943851823/job/21688690377#step:3:25).0/x86_64
Added /opt/hostedtoolcache/rye/0.24.0/x86_64/shims to the path

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.