Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uv >=4.8 cache error output #7479

Closed
pmbarrett314 opened this issue Sep 17, 2024 · 17 comments
Closed

uv >=4.8 cache error output #7479

pmbarrett314 opened this issue Sep 17, 2024 · 17 comments
Labels
bug Something isn't working cache Caching of packages and metadata

Comments

@pmbarrett314
Copy link

UV 4.8 and above is outputting an error that is breaking tests that expect specific console output when caching is enabled. 4.7 works fine.

The error is:
error: Failed to build: curses-menu @ file:///home/runner/work/curses-menu/curses-menu Caused by: Failed to deserialize cache entry Caused by: wrong msgpack marker FixArray(2)'

which comes from this run.

It doesn't seem to be causing any issues running most of my tests, only the ones that are using pyte to test the visual output of my code, which leads me to believe the error itself might not be causing the break, but that it might be being output somewhere it shouldn't be (or I'm reading output from somewhere I shouldn't be).

Do I just need to suppress this error somehow or is this an actual bug?

@zanieb
Copy link
Member

zanieb commented Sep 17, 2024

Can you point to the uv invocation you're using?

cc @BurntSushi

@zanieb zanieb added bug Something isn't working cache Caching of packages and metadata labels Sep 17, 2024
@pmbarrett314
Copy link
Author

Here's the relevant job from my GitHub Action

  initial-test:
    name: Test One Version First
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install uv
        uses: astral-sh/setup-uv@v3
        with:
          version: ${{ vars.UV_VERSION }}
          enable-cache: true
      - name: Set up Python
        run: uv python install ${{ vars.MAIN_PYTHON }}
      - name: Install the project
        run: uv sync --all-extras --dev
      - run: uv run pytest
        name: Run tests
      - run: uv run coverage lcov
        name: Generate coverage report for this run
      - name: Upload coverage report for this run to coveralls
        uses: coverallsapp/github-action@main
        with:
          github-token: ${{ secrets.github_token }}
          path-to-lcov: .cov/coverage.lcov
          parallel: true

@charliermarsh
Copy link
Member

Do you see the same errors if you avoid using the shared GitHub Actions cache? Like with enable-cache = false? I'm trying to understand whether this is a cache compatibility issue (you have some data from pre-4.8, and we broke compatibility in 4.8) or a standalone issue on 4.8.

@pmbarrett314
Copy link
Author

The issue initially showed up on 4.10, I deleted all of my caches and then tried a few different versions to narrow it down between 4.7 and 4.8. I'll set enable-cache to false and report back.

@pmbarrett314
Copy link
Author

It does still output that error with enable-cache = false on 4.8 but not 4.7

@charliermarsh
Copy link
Member

Okay thank you! If you run uv cache clean before uv python install, do you see the same thing?

@pmbarrett314
Copy link
Author

I do indeed

@charliermarsh
Copy link
Member

Thanks. I can replicate this just by cloning and running uv run pytest test/test_graphics.py::TestBasicMenu::test_basic_menu.

@pmbarrett314
Copy link
Author

That does also happen for me.

@charliermarsh
Copy link
Member

I can't replicate this as soon as I switch to a local uv build, even at the same commit.

@charliermarsh
Copy link
Member

It looks like that job is running uv==0.3.1? I think this is just about the uv resolution in the subprocess or something.

@charliermarsh
Copy link
Member

I think when you run uv run pytest test/test_graphics.py::TestBasicMenu::test_basic_menu, then inner uv run command is then going to resolve to the uv version of the project.

@pmbarrett314
Copy link
Author

Yep, updating the uv requirement in uv.lock followed by uv cache clean fixes that on my local machine. Do y'all have any thoughts on my janky "uv-within-uv" scenario other than just making sure I keep the lockfile up to date with the version I'm using in Actions?

@charliermarsh
Copy link
Member

(I do think there may still be a bug here, maybe we forgot to bump a cache version somewhere between 0.3.1 and 0.4.10.)

@charliermarsh
Copy link
Member

Actually, perhaps our behavior is correct... The main issue is we included a change in the cache such that 0.4.7 entries can be read by 0.4.8, but not the other way around.

@charliermarsh
Copy link
Member

I think my suggestion would be to pin the uv version within your pyproject.toml. Alternatively, you might want to use a dedicated, separate cache directory for the runs within the project? Like, pass --cache-dir ./foo to the uv run subprocess calls.

@pmbarrett314
Copy link
Author

That sounds good, thanks for looking into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cache Caching of packages and metadata
Projects
None yet
Development

No branches or pull requests

3 participants