wntrblm / nox

Flexible test automation for Python
https://nox.thea.codes
Apache License 2.0
1.3k stars 148 forks source link

Docs suggestion[?]: uv backend needs "--refresh-package" flag to install up-to-date version of local package. #827

Closed timstaley closed 3 months ago

timstaley commented 4 months ago

Current Behavior

I've just been experimenting with the new uv backend - it's super fast and seems to mostly just work, so much happiness around that :)

However, I hit a fair bit of confusion when running some code via nox and seeing outdated results compared to my IDE. Swapping backend between venv and uv confirms this is because uv is using a cached (outdated) version of my local package, when it should be rebuilding from the source. (Possibly related to this issue? https://github.com/astral-sh/uv/issues/2844)

Anyhow, I can fix this if I replace

    session.install(".[dev]")

with

    session.install(".[dev]", "--refresh-package", "my-dev-pkg")

I'm guessing that whether or not this should 'just work' is an upstream issue for the UV folks, but maybe it's worth a note in the Nox docs around UV usage - I imagine this will be a pretty common failure case.

Expected Behavior

With the setting

nox.options.default_venv_backend = "uv"

Installing my package under development into a nox-env via

    session.install(".[dev]")

I expected the same behaviour as plain pip / venv - rebuild and install the latest version of my package from source.

Instead; I get the version of my package from when I first switched backend to uv, because it's caching the build.

Steps To Reproduce

No response

Environment

- OS: MacOS 
- Python: Python 3.11
- Nox: 2024.4.15

Anything else?

No response

henryiii commented 4 months ago

-e. is better, though it looks like even that isn't rebuild, so it wouldn't work well for a binary package (or when adding entry points, etc).

Would be a good thing to document until/if something changes upstream.