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

Don't enable pre-releases when != is used with pre-release specifier #6640

Closed
Czaki opened this issue Aug 26, 2024 · 10 comments · Fixed by #7974
Closed

Don't enable pre-releases when != is used with pre-release specifier #6640

Czaki opened this issue Aug 26, 2024 · 10 comments · Fixed by #7974
Labels
compatibility Compatibility with a specification or another tool good first issue Good for newcomers help wanted Contribution especially encouraged question Asking for clarification or support

Comments

@Czaki
Copy link
Contributor

Czaki commented Aug 26, 2024

In napari project, we use uv to provide constraints files in automatic jobs

https://github.com/napari/napari/blob/35a99366f2a8ef5bcdbd6e1f874f5ca2a7572582/.github/workflows/upgrade_test_constraints.yml

In the last run, the output contained bumping zarr to prerelease version

obraz

even if we specify only lower bound constraint without any prerelease version: https://github.com/napari/napari/blob/35a99366f2a8ef5bcdbd6e1f874f5ca2a7572582/pyproject.toml#L143

The whole command used for compilation is:

uv pip compile --python-version 3.12 --output-file napari_repo/resources/constraints/constraints_py3.12.txt napari_repo/pyproject.toml napari_repo/resources/constraints/version_denylist.txt --extra pyqt5 --extra pyqt6 --extra pyside2 --extra pyside6_experimental --extra testing --extra testing_extra --extra optional

Commit showing problem is here napari/napari@c81b0d0 (#7212)
And problematic line here napari/napari@c81b0d0 (#7212)

@charliermarsh
Copy link
Member

Thanks, we'll take a look!

@charliermarsh charliermarsh self-assigned this Aug 26, 2024
@charliermarsh charliermarsh added the bug Something isn't working label Aug 26, 2024
@charliermarsh
Copy link
Member

So, I think the problem is that zarr!=3.0.0a0 is causing uv to think that pre-releases are acceptable for zarr, so it's then picking the newest version of zarr, which is 3.0.0a1.

@charliermarsh
Copy link
Member

If I remove that line from napari_repo/resources/constraints/version_denylist.txt, it works as expected... (Also make sure you remove resources/constraints/constraints_py3.12.txt if it exists, since if that contains a pre-release, we'll continue using that pinned version.)

@Czaki
Copy link
Contributor Author

Czaki commented Aug 26, 2024

So, I think the problem is that zarr!=3.0.0a0 is causing uv to think that pre-releases are acceptable for zarr, so it's then picking the newest version of zarr, which is 3.0.0a1.

oh. We are using this file also in pre-release tests.

I there, any option to provide constraints, but without allowing to enable pre-release? to have a single source of problematic versions?

@zanieb
Copy link
Member

zanieb commented Aug 26, 2024

Does --prereleases disallow work? The default is if-necessary-or-explicit and these are "explicit" specifiers.

https://docs.astral.sh/uv/reference/settings/#prerelease

@charliermarsh
Copy link
Member

Yeah I think --prerelease disallow (or UV_PRERELEASE, or in your pyproject.toml) would be the recommended solution.

@charliermarsh charliermarsh added question Asking for clarification or support and removed bug Something isn't working labels Aug 26, 2024
@notatallshaw
Copy link
Contributor

So, I think the problem is that zarr!=3.0.0a0 is causing uv to think that pre-releases are acceptable for zarr, so it's then picking the newest version of zarr, which is 3.0.0a1.

FYI, the intent of the spec author is that != should never imply a pre-release.

I have a PR for packaging to match uv's behavior on < and >, which is part of the spec, but also explicitly test != to not imply a pre-release: pypa/packaging#794

@charliermarsh
Copy link
Member

Interesting, ok, we could change that. What do you think @zanieb? Seems reasonable to me.

@zanieb
Copy link
Member

zanieb commented Aug 26, 2024

I think that's reasonable too, but low priority to change.

@zanieb zanieb added the compatibility Compatibility with a specification or another tool label Aug 26, 2024
@charliermarsh charliermarsh added the help wanted Contribution especially encouraged label Aug 26, 2024
@charliermarsh charliermarsh removed their assignment Aug 26, 2024
@charliermarsh charliermarsh changed the title uv pip compile result in prerelease version of package Don't enable pre-releases when != is used with pre-release specifier Aug 26, 2024
@charliermarsh
Copy link
Member

Retitled the issue and added help-wanted.

@charliermarsh charliermarsh added the good first issue Good for newcomers label Aug 27, 2024
jni pushed a commit to napari/napari that referenced this issue Oct 3, 2024
# References and relevant issues
Because of astral-sh/uv#6640

# Description

Block 3.0.0a5, 3.0.0a6 to make update constraints work again
charliermarsh added a commit that referenced this issue Oct 21, 2024
## Summary

closes #6640

## Test Plan

Could you suggest how I should test it? 

(already tested locally)

---------

Co-authored-by: konstin <[email protected]>
Co-authored-by: Charles Tapley Hoyt <[email protected]>
Co-authored-by: Charlie Marsh <[email protected]>
zanieb pushed a commit that referenced this issue Oct 21, 2024
closes #6640

Could you suggest how I should test it?

(already tested locally)

---------

Co-authored-by: konstin <[email protected]>
Co-authored-by: Charles Tapley Hoyt <[email protected]>
Co-authored-by: Charlie Marsh <[email protected]>
zanieb pushed a commit that referenced this issue Oct 22, 2024
closes #6640

Could you suggest how I should test it?

(already tested locally)

---------

Co-authored-by: konstin <[email protected]>
Co-authored-by: Charles Tapley Hoyt <[email protected]>
Co-authored-by: Charlie Marsh <[email protected]>
zanieb pushed a commit that referenced this issue Oct 24, 2024
closes #6640

Could you suggest how I should test it?

(already tested locally)

---------

Co-authored-by: konstin <[email protected]>
Co-authored-by: Charles Tapley Hoyt <[email protected]>
Co-authored-by: Charlie Marsh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Compatibility with a specification or another tool good first issue Good for newcomers help wanted Contribution especially encouraged question Asking for clarification or support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@charliermarsh @zanieb @Czaki @notatallshaw and others