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

Ignore irrelevant platform-specific packages during resolution #9275

Open
Vinno97 opened this issue Nov 20, 2024 · 2 comments · May be fixed by #9344
Open

Ignore irrelevant platform-specific packages during resolution #9275

Vinno97 opened this issue Nov 20, 2024 · 2 comments · May be fixed by #9344
Assignees
Labels
enhancement New feature or improvement to existing functionality

Comments

@Vinno97
Copy link

Vinno97 commented Nov 20, 2024

Hi,

I've noticed that uv still tries to resolve packages that are supposed to be irrelevant for the configured environment. I'm working on a server with a private registry where we don't have Darwin packages. When I try to install ipykernel, however, I see it still tries to resolve a Darwin-specific package, which then fails as it isn't available in our registry. Specifically, it's about appnope, which is configured as 'appnope>=0.1.2;platform_system=="Darwin"' in ipykernel' s pyproject.toml.(https://github.com/ipython/ipykernel/blob/8c4901d691b1f309da3b80eefad5af13d7418185/pyproject.toml#L32C6-L32C13)

I'm using uv 0.5.2 on RHEL.

[project]
name = "test-project"
version = "0.1.0"
description = "My test project"
readme = "README.md"

dependencies = [
    "ipykernel ; sys_platform == 'linux'"
]

[tool.uv]
environments = [
    "sys_platform == 'linux'"
]
$ uv lock -v 2>&1 | grep Darwin
DEBUG Solving split (python_full_version == '3.10'and platform_system == 'Darwin' and sys_platform == 'linux') ...
DEBUG Adding transitive dependency for ipykernel==x.x.x: appnope{platform_system == 'Darwin'}*
DEBUG Adding transitive dependency for ipykernel==x.x.x: appnope{platform_system == 'Darwin'}*

I think it might be related to #9051 (comment)

@charliermarsh
Copy link
Member

You might want to add something like platform_system == "Linux" to environments? The system doesn't know that platform_system == 'Darwin' and sys_platform == 'linux' are mutually exclusive -- there's nothing in the spec that says they have to be, it's just true in practice.

@charliermarsh charliermarsh self-assigned this Nov 20, 2024
@charliermarsh charliermarsh added the enhancement New feature or improvement to existing functionality label Nov 20, 2024
@Vinno97
Copy link
Author

Vinno97 commented Nov 21, 2024

Oh that's interesting and, though annoying, quite logical. Using platform_system indeed works and this then isn't a bug.


If you think it's worthwhile, I'd be willing to add a small note to your documentation about this, as it currently uses sys_platform exclusively. This would then not work if any of your dependencies, like ipykernel uses platform_system instead of sys_platform.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants