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

[WIP] use uv for resolving Pants plugins #21991

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

tdyas
Copy link
Contributor

@tdyas tdyas commented Feb 22, 2025

Use uv for resolving Pants plugins. Enabled via new --experimental-use-uv-for-plugin-resolution option.

@tdyas tdyas added category:internal CI, fixes for not-yet-released features, etc. release-notes:not-required PR doesn't require mention in release notes labels Feb 22, 2025
@tdyas tdyas force-pushed the plugins/use-uv-for-resolution branch from 5818295 to 9549a9e Compare February 24, 2025 01:42
Copy link
Contributor

@benjyw benjyw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting approach. Fair to say that uv itself is a side quest here? IIUC the real goal is to not need a scheduler, which means not using any existing pex-running rules. So at that point we must use some CLI tool directly, and uv is an interesting choice? But we could also use pip or even pex, I would guess? We just can't use existing pex machinery.

@tdyas
Copy link
Contributor Author

tdyas commented Feb 25, 2025

Interesting approach. Fair to say that uv itself is a side quest here? IIUC the real goal is to not need a scheduler, which means not using any existing pex-running rules. So at that point we must use some CLI tool directly, and uv is an interesting choice? But we could also use pip or even pex, I would guess? We just can't use existing pex machinery.

Correct, some tool needs to be invoked, it need not be uv. For context, uv was not my first choice. I tried to use pex with this approach in #21986, but generating the necessary magic shell scripts used by the VenvPex support is confusing me currently. Suggestions there are very much welcome.

So uv is a side quest but it turned out to be much simpler than trying to replicate the existing plugin resolution experience with pex outside of the Python backend logic.

@benjyw
Copy link
Contributor

benjyw commented Feb 25, 2025

Getting some experience with uv is probably a good idea...


yield working_set, root_dir, repo_dir


def test_no_plugins(rule_runner: RuleRunner) -> None:
with plugin_resolution(rule_runner) as (working_set, _, _):
@pytest.mark.parametrize("use_uv", (False, True))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can parametrize a fixture instead:

@pytest.fixture(params=[False, True], ids=["pip", "uv"])
def use_uv(request) -> bool:
    return request.param

def test_1(use_uv: bool): ...
def test_2(use_uv: bool): ...

see the docs here https://docs.pytest.org/en/6.2.x/fixture.html#parametrizing-fixtures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc. release-notes:not-required PR doesn't require mention in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants