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] Support installing additional executables in uv tool install #7592

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

Conversation

lucab
Copy link
Contributor

@lucab lucab commented Sep 20, 2024

WIP: this is an initial working PoC. The flag name still needs to be finalized, and there are likely some hidden cases broken by allowing executables from multiple packages.


This enhances uv tool install in order to allow installing executables from multiple packages in a single call.

Ref: #6314

Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

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

Nice! This seems like a great start.

crates/uv-cli/src/lib.rs Outdated Show resolved Hide resolved
crates/uv/tests/tool_install.rs Outdated Show resolved Hide resolved
Comment on lines 3071 to 3058
Installed 11 executables: ansible, ansible-config, ansible-connection, ansible-console, ansible-doc, ansible-galaxy, ansible-inventory, ansible-playbook, ansible-pull, ansible-test, ansible-vault
Installed 1 executable: ansible-lint
Installed 1 executable: ansible-community
Copy link
Member

Choose a reason for hiding this comment

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

We'll probably want to collapse these and/or include the "from" package

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have a preference on how this should look like?
For the moment I've updated it to:

Installed 11 additional executables from `ansible-core`: ansible, ansible-config, ansible-connection, ansible-console, ansible-doc, ansible-galaxy, ansible-inventory, ansible-playbook, ansible-pull, ansible-test, ansible-vault
Installed 1 additional executable from `ansible-lint`: ansible-lint
Installed 1 executable: ansible-community

I'm absolutely not sold on this being the final form.

Copy link
Member

Choose a reason for hiding this comment

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

The part that stands out to me there is that it's a bit weird to say "additional" before we show the main group of executables we installed.

I think I'd go with whatever is decent and simple here, then revisit the output entirely. For example, I think this should probably match the style of our install commands? Like:

Installed 13 executables
+ ansible (from ansible-core)
+ ansible-config (from ansible-core)
+ ansible-lint
+ ansible-community
...

If the package name matches the executable name I'd probably omit the "from" portion.

Anyway, I think that is separate from the goal here and we should avoid going down that road in this pull request.

Comment on lines 3022 to 3029
.arg("--i-want-ponies")
.arg("ansible-core")
.arg("--i-want-ponies")
.arg("ansible-lint")
.arg("ansible==9.3.0")
Copy link
Member

Choose a reason for hiding this comment

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

Minor note: This is probably an expensive test because the package is big. We might want to find a smaller package to keep the test case minimal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Many dependencies were coming from ansible-lint, which is an extra package providing an additional entrypoint. I replaced that with black, as it covers the same scenario with fewer transitive deps.

If you have an idea about a better combo than ansible and ansible-core, I'll happily replace them here.

crates/uv/src/lib.rs Outdated Show resolved Hide resolved
crates/uv/tests/tool_install.rs Show resolved Hide resolved
@lucab lucab force-pushed the ups/tool-install-additional-exes branch from 67a3ac0 to e40e3ff Compare September 20, 2024 17:46
@zanieb zanieb added enhancement New feature or request uv tool Related to the uv tool interface labels Sep 20, 2024
@lucab lucab force-pushed the ups/tool-install-additional-exes branch 2 times, most recently from 49cb25e to 3a05460 Compare September 25, 2024 10:46
+ pycparser==2.21
+ pyyaml==6.0.1
+ resolvelib==1.0.1
Installed 11 executables from `ansible-core`: ansible, ansible-config, ansible-connection, ansible-console, ansible-doc, ansible-galaxy, ansible-inventory, ansible-playbook, ansible-pull, ansible-test, ansible-vault
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a funny issue here, it seems that on Windows only there is a different sorting for the strings ansible and ansible-<whatever>:

- Installed 11 executables from `ansible-core`: ansible, ansible-config, ansible-connection, ansible-console, ansible-doc, ansible-galaxy, ansible-inventory, ansible-playbook, ansible-pull, ansible-test, ansible-vault
+ Installed 11 executables from `ansible-core`: ansible-config, ansible-connection, ansible-console, ansible-doc, ansible-galaxy, ansible-inventory, ansible-playbook, ansible-pull, ansible-test, ansible-vault, ansible

Copy link
Member

Choose a reason for hiding this comment

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

That's horrible :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to abuse CI a bit to get to the bottom of this (sorry if I flooded you with notifications).
It turns out there is a .exe suffix (filtered out in test output) and thus ansible < ansible-config(.exe) < ansible.exe (due to the ASCII order of - vs .).
The same suffix is also present in the receipt, making its ordering OS-dependant.

Copy link
Member

Choose a reason for hiding this comment

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

I'm used to Charlie force-pushing 1000 times per pull request so no worries.

Ah that's really interesting. Good sleuthing. I was about to suggest trimming the suffix for sorts but it looks like you're on it in 0c9f450 — should you use the std::env::consts::EXE_SUFFIX const there?

The filtering can be quite misleading like that sometimes. I wonder if we can output an unfiltered snapshot on failure too? cc @konstin the snapshot macro master.

@lucab lucab force-pushed the ups/tool-install-additional-exes branch 13 times, most recently from 3838164 to ab8e780 Compare September 27, 2024 15:25
@lucab lucab force-pushed the ups/tool-install-additional-exes branch from ab8e780 to 0c9f450 Compare September 27, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request uv tool Related to the uv tool interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants