Skip to content

Support installing additional executables in uv tool install#7592

Closed
lucab wants to merge 20 commits intoastral-sh:mainfrom
lucab:ups/tool-install-additional-exes
Closed

Support installing additional executables in uv tool install#7592
lucab wants to merge 20 commits intoastral-sh:mainfrom
lucab:ups/tool-install-additional-exes

Conversation

@lucab
Copy link
Contributor

@lucab lucab commented Sep 20, 2024

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

Closes #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.

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.

@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 improvement to existing functionality 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 14 times, most recently from ab8e780 to 0c9f450 Compare September 27, 2024 15:31
@lucab lucab changed the title [WIP] Support installing additional executables in uv tool install Support installing additional executables in uv tool install Sep 30, 2024
@lucab
Copy link
Contributor Author

lucab commented Sep 30, 2024

I think this should be in a complete state now, and there are functional tests for install/upgrade/uninstall flows.

The main remaining thing to decide is the name of the flag, in order to finalize the PR.
My personal suggestion would be --with-commands-from, as it blends with existing nomenclature.
But I'm happy to go with whatever @zanieb or @charliermarsh actually prefer, just let me know here.

@zanieb zanieb self-assigned this Sep 30, 2024
@lucab lucab force-pushed the ups/tool-install-additional-exes branch from d291b85 to 0f39fcb Compare October 3, 2024 08:11
@lucab lucab force-pushed the ups/tool-install-additional-exes branch from 0f39fcb to fe56b74 Compare October 3, 2024 08:22
@lucab lucab marked this pull request as ready for review October 3, 2024 09:23
@zanieb
Copy link
Member

zanieb commented Oct 3, 2024

Thanks! I'll try to review this tomorrow.

edit: I had some time to give it a quick look now

Comment on lines +86 to +87
#[serde(skip_serializing_if = "Option::is_none")]
pub from: Option<String>,
Copy link
Member

Choose a reason for hiding this comment

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

Will adding this break old tool installs, i.e., if it's missing?

Copy link
Contributor

Choose a reason for hiding this comment

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

The only other location from is used is in upgrade.rs to collect dependency packages (excluding the main tool) that have entry points. If from is None, then only entry points from site packages are installed in install_executables.

@gaborbernat
Copy link
Contributor

Anything is left here to do? from the latest review seems to be implied that it's ready.

@zanieb
Copy link
Member

zanieb commented Mar 26, 2025

Yeah there's still work to do here. i.e., #7592 (comment) is important. I'd have to go deeper on the topic again to see if there's more. Are you interested in picking it up?

@mykelalvis
Copy link

Bumping this as "very nice to have". If there is testing to perform, I'm willing to help out, but my knowledge of this codebase is low and my available time is limited.

zanieb added a commit that referenced this pull request Jul 30, 2025
Close #6314

## Summary

Continuing from #7592. Created a new PR to rebase the old branch with
`main`, cleaned up test errors, and improved readability.

## Test Plan

Same test cases as in #7592.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
@zanieb zanieb closed this Jul 30, 2025
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 uv tool Related to the uv tool interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support including dependency executables (e.g., --include-deps) in uv tool install

5 participants

Comments