Daniel Fleischer f38e22f26a Add source option to brew bundle uv tools
Motivation:
`brew bundle dump` could not round-trip a uv tool installed from a
non-PyPI source. Installing with:

    uv tool install git+https://github.com/astral-sh/ruff.git

records the git source in uv's receipt, but `dump` emitted only
`uv "ruff"`, so restoring the Brewfile would reinstall from PyPI (or
fail) rather than the git repo. The source was lost because
`Uv.parse_tool_list` ran `uv tool list --show-with --show-extras`, which
never reports the source; uv only surfaces it via
`--show-version-specifiers` as `ruff v0.14 [required: git+https://...]`.

Changes:
- Request `--show-version-specifiers` and parse the `[required: ...]`
  segment, keeping it only when it is a real source (git/URL/path)
  rather than a bare version constraint like `>=0.1`.
- Add a `source:` Brewfile option to the uv DSL, validated as a String
  and stored only when present (mirrors flatpak's `url:` handling).
- Thread `source` through install (installs from the source instead of
  the name), dump (emits `, source: "..."`), and the already-installed
  check so `brew bundle check`/`cleanup` treat two tools with the same
  name but different sources as distinct.
- Extract the package-manager bootstrap in the base extension into
  `Extension.ensure_package_manager_installed!` so uv's overridden
  `preinstall!` reuses it instead of duplicating the logic.

Example Brewfile line now dumped and restored faithfully:

    uv "ruff", source: "git+https://github.com/astral-sh/ruff.git"

Methods added:
- Uv.parse_source / Uv.source_requirement? (extract + classify source)
- Uv.dump_source (read source from a package record)
- Uv#preinstall!, Uv#install!, Uv#package_installed?, Uv#dump_entry,
  Uv#installed_and_up_to_date? (source-aware overrides)
- Extension.ensure_package_manager_installed! (shared bootstrap)

Documented the option with an example in Brew-Bundle-and-Brewfile.md.

---------------------------------------------------

Address review feedback on the uv `source:` option:

- Extract the source-detection regex into a `SOURCE_REQUIREMENT_REGEX`
  constant and inline the single-use `source_requirement?` helper.
- Replace hard-to-read ternaries in `parse_source` and `dump_source`
  with early returns and a typed `package_source` helper, mirroring the
  `dump_with`/`package_with` pattern and dropping an unnecessary cast.
- Simplify `format_checkable` to pass entry options straight through (as
  Flatpak does), letting the typed extractors handle with/source.

--------------------------------------------------

Address uv bundle review feedback

- parse_source: fold the .git suffix into SOURCE_REQUIREMENT_REGEX so
  the check is a single match?.
- entry/package_source: use .fetch(:source, nil) to distinguish an
  unset source from an explicit nil.
- package_source: replace the silent is_a?(String) guard with a T.cast
  on the :source value, matching Flatpak (uv casts only the value since
  its options mix :with arrays with the :source string).
- Consolidate source stripping into a single normalize_source helper,
  used by entry, parse_source and normalized_options.
2026-07-06 09:47:17 +03:00
2026-06-10 13:13:51 +01:00
2026-06-13 08:17:31 +01:00
2026-07-05 19:52:48 +00:00
2026-05-20 19:35:06 +01:00
2026-05-04 09:21:18 +01:00
2026-05-19 11:47:11 +01:00
2026-06-10 13:13:51 +01:00
2024-05-01 11:35:21 +02:00
2026-02-02 12:30:22 -05:00
2026-06-06 11:43:48 +01:00
2026-06-20 00:32:45 +00:00

🍺 Homebrew

Latest GitHub release BSD-2-Clause License GitHub Sponsors Open Collective backers and sponsors

See Homebrew's homepage at brew.sh for installation instructions, what homebrew does, packages, brew bundle and more.

Homebrew install demo

💸 Donations

Homebrew is a non-profit project run entirely by volunteers, not employees. We need your funds to pay for software, hardware and hosting around continuous integration and future improvements to the project. Every donation will be spent on making Homebrew better for our users.

Please consider a regular donation through GitHub Sponsors, Open Collective or Patreon. Homebrew is fiscally hosted by the Open Source Collective.

📚 Documentation

Read the Homebrew manual with man brew.

Read installation, troubleshooting, contribution including the FAQ on docs.brew.sh.

Read the Homebrew Blog for release notes, project updates and announcements.

📦 Packages

Find formulae, casks, dependencies, versions and package metadata on formulae.brew.sh.

View anonymised install, build and operating system usage data at formulae.brew.sh/analytics. Read how Homebrew uses Anonymous Analytics.

🔧 Get Help

First, please run brew update and run (and read) brew doctor.

Second, read the Troubleshooting Checklist.

If you don't read these it will take us far longer to help you with your problem.

After this, if you still need help, please ask in Homebrew/discussions or follow (and read) the Homebrew/brew new issue chooser.

💬 Social

Follow Homebrew on Mastodon, Bluesky, 𝕏 (Twitter) or subscribe to the newsletter.

🤝 Contributing

We'd love you to join us and >10,000 others by contributing to Homebrew!

First, please read our Contribution Guide and Code of Conduct.

A good starting point for contributing is:

  • brew tap --force homebrew/core or brew tap --force homebrew/cask (depending on whether you'd rather work on formulae or casks)
  • perform a strict audit on a package you use e.g. brew audit --strict ffmpeg for FFmpeg
  • if no warnings, run brew audit --strict to run on all packages and pick one to fix
  • read through the warnings and fix them until brew audit --strict <package> shows no results
  • submit a pull request with your fixes

Alternatively, for something more substantial, check out one of the open issues in Homebrew/brew, Homebrew/homebrew-core or Homebrew/homebrew-cask.

If you've had inspiration for a new feature or bug fix: we don't need you to open an issue first, just open a pull request with your implementation and we'll review it.

Good luck!

🔐 Security

Please see our security policy for how to report security issues and what is in scope.

👥 Who We Are

Homebrew's Project Leader is Mike McQuaid.

Homebrew's Lead Maintainers are Bevan Kay, Bo Anderson, Branch Vincent, Carlo Cabrera, Dustin Rodrigues, FX Coudert, Issy Long, Justin Krehel, Michael Cho, Michka Popoff, Mike McQuaid, Nanda H Krishna, Patrick Linnane, Rui Chen, Ruoyu Zhong, Sam Ford, Sean Molenaar and Thierry Moisan.

Homebrew's other Maintainers are Anton Melnikov, Caleb Xu, Daeho Ro, Douglas Eichelberger, Eric Knibbe, Klaus Hipp, Markus Reiter, Rylan Polster, Štefan Baebler and William Woodruff.

Homebrew was originally created by Max Howell.

📜 License

Code is under the BSD 2-clause "Simplified" License. Documentation is under the Creative Commons Attribution license.

💛 Sponsors

Our macOS continuous integration infrastructure is hosted by MacStadium's Orka.

Powered by MacStadium

Secure password storage and syncing is provided by 1Password for Teams.

1Password

https://brew.sh's DNS is resolving with DNSimple.

DNSimple DNSimple

Homebrew is generously supported by Joshua Baer, Randy Reddig, Codecademy, b.well, Workbrew, GitHub, Custom Ink, Naveen Nathan, SAP and many other users and organisations via GitHub Sponsors.

GitHub

S
Description
No description provided
Readme
205 MiB
Languages
Ruby 93.9%
Shell 4.2%
Roff 1.5%
HTML 0.3%