Skip to content

feat: add Homebrew formula support#3

Open
himself65 wants to merge 1 commit intojackwener:mainfrom
himself65:feat/homebrew-support
Open

feat: add Homebrew formula support#3
himself65 wants to merge 1 commit intojackwener:mainfrom
himself65:feat/homebrew-support

Conversation

@himself65
Copy link

Summary

  • Add Formula/xhs-cli.rb Homebrew formula so users can install with brew install jackwener/xhs/xhs-cli
  • Add .github/workflows/update-homebrew.yml to auto-update the formula when a new version tag is pushed
  • Update both READMEs with Homebrew installation instructions

How it works

The repo itself acts as a Homebrew tap. Users can install directly with:

brew install jackwener/xhs/xhs-cli

Or tap first:

brew tap jackwener/xhs
brew install xhs-cli

Formula approach

The formula creates a Python virtualenv and uses pip install xhs-cli (with binary wheels allowed). This is needed because several transitive dependencies have no sdist on PyPI:

  • playwright — wheel-only
  • ua-parser-builtins — wheel-only
  • geoip2 — uses uv_build (Rust-based), can't build from source in Homebrew sandbox

Auto-update workflow

When a new version tag (e.g., v0.1.4) is pushed, the update-homebrew.yml workflow:

  1. Waits for the package to appear on PyPI
  2. Fetches the new sdist URL and SHA256
  3. Updates Formula/xhs-cli.rb with the new version
  4. Commits and pushes to main

Test plan

  • Tested brew install locally — installs successfully
  • xhs --help works after installation
  • Test auto-update workflow on next release

- Add Formula/xhs-cli.rb for `brew install jackwener/xhs/xhs-cli`
- Add GitHub Actions workflow to auto-update formula on new releases
- Update README.md and README_EN.md with Homebrew installation option

The formula creates a Python virtualenv and pip-installs xhs-cli with
all dependencies. This approach is needed because several transitive
dependencies (playwright, ua-parser-builtins, geoip2) are wheel-only
or use Rust-based build backends incompatible with source-only builds.

Users install with:
  brew install jackwener/xhs/xhs-cli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant