Skip to content

Commit c1c956d

Browse files
committed
brew release updates to python dependencies
1 parent 63c2bd2 commit c1c956d

File tree

6 files changed

+215
-15
lines changed

6 files changed

+215
-15
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,6 @@ jobs:
4141
path: .venv
4242
key: venv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }}
4343

44-
- name: Install Poetry
45-
uses: snok/install-poetry@v1
46-
with:
47-
version: latest
48-
virtualenvs-create: true
49-
virtualenvs-in-project: true
50-
5144
- name: Install dependencies
5245
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
5346
run: poetry install --no-interaction --with dev --no-root
@@ -110,11 +103,6 @@ jobs:
110103
poetry build
111104
shell: bash
112105

113-
- name: Install PyInstaller
114-
run: |
115-
poetry add --group dev pyinstaller
116-
shell: bash
117-
118106
- name: Build standalone executable
119107
run: |
120108
poetry run pyinstaller --onefile --name mdbub-${{ matrix.platform }} src/mdbub/cli.py
@@ -240,6 +228,17 @@ jobs:
240228
env:
241229
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
242230

231+
homebrew-test:
232+
needs: update-homebrew
233+
runs-on: macos-latest
234+
steps:
235+
- name: Install from Homebrew Tap
236+
run: |
237+
brew tap ${{ github.repository_owner }}/homebrew-tap
238+
brew install mdbub
239+
mdbub version
240+
241+
243242
update-chocolatey:
244243
needs: [release, publish-pypi]
245244
runs-on: windows-latest
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Update Python Dependencies for Homebrew
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- 'pyproject.toml'
8+
- 'poetry.lock'
9+
- '.github/workflows/update-python-dependencies.yml'
10+
11+
jobs:
12+
update-python-dependencies:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout tap repository
16+
uses: actions/checkout@v4
17+
with:
18+
repository: ${{ github.repository_owner }}/homebrew-tap
19+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
20+
path: tap-repo
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: "3.11"
26+
27+
- name: Install homebrew-pypi-poet
28+
run: |
29+
pip install homebrew-pypi-poet
30+
31+
- name: Generate Homebrew resource blocks
32+
run: |
33+
poet click markdown markdown-it-py packaging platformdirs prompt-toolkit pyyaml requests rich rich-click ruamel.yaml tomli typer \
34+
> tap-repo/Formula/mdbub_resources.rb
35+
36+
- name: Commit and push changes
37+
run: |
38+
cd tap-repo
39+
git config user.name "github-actions"
40+
git config user.email "actions@github.com"
41+
git add Formula/mdbub_resources.rb
42+
git commit -m "Update Python dependencies for mdbub formula"
43+
git push
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Homebrew Formula Dependency Declaration Plan
2+
3+
## Goal
4+
Update `packaging/homebrew/mdbub.rb` to fully comply with Homebrew Python-for-Formula-Authors guidelines by explicitly declaring all non-stdlib dependencies as `resource` blocks.
5+
6+
## Steps
7+
8+
- [x] Extract all runtime dependencies from `[tool.poetry.dependencies]` in `pyproject.toml`.
9+
- [x] For each dependency (excluding `python` itself):
10+
- [x] Find the latest matching version and PyPI tarball URL.
11+
- [x] Compute or note the need for the correct SHA256 for each resource.
12+
- [x] Add a `resource` block for each dependency in the formula.
13+
- [ ] Update the formula's `url` and `sha256` to match the latest release.
14+
- [ ] Test formula install locally or via CI.
15+
- [ ] Check off after successful install and test.
16+
17+
## Extracted Dependencies
18+
19+
- click
20+
- markdown
21+
- markdown-it-py
22+
- packaging
23+
- platformdirs
24+
- prompt-toolkit
25+
- pyyaml
26+
- requests
27+
- rich
28+
- rich-click
29+
- ruamel-yaml
30+
- tomli
31+
- typer
32+
33+
## Notes
34+
- `python` is already specified as a dependency in the formula.
35+
- For each dependency, use the PyPI sdist (tar.gz) URL and compute the SHA256.
36+
- Homebrew will use these resources to populate the virtualenv at install time.
37+
- After updating, bump the formula version and update the top-level `sha256` for the main tarball.
38+
- Test with `brew install --build-from-source mdbub`.
39+
40+
---
41+
42+
## TODO
43+
- [ ] Add all resource blocks to `packaging/homebrew/mdbub.rb`
44+
- [ ] Update formula version and sha256
45+
- [ ] Test install
46+
- [ ] Remove this plan file after validation

packaging/homebrew/mdbub.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
class Mdbub < Formula
66
desc "Terminal-first interactive mindmap CLI tool"
77
homepage "https://github.com/collabinator/mdbubbles"
8-
url "https://github.com/collabinator/mdbubbles/archive/refs/tags/v0.2.1.tar.gz"
9-
sha256 "REPLACE_WITH_ACTUAL_SHA256"
8+
url "https://github.com/collabinator/mdbubbles/archive/refs/tags/v0.3.0.tar.gz"
9+
sha256 "REPLACE_WITH_ACTUAL_SHA256" # updated automatically by GitHub Actions
1010
license "Apache-2.0"
1111
head "https://github.com/collabinator/mdbubbles.git", branch: "main"
1212

1313
depends_on "python@3.11"
1414

15+
# Python dependencies are dynamically generated by CI and included here
16+
# See .github/workflows/release.yml for the update-python-dependencies job
17+
instance_eval(File.read(File.expand_path("../mdbub_resources.rb", __FILE__)))
18+
1519
def install
1620
virtualenv_install_with_resources
1721
end

poetry.lock

Lines changed: 108 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ toml = "^0.10.2"
5959
ruff = "^0.11.13"
6060
twine = "^5.0.0"
6161
types-toml = "^0.10.8.20240310"
62+
pyinstaller = "^6.14.1"
6263

6364

6465
[tool.black]

0 commit comments

Comments
 (0)