Skip to content

Commit c489e84

Browse files
committed
aaaarrggghh neverending vibes to fix github actions...still.
1 parent 7d12307 commit c489e84

File tree

4 files changed

+262
-5
lines changed

4 files changed

+262
-5
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,19 +242,20 @@ jobs:
242242
with:
243243
python-version: "3.11"
244244

245-
- name: Install poet-poetry
246-
run: |
247-
pip install poet-poetry
248245

249246
- name: Install Poetry
250247
uses: snok/install-poetry@v1
251248
with:
252249
version: latest
253250

251+
- name: Export requirements from poetry.lock
252+
run: poetry export --without-hashes -f requirements.txt -o requirements.txt
253+
working-directory: ${{ github.workspace }}/mdbubbles
254+
254255
- name: Generate Homebrew resource blocks
255256
run: |
256-
poetry lock
257-
poet-poetry mdbub > ../tap-repo/Formula/mdbub_resources.rb
257+
pip install requests
258+
python scripts/make_resources.py --file requirements.txt --output ../tap-repo/Formula/mdbub_resources.rb
258259
working-directory: ${{ github.workspace }}/mdbubbles
259260

260261
- name: Commit and push Homebrew resource updates
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
resource "certifi" do
2+
url "https://files.pythonhosted.org/packages/84/ae/320161bd181fc06471eed047ecce67b693fd7515b16d495d8932db763426/certifi-2025.6.15-py3-none-any.whl"
3+
sha256 "2e0c7ce7cb5d8f8634ca55d2ba7e6ec2689a2fd6537d8dec1296a477a4910057"
4+
end
5+
6+
resource "charset-normalizer" do
7+
url "https://files.pythonhosted.org/packages/95/28/9901804da60055b406e1a1c5ba7aac1276fb77f1dde635aabfc7fd84b8ab/charset_normalizer-3.4.2-cp310-cp310-macosx_10_9_universal2.whl"
8+
sha256 "7c48ed483eb946e6c04ccbe02c6b4d1d48e51944b6db70f697e089c193404941"
9+
end
10+
11+
resource "click" do
12+
url "https://files.pythonhosted.org/packages/7e/d4/7ebdbd03970677812aac39c869717059dbb71a4cfc033ca6e5221787892c/click-8.1.8-py3-none-any.whl"
13+
sha256 "63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2"
14+
end
15+
16+
resource "colorama" do
17+
url "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl"
18+
sha256 "4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"
19+
end
20+
21+
resource "idna" do
22+
url "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl"
23+
sha256 "946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"
24+
end
25+
26+
resource "importlib-metadata" do
27+
url "https://files.pythonhosted.org/packages/20/b0/36bd937216ec521246249be3bf9855081de4c5e06a0c9b4219dbeda50373/importlib_metadata-8.7.0-py3-none-any.whl"
28+
sha256 "e5dd1551894c77868a30651cef00984d50e1002d06942a7101d34870c5f02afd"
29+
end
30+
31+
resource "markdown-it-py" do
32+
url "https://files.pythonhosted.org/packages/42/d7/1ec15b46af6af88f19b8e5ffea08fa375d433c998b8a7639e76935c14f1f/markdown_it_py-3.0.0-py3-none-any.whl"
33+
sha256 "355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"
34+
end
35+
36+
resource "markdown" do
37+
url "https://files.pythonhosted.org/packages/96/2b/34cc11786bc00d0f04d0f5fdc3a2b1ae0b6239eef72d3d345805f9ad92a1/markdown-3.8.2-py3-none-any.whl"
38+
sha256 "5c83764dbd4e00bdd94d85a19b8d55ccca20fe35b2e678a1422b380324dd5f24"
39+
end
40+
41+
resource "mdurl" do
42+
url "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl"
43+
sha256 "84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"
44+
end
45+
46+
resource "packaging" do
47+
url "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl"
48+
sha256 "29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"
49+
end
50+
51+
resource "platformdirs" do
52+
url "https://files.pythonhosted.org/packages/fe/39/979e8e21520d4e47a0bbe349e2713c0aac6f3d853d0e5b34d76206c439aa/platformdirs-4.3.8-py3-none-any.whl"
53+
sha256 "ff7059bb7eb1179e2685604f4aaf157cfd9535242bd23742eadc3c13542139b4"
54+
end
55+
56+
resource "prompt-toolkit" do
57+
url "https://files.pythonhosted.org/packages/ce/4f/5249960887b1fbe561d9ff265496d170b55a735b76724f10ef19f9e40716/prompt_toolkit-3.0.51-py3-none-any.whl"
58+
sha256 "52742911fde84e2d423e2f9a4cf1de7d7ac4e51958f648d9540e0fb8db077b07"
59+
end
60+
61+
resource "pygments" do
62+
url "https://files.pythonhosted.org/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl"
63+
sha256 "86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b"
64+
end
65+
66+
resource "pyyaml" do
67+
url "https://files.pythonhosted.org/packages/9b/95/a3fac87cb7158e231b5a6012e438c647e1a87f09f8e0d123acec8ab8bf71/PyYAML-6.0.2-cp310-cp310-macosx_10_9_x86_64.whl"
68+
sha256 "0a9a2848a5b7feac301353437eb7d5957887edbf81d56e903999a75a3d743086"
69+
end
70+
71+
resource "requests" do
72+
url "https://files.pythonhosted.org/packages/7c/e4/56027c4a6b4ae70ca9de302488c5ca95ad4a39e190093d6c1a8ace08341b/requests-2.32.4-py3-none-any.whl"
73+
sha256 "27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c"
74+
end
75+
76+
resource "rich-click" do
77+
url "https://files.pythonhosted.org/packages/b6/c2/9fce4c8a9587c4e90500114d742fe8ef0fd92d7bad29d136bb9941add271/rich_click-1.8.9-py3-none-any.whl"
78+
sha256 "c3fa81ed8a671a10de65a9e20abf642cfdac6fdb882db1ef465ee33919fbcfe2"
79+
end
80+
81+
resource "rich" do
82+
url "https://files.pythonhosted.org/packages/0d/9b/63f4c7ebc259242c89b3acafdb37b41d1185c07ff0011164674e9076b491/rich-14.0.0-py3-none-any.whl"
83+
sha256 "1c9491e1951aac09caffd42f448ee3d04e58923ffe14993f6e83068dc395d7e0"
84+
end
85+
86+
resource "ruamel-yaml-clib" do
87+
url "https://files.pythonhosted.org/packages/70/57/40a958e863e299f0c74ef32a3bde9f2d1ea8d69669368c0c502a0997f57f/ruamel.yaml.clib-0.2.12-cp310-cp310-macosx_13_0_arm64.whl"
88+
sha256 "11f891336688faf5156a36293a9c362bdc7c88f03a8a027c2c1d8e0bcde998e5"
89+
end
90+
91+
resource "ruamel-yaml" do
92+
url "https://files.pythonhosted.org/packages/af/6d/6fe4805235e193aad4aaf979160dd1f3c487c57d48b810c816e6e842171b/ruamel.yaml-0.18.14-py3-none-any.whl"
93+
sha256 "710ff198bb53da66718c7db27eec4fbcc9aa6ca7204e4c1df2f282b6fe5eb6b2"
94+
end
95+
96+
resource "shellingham" do
97+
url "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl"
98+
sha256 "7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686"
99+
end
100+
101+
resource "tomli" do
102+
url "https://files.pythonhosted.org/packages/43/ca/75707e6efa2b37c77dadb324ae7d9571cb424e61ea73fad7c56c2d14527f/tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl"
103+
sha256 "678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"
104+
end
105+
106+
resource "typer" do
107+
url "https://files.pythonhosted.org/packages/c9/62/d4ba7afe2096d5659ec3db8b15d8665bdcb92a3c6ff0b95e99895b335a9c/typer-0.15.4-py3-none-any.whl"
108+
sha256 "eb0651654dcdea706780c466cf06d8f174405a659ffff8f163cfbfee98c0e173"
109+
end
110+
111+
resource "typing-extensions" do
112+
url "https://files.pythonhosted.org/packages/69/e0/552843e0d356fbb5256d21449fa957fa4eff3bbc135a74a691ee70c7c5da/typing_extensions-4.14.0-py3-none-any.whl"
113+
sha256 "a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af"
114+
end
115+
116+
resource "urllib3" do
117+
url "https://files.pythonhosted.org/packages/a7/c2/fe1e52489ae3122415c51f387e221dd0773709bad6c6cdaa599e8a2c5185/urllib3-2.5.0-py3-none-any.whl"
118+
sha256 "e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc"
119+
end
120+
121+
resource "wcwidth" do
122+
url "https://files.pythonhosted.org/packages/fd/84/fd2ba7aafacbad3c4201d395674fc6348826569da3c0937e75505ead3528/wcwidth-0.2.13-py2.py3-none-any.whl"
123+
sha256 "3da69048e4540d84af32131829ff948f1e022c1c6bdb8d6102117aac784f6859"
124+
end
125+
126+
resource "zipp" do
127+
url "https://files.pythonhosted.org/packages/2e/54/647ade08bf0db230bfea292f893923872fd20be6ac6f53b2b936ba839d75/zipp-3.23.0-py3-none-any.whl"
128+
sha256 "071652d6115ed432f5ce1d34c336c0adfd6a884660d1e9712a256d3d3bd4b14e"
129+
end

requirements.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
certifi==2025.6.15 ; python_version >= "3.9" and python_version < "3.14"
2+
charset-normalizer==3.4.2 ; python_version >= "3.9" and python_version < "3.14"
3+
click==8.1.8 ; python_version >= "3.9" and python_version < "3.14"
4+
colorama==0.4.6 ; python_version >= "3.9" and python_version < "3.14" and platform_system == "Windows"
5+
idna==3.10 ; python_version >= "3.9" and python_version < "3.14"
6+
importlib-metadata==8.7.0 ; python_version >= "3.9" and python_version < "3.10"
7+
markdown-it-py==3.0.0 ; python_version >= "3.9" and python_version < "3.14"
8+
markdown==3.8.2 ; python_version >= "3.9" and python_version < "3.14"
9+
mdurl==0.1.2 ; python_version >= "3.9" and python_version < "3.14"
10+
packaging==25.0 ; python_version >= "3.9" and python_version < "3.14"
11+
platformdirs==4.3.8 ; python_version >= "3.9" and python_version < "3.14"
12+
prompt-toolkit==3.0.51 ; python_version >= "3.9" and python_version < "3.14"
13+
pygments==2.19.2 ; python_version >= "3.9" and python_version < "3.14"
14+
pyyaml==6.0.2 ; python_version >= "3.9" and python_version < "3.14"
15+
requests==2.32.4 ; python_version >= "3.9" and python_version < "3.14"
16+
rich-click==1.8.9 ; python_version >= "3.9" and python_version < "3.14"
17+
rich==14.0.0 ; python_version >= "3.9" and python_version < "3.14"
18+
ruamel-yaml-clib==0.2.12 ; platform_python_implementation == "CPython" and python_version < "3.14" and python_version >= "3.9"
19+
ruamel-yaml==0.18.14 ; python_version >= "3.9" and python_version < "3.14"
20+
shellingham==1.5.4 ; python_version >= "3.9" and python_version < "3.14"
21+
tomli==2.2.1 ; python_version >= "3.9" and python_version < "3.14"
22+
typer==0.15.4 ; python_version >= "3.9" and python_version < "3.14"
23+
typing-extensions==4.14.0 ; python_version >= "3.9" and python_version < "3.14"
24+
urllib3==2.5.0 ; python_version >= "3.9" and python_version < "3.14"
25+
wcwidth==0.2.13 ; python_version >= "3.9" and python_version < "3.14"
26+
zipp==3.23.0 ; python_version >= "3.9" and python_version < "3.10"

scripts/make_resources.py

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/usr/bin/env python3
2+
"""
3+
make_resources.py: Generate Homebrew resource blocks from requirements.txt
4+
5+
Usage:
6+
python make_resources.py --file requirements.txt --output mdbub_resources.rb
7+
"""
8+
import argparse
9+
from pathlib import Path
10+
11+
import requests
12+
13+
14+
def parse_args() -> argparse.Namespace:
15+
parser = argparse.ArgumentParser(
16+
description="Generate Homebrew resource blocks from requirements.txt"
17+
)
18+
parser.add_argument(
19+
"--file", type=str, default="requirements.txt", help="Path to requirements.txt"
20+
)
21+
parser.add_argument(
22+
"--output",
23+
type=str,
24+
default="mdbub_resources.rb",
25+
help="Output Ruby file for Homebrew resources",
26+
)
27+
return parser.parse_args()
28+
29+
30+
def main() -> None:
31+
args = parse_args()
32+
req_file = Path(args.file)
33+
output_file = Path(args.output)
34+
pypi_base_url = "https://pypi.org/pypi"
35+
seen = set()
36+
resource_blocks = []
37+
if not req_file.exists():
38+
print(f"[ERROR] requirements.txt not found: {req_file}")
39+
return
40+
with req_file.open("r", encoding="utf-8") as f:
41+
for line in f:
42+
line = line.strip()
43+
if line.startswith("-e") or line.startswith("#") or not line:
44+
continue
45+
if ";" in line:
46+
pkg_spec, _ = line.split(";", 1)
47+
else:
48+
pkg_spec = line
49+
try:
50+
pkg_name, pkg_version = pkg_spec.split("==")
51+
except ValueError:
52+
print(f"[WARN] Skipping invalid line: {line}")
53+
continue
54+
# Ignore package extras
55+
if "[" in pkg_name:
56+
pkg_name = pkg_name.split("[")[0]
57+
if pkg_name in seen:
58+
continue
59+
seen.add(pkg_name)
60+
# Get PyPI info
61+
pkg_info_url = f"{pypi_base_url}/{pkg_name}/{pkg_version}/json"
62+
try:
63+
resp = requests.get(pkg_info_url, timeout=10)
64+
resp.raise_for_status()
65+
pkg_info = resp.json()
66+
except Exception as e:
67+
print(f"[WARN] Failed to fetch {pkg_name}=={pkg_version}: {e}")
68+
continue
69+
# Prefer wheels, fallback to sdist
70+
selected_url = None
71+
sha256 = None
72+
for url_info in pkg_info.get("urls", []):
73+
if url_info["filename"].endswith(".whl"):
74+
selected_url = url_info["url"]
75+
sha256 = url_info["digests"]["sha256"]
76+
break
77+
if not selected_url:
78+
for url_info in pkg_info.get("urls", []):
79+
if url_info["filename"].endswith(".tar.gz"):
80+
selected_url = url_info["url"]
81+
sha256 = url_info["digests"]["sha256"]
82+
break
83+
if not selected_url or not sha256:
84+
print(
85+
f"[WARN] No suitable distribution found for {pkg_name}=={pkg_version}"
86+
)
87+
continue
88+
resource_block = (
89+
f'resource "{pkg_name}" do\n'
90+
f' url "{selected_url}"\n'
91+
f' sha256 "{sha256}"\n'
92+
f"end\n\n"
93+
)
94+
resource_blocks.append(resource_block)
95+
with output_file.open("w", encoding="utf-8") as outfh:
96+
outfh.writelines(resource_blocks)
97+
print(f"[INFO] {len(resource_blocks)} resources written to {output_file}")
98+
99+
100+
if __name__ == "__main__":
101+
main()

0 commit comments

Comments
 (0)