Open tconbeer opened 1 year ago
If it helps, here's a walkthrough using homebrew-pypi-poet
to generate the initial formula
$ python -m venv venv
$ source venv/bin/activate
$ pip install homebrew-pypi-poet
Collecting homebrew-pypi-poet
Downloading homebrew_pypi_poet-0.10.0-py2.py3-none-any.whl (7.8 kB)
...
$ pip install harlequin
Collecting harlequin
Downloading harlequin-1.0.1-py3-none-any.whl (30 kB)
Collecting click<9.0.0,>=8.1.3
Using cached click-8.1.7-py3-none-any.whl (97 kB)
...
$ poet -f harlequin
class Harlequin < Formula
include Language::Python::Virtualenv
desc "Shiny new formula"
homepage "https://harlequin.sh"
url "https://files.pythonhosted.org/packages/61/b0/2efa237f3af0bb17f97fbed47a1b25b751998e3c7618e368832d88f5b981/harlequin-1.0.1.tar.gz"
sha256 "52e04c7660a1db506b42f7f414b26942e0b5e0ad215ff7e3fb662a5d9d14ed25"
depends_on "python3"
resource "click" do
url "https://files.pythonhosted.org/packages/96/d3/f04c7bfcf5c1862a2a5b845c6b2b360488cf47af55dfa79c98f6a6bf98b5/click-8.1.7.tar.gz"
sha256 "ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"
end
resource "duckdb" do
url "https://files.pythonhosted.org/packages/c6/6a/ddb7a1906d12a08095632f51d9b5a965ba3ff760cb4b3e52eec7907e4166/duckdb-0.9.0.tar.gz"
sha256 "3a52c975cc13b965580cd00af1538b2d9f6b896431f97121dbee7ce715edcd2a"
end
resource "importlib-metadata" do
url "https://files.pythonhosted.org/packages/33/44/ae06b446b8d8263d712a211e959212083a5eda2bf36d57ca7415e03f6f36/importlib_metadata-6.8.0.tar.gz"
sha256 "dbace7892d8c0c4ac1ad096662232f831d4e64f4c4545bd53016a3e9d4654743"
end
resource "linkify-it-py" do
url "https://files.pythonhosted.org/packages/8d/fd/73bb30ec2b3cd952fe139a79a40ce5f5fd0280dd2cc1de94c93ea6a714d2/linkify-it-py-2.0.2.tar.gz"
sha256 "19f3060727842c254c808e99d465c80c49d2c7306788140987a1a7a29b0d6ad2"
end
resource "markdown-it-py" do
url "https://files.pythonhosted.org/packages/38/71/3b932df36c1a044d397a1f92d1cf91ee0a503d91e470cbd670aa66b07ed0/markdown-it-py-3.0.0.tar.gz"
sha256 "e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"
end
resource "mdit-py-plugins" do
url "https://files.pythonhosted.org/packages/b4/db/61960d68d5c39ff0dd48cb799a39ae4e297f6e9b96bf2f8da29d897fba0c/mdit_py_plugins-0.4.0.tar.gz"
sha256 "d8ab27e9aed6c38aa716819fedfde15ca275715955f8a185a8e1cf90fb1d2c1b"
end
resource "mdurl" do
url "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz"
sha256 "bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"
end
resource "platformdirs" do
url "https://files.pythonhosted.org/packages/dc/99/c922839819f5d00d78b3a1057b5ceee3123c69b2216e776ddcb5a4c265ff/platformdirs-3.10.0.tar.gz"
sha256 "b45696dab2d7cc691a3226759c0d3b00c47c8b6e293d96f6436f733303f77f6d"
end
resource "Pygments" do
url "https://files.pythonhosted.org/packages/d6/f7/4d461ddf9c2bcd6a4d7b2b139267ca32a69439387cc1f02a924ff8883825/Pygments-2.16.1.tar.gz"
sha256 "1daff0494820c69bc8941e407aa20f577374ee88364ee10a98fdbe0aece96e29"
end
resource "pyperclip" do
url "https://files.pythonhosted.org/packages/a7/2c/4c64579f847bd5d539803c8b909e54ba087a79d01bb3aba433a95879a6c5/pyperclip-1.8.2.tar.gz"
sha256 "105254a8b04934f0bc84e9c24eb360a591aaf6535c9def5f29d92af107a9bf57"
end
resource "rich" do
url "https://files.pythonhosted.org/packages/1d/d6/9773d48804d085962c4f522db96f6a9ea9bd2e0480b3959a929176d92f01/rich-13.5.3.tar.gz"
sha256 "87b43e0543149efa1253f485cd845bb7ee54df16c9617b8a893650ab84b4acb6"
end
resource "shandy-sqlfmt" do
url "https://files.pythonhosted.org/packages/f7/3c/dde713acca6998ce640e1c9967df1214a1c22a49dadb0160e8647b551191/shandy_sqlfmt-0.20.0.tar.gz"
sha256 "2c6a8a39b03b1dac761239a08e66fbde849eed739528c2e80aeebf5164b45f6b"
end
resource "textual" do
url "https://files.pythonhosted.org/packages/73/80/18a9ab265078a1b5618e3cc0090c622b0bf6f5f7655b02f69fef16c4f957/textual-0.36.0.tar.gz"
sha256 "fbfc799a55938cfade6cfbf7c5ae3c3e5fc87ff9deaaed788a6dcefe72245451"
end
resource "textual-textarea" do
url "https://files.pythonhosted.org/packages/e1/8f/167bcc2c864794f06c1525b004174767f1906aedfc26131aa12b654a2616/textual_textarea-0.7.0.tar.gz"
sha256 "4dec274e7cd94eaa55ee2f6bab3ed166089ea24fdaeefb8ef6f51a86f614bb79"
end
resource "tomli" do
url "https://files.pythonhosted.org/packages/c0/3f/d7af728f075fb08564c5949a9c95e44352e23dee646869fa104a3b2060a3/tomli-2.0.1.tar.gz"
sha256 "de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"
end
resource "tqdm" do
url "https://files.pythonhosted.org/packages/62/06/d5604a70d160f6a6ca5fd2ba25597c24abd5c5ca5f437263d177ac242308/tqdm-4.66.1.tar.gz"
sha256 "d88e651f9db8d8551a62556d3cff9e3034274ca5d66e93197cf2490e2dcb69c7"
end
resource "typing-extensions" do
url "https://files.pythonhosted.org/packages/1f/7a/8b94bb016069caa12fc9f587b28080ac33b4fbb8ca369b98bc0a4828543e/typing_extensions-4.8.0.tar.gz"
sha256 "df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef"
end
resource "uc-micro-py" do
url "https://files.pythonhosted.org/packages/75/db/241444fe6df6970a4c18d227193cad77fab7cec55d98e296099147de017f/uc-micro-py-1.0.2.tar.gz"
sha256 "30ae2ac9c49f39ac6dce743bd187fcd2b574b16ca095fa74cd9396795c954c54"
end
resource "zipp" do
url "https://files.pythonhosted.org/packages/58/03/dd5ccf4e06dec9537ecba8fcc67bbd4ea48a2791773e469e73f94c3ba9a6/zipp-3.17.0.tar.gz"
sha256 "84e64a1c28cf7e91ed2078bb8cc8c259cb19b76942096c8d7b84947690cabaf0"
end
def install
virtualenv_create(libexec, "python3")
virtualenv_install_with_resources
end
test do
false
end
end
I don't think I'll be doing this any time soon.
The main problem is that, unless the formula is in homebrew-core, the package has to be built entirely from source. Currently that includes compiling DuckDB from source, which takes forever (numpy also takes a few minutes, but DuckDB is like an hour on my machine).
The second problem is that Textual has a dependency that doesn't have an sdist
. I think we can just remove that from the formula, but further testing is required, and I don't want to spend the time compiling DuckDB to figure this out.
Fair enough!
I am familiar with homebrew via homebrew-bio but haven't gone through the effort for a python package like this before.
Simon has a great tutorial here: https://til.simonwillison.net/homebrew/packaging-python-cli-for-homebrew and also here: https://til.simonwillison.net/homebrew/auto-formulas-github-actions