Package: poetry-homebrew-formula
poetry-homebrew-formula — Poetry Plugin for Homebrew FormulaeA plugin forPoetrythat renders the dependencies of a given python project into aHomebrewformula.This project was inspired bypoetry-brewthat aims to solve the same problem but with a different approach.SetupIf you installed poetry viapipx(preferred):pipxinjectpoetrypoetry-homebrew-formulaIf you installed poetry a different way, most likely this will work, too:poetryselfaddpoetry-homebrew-formulaPlease consult thepoetry docs on using pluginsfor more details.UsageRunpoetry homebrew-formula --helpfor details on how to use it:Custom templatesThe plugin allows for the use of customJinja-based templatesto be used when rendering the formula. This is particularly useful for software that requires more a elaborate "packaging recipe" than what thedefault templatecan offer. In custom templates, some common components are offered as "shortcode" template tags:{{ PACKAGE_URL }}: will be replaced with the project own source URL and checksum.{{ RESOURCES }}: will be replaced with the project's dependencies.With that in mind, the following uses become possible:Prepopulated formulaIf you want to define the entire formula yourself and populate only the dynamic components via poetry-homebrew-formula, you may use both shortcodes like so:class MySoftwareProject < Formulainclude Language::Python::Virtualenvdesc "This is a software project that has its formula prepopulated with most details"homepage "https://mysoftwareproject.invalid"license "MIT{{PACKAGE_URL}}depends_on "python3"depends_on "rust" => >:build{{RESOURCES}}def installvirtualenv_create(libexec, "python3")virtualenv_install_with_resourcesdoing_something_heregenerate_completions_from_executable(bin/"my-software", shells: [:bash, :zsh, :fish], shell_parameter_format: :click)endtest dofalseendendRendered example formulaclassMySoftwareProject<FormulaincludeLanguage::Python::Virtualenvdesc"This is a software project that has its formula prepopulated with most details"homepage"https://mysoftwareproject.invalid"license"MITurl "https://files.pythonhosted.org/packages/cd/28/fa4281532b4eeb28ba5ead093d24d553ee93861df0f743cad37e01ed6bc6/mysoftwareproject-0.1.0a1.tar.gz"sha256 "7158b7e86e9b1399a7aae6a169fd8a4716636284b74870a352f268f852098e2c"depends_on "python3"depends_on "rust" => >:buildresource "click" dourl "https://files.pythonhosted.org/packages/96/d3/f04c7bfcf5c1862a2a5b845c6b2b360488cf47af55dfa79c98f6a6bf98b5/click-8.1.7.tar.gz"sha256 "ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"endresource "pydantic" dourl "https://files.pythonhosted.org/packages/aa/3f/56142232152145ecbee663d70a19a45d078180633321efb3847d2562b490/pydantic-2.5.3.tar.gz"sha256 "b3ef57c62535b0941697cce638c08900d87fcb67e29cfa99e8a68f747f393f7a"endresource "pydantic-core" dourl "https://files.pythonhosted.org/packages/b2/7d/8304d8471cfe4288f95a3065ebda56f9790d087edc356ad5bd83c89e2d79/pydantic_core-2.14.6.tar.gz"sha256 "1fd0c1d395372843fba13a51c28e3bb9d59bd7aebfeb17358ffaaa1e4dbbe948"enddef installvirtualenv_create(libexec, "python3")virtualenv_install_with_resourcesdoing_something_heregenerate_completions_from_executable(bin/"fancy-software", shells: [:bash, :zsh, :fish], shell_parameter_format: :click)endtest dofalseendendResources onlyIf you have other plans and only need the resources to be rendered, your template can also look like this:{{RESOURCES}}This is effectively replicating the behavior ofhomebrew-pypi-poetin that it only emits the dependency resources:Rendered exampleresource"click"dourl"https://files.pythonhosted.org/packages/96/d3/f04c7bfcf5c1862a2a5b845c6b2b360488cf47af55dfa79c98f6a6bf98b5/click-8.1.7.tar.gz"sha256"ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"endresource"pydantic"dourl"https://files.pythonhosted.org/packages/aa/3f/56142232152145ecbee663d70a19a45d078180633321efb3847d2562b490/pydantic-2.5.3.tar.gz"sha256"b3ef57c62535b0941697cce638c08900d87fcb67e29cfa99e8a68f747f393f7a"endresource"pydantic-core"dourl"https://files.pythonhosted.org/packages/b2/7d/8304d8471cfe4288f95a3065ebda56f9790d087edc356ad5bd83c89e2d79/pydantic_core-2.14.6.tar.gz"sha256"1fd0c1d395372843fba13a51c28e3bb9d59bd7aebfeb17358ffaaa1e4dbbe948"endTemplates fromstdinThe plugin supports template definitions via stdin, as well as emitting them to stdout by using-as the option argument:$echo'{{RESOURCES}}'|poetryhomebrew-formula-t--o-|teemy-formula.rb

resource"click"dourl"https://files.pythonhosted.org/packages/96/d3/f04c7bfcf5c1862a2a5b845c6b2b360488cf47af55dfa79c98f6a6bf98b5/click-8.1.7.tar.gz"sha256"ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"end

resource"pydantic"do…