From 465a1faa8a41156d0992af1b02c299a061d47d71 Mon Sep 17 00:00:00 2001 From: Rylan Polster Date: Fri, 31 Jul 2020 21:42:20 -0400 Subject: [PATCH 1/2] docs: add reference to update-python-resources --- docs/Python-for-Formula-Authors.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/Python-for-Formula-Authors.md b/docs/Python-for-Formula-Authors.md index 022f2b827e..04dd8039f0 100644 --- a/docs/Python-for-Formula-Authors.md +++ b/docs/Python-for-Formula-Authors.md @@ -26,7 +26,9 @@ Applications should be installed into a Python [virtualenv](https://virtualenv.p All of the Python module dependencies of the application (and their dependencies, recursively) should be declared as `resource`s in the formula and installed into the virtualenv, as well. Each dependency should be explicitly specified; please do not rely on `setup.py` or `pip` to perform automatic dependency resolution, for the [reasons described here](Acceptable-Formulae.md#we-dont-like-install-scripts-that-download-unversioned-things). -You can use [homebrew-pypi-poet](https://pypi.python.org/pypi/homebrew-pypi-poet) to help you write resource stanzas. To use it, set up a virtualenv and install your package and all its dependencies. Then, `pip install homebrew-pypi-poet` into the same virtualenv. Running `poet some_package` will generate the necessary resource stanzas. You can do this like: +You can use `brew update-python-resources` to help you write resource stanzas. To use it, simply run `brew update-python-resources `. Sometimes, `brew update-python-resources` won't be able to automatically update the resources. If this happens, try running `brew update-python-resources --print-only ` to print the resource stanzas instead of applying the changes directly to the file. You can then copy and paste resources as needed. + +If using `brew update-python-resources` doesn't work, you can use [homebrew-pypi-poet](https://pypi.python.org/pypi/homebrew-pypi-poet) to help you write resource stanzas. To use it, set up a virtualenv and install your package and all its dependencies. Then, `pip install homebrew-pypi-poet` into the same virtualenv. Running `poet some_package` will generate the necessary resource stanzas. You can do this like: ```sh # Install virtualenvwrapper From 9dc21953e81123740a2cb7c47812733bd0e8a49e Mon Sep 17 00:00:00 2001 From: Rylan Polster Date: Sun, 2 Aug 2020 18:17:32 -0400 Subject: [PATCH 2/2] docs: update-python-resources in Formula Cookbook --- docs/Formula-Cookbook.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Formula-Cookbook.md b/docs/Formula-Cookbook.md index 19f38b0a2e..9f383ba98f 100644 --- a/docs/Formula-Cookbook.md +++ b/docs/Formula-Cookbook.md @@ -237,7 +237,7 @@ end [`jrnl`](https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/jrnl.rb) is an example of a formula that does this well. The end result means the user doesn't have to use `pip` or Python and can just run `jrnl`. -[homebrew-pypi-poet](https://github.com/tdsmith/homebrew-pypi-poet) can help you generate [`resource`](https://rubydoc.brew.sh/Formula#resource-class_method) stanzas for the dependencies of your Python application. +For Python formulae, running `brew update-python-resources ` will automatically add the necessary [`resource`](https://rubydoc.brew.sh/Formula#resource-class_method) stanzas for the dependencies of your Python application to the formula. Note that `brew update-python-resources` is run automatically by `brew create` if you pass the `--python` flag. If `brew update-python-resources` is unable to determine the correct `resource` stanzas, [homebrew-pypi-poet](https://github.com/tdsmith/homebrew-pypi-poet) is a good third-party alternative that may help. ### Install the formula