diff --git a/docs/Python-for-Formula-Authors.md b/docs/Python-for-Formula-Authors.md index 04dd8039f0..4fded0d11a 100644 --- a/docs/Python-for-Formula-Authors.md +++ b/docs/Python-for-Formula-Authors.md @@ -31,20 +31,20 @@ You can use `brew update-python-resources` to help you write resource stanzas. T 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 -brew install python -python3 -m pip install virtualenvwrapper -source $(brew --prefix)/bin/virtualenvwrapper.sh +# Use a temporary directory for the virtual environment +cd "$(mktemp -d)" -# Set up a temporary virtual environment -mktmpenv +# Create and source a new virtual environment in the venv/ directory +python3 -m venv venv +source venv/bin/activate # Install the package of interest as well as homebrew-pypi-poet -pip3 install some_package homebrew-pypi-poet +pip install some_package homebrew-pypi-poet poet some_package -# Destroy the temporary virtualenv you just created +# Destroy the virtual environment deactivate +rm -rf venv ``` Homebrew provides helper methods for instantiating and populating virtualenvs. You can use them by putting `include Language::Python::Virtualenv` at the top of the `Formula` class definition.