Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more reliable method to run homebrew-pypi-poet #9391

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions docs/Python-for-Formula-Authors.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,19 @@ 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
# Dependency manager that supports virtual environments
brew reinstall pipenv

# Set up a temporary virtual environment
mktmpenv
# Use a temporary directory for the virtual environment
cd "$(mktemp -d)"

# Install the package of interest as well as homebrew-pypi-poet
pip3 install some_package homebrew-pypi-poet
poet some_package
# This will also set up a temporary virtual environment
pipenv install some_package homebrew-pypi-poet
pipenv run poet some_package

# Destroy the temporary virtualenv you just created
deactivate
pipenv --rm
```

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.
Expand Down