Skip to content

How to make a postmkvirtualenv hook #195

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

Closed
ejmg opened this issue Dec 27, 2016 · 3 comments
Closed

How to make a postmkvirtualenv hook #195

ejmg opened this issue Dec 27, 2016 · 3 comments

Comments

@ejmg
Copy link

ejmg commented Dec 27, 2016

Hi there and thanks for such a great dev tool!

This is a question similar to the one asked earlier, here, but involves making a hook that executes once and only once after the creation of a new virtualenv.

Ideally, I would like to make a hook that automatically installs four packages in each new virtualenv I make via pyenv. The parallel function in virtualenvwrapper is postmkvirtualenv, and a user has used it for exactly this behavior as shown in virtualenvwrapper's docs.

I use these packages universally, irrespective of which python version I work on, and so this would save me a simple keystroke. These packages are jedi, flake8, importmagic, and autopep8.

I noticed that there was a hook function built in pyenv but haven't been able to find much documentation on how to make (what I believe to be) this simple hook. I'd appreciate any help!

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/40433934-how-to-make-a-postmkvirtualenv-hook?utm_campaign=plugin&utm_content=tracker%2F335155&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F335155&utm_medium=issues&utm_source=github).
@ejmg ejmg closed this as completed Oct 27, 2017
@jjlorenzo
Copy link

did you find a solution for this?

@ejmg
Copy link
Author

ejmg commented Dec 17, 2017 via email

@lbillinghamwrk
Copy link

Think I may have seen the solution to this over on SO https://stackoverflow.com/a/54627516
Hope you don't mind me leaving it as a comment here as this issue is always the 1st place I end up when searching for how to do postmkvirtualenv-ish stuff with pyenv-virtualenv

~/.pyenv/pyenv.d/virtualenvafter.bash

upgrade_packages() {
  PYENV_VERSION=$VIRTUALENV_NAME pyenv-exec pip install --upgrade pip setuptools wheel
}

after_virtualenv 'upgrade_packages'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants