Title: Better interoperability with pipenv · Issue #114 · python-virtualenvwrapper/virtualenvwrapper · GitHub
Open Graph Title: Better interoperability with pipenv · Issue #114 · python-virtualenvwrapper/virtualenvwrapper
X Title: Better interoperability with pipenv · Issue #114 · python-virtualenvwrapper/virtualenvwrapper
Description: Problem pipenv is a very popular manager for virtual environments and respects WORKON_HOME through pev, but environments created by pipenv end in a hash that causes it to be a little inconvenient to use virtualenvwrapper with pipenv. Pro...
Open Graph Description: Problem pipenv is a very popular manager for virtual environments and respects WORKON_HOME through pev, but environments created by pipenv end in a hash that causes it to be a little inconvenient t...
X Description: Problem pipenv is a very popular manager for virtual environments and respects WORKON_HOME through pev, but environments created by pipenv end in a hash that causes it to be a little inconvenient t...
Opengraph URL: https://github.com/python-virtualenvwrapper/virtualenvwrapper/issues/114
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Better interoperability with pipenv","articleBody":"## Problem\r\n\r\n`pipenv` is a very popular manager for virtual environments and respects `WORKON_HOME` through `pev`, but environments created by `pipenv` end in a hash that causes it to be a little inconvenient to use `virtualenvwrapper` with `pipenv.`\r\n\r\n## Proposed Solution\r\n\r\n`workon` should have an argument to determine the virtualenv directory from the current directory path, using the same logic as `pipenv`. I think it should be something like `workon --pipenv`.\r\n\r\n## Workaround\r\n\r\nIt isn't that hard if you already can write shell functions and import them when you launch your shell. My current one looks like this:\r\n\r\n```shell\r\nfunction workonenv () \r\n{ \r\n if [[ $# -ne 0 ]]; then\r\n echo \"Usage: $0\" 1\u003e\u00262;\r\n return 1;\r\n else\r\n if [[ ! -f \"./Pipfile\" ]]; then\r\n echo \"./Pipfile: file not found\" 1\u003e\u00262;\r\n return 1;\r\n else\r\n if [[ -n \"$VIRTUAL_ENV\" ]]; then\r\n echo \"do not use this command from within a virtualenv\" 1\u003e\u00262;\r\n return 1;\r\n fi;\r\n fi;\r\n fi;\r\n ENV_NAME=$(python -c \"from pipenv.project import Project; print(Project('.').virtualenv_name)\");\r\n HAVE_WORKON=$(type workon | head -1);\r\n if [[ \"$HAVE_WORKON\" != \"workon is a function\" ]]; then\r\n echo \"virtualenvwrapper may not be active\" 1\u003e\u00262;\r\n return 1;\r\n fi;\r\n workon $ENV_NAME\r\n}\r\n```\r\n\r\n## Downsides with Workaround\r\n\r\nThe workaround isn't perfect. Because it isn't part of virtualenvwrapper, it is harder to carry it with me. It also doesn't recognize that this is different from a normal argument to workon:\r\n\r\n```shell\r\n$ workonenv \r\nERROR: Environment 'scrapeboa-L7gq2F0U' does not exist. Create it with 'mkvirtualenv scrapeboa-L7gq2F0U'.\r\n$ pipenv sync -d\r\n...\r\n$ workonenv\r\n(scrapeboa) $ \r\n```","author":{"url":"https://github.com/danizen","@type":"Person","name":"danizen"},"datePublished":"2024-11-20T03:11:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/114/virtualenvwrapper/issues/114"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6dd6e823-355d-174d-f704-c0b6bdc3dd74 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CE40:2E3F95:1390614:1B0EB95:696A943B |
| html-safe-nonce | d4dc82b97e59759c4290e41801867b69144f13b8068562d432082b1606d0fe5c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTQwOjJFM0Y5NToxMzkwNjE0OjFCMEVCOTU6Njk2QTk0M0IiLCJ2aXNpdG9yX2lkIjoiMjc3ODcwMjM4MzIzNzczMTM4NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1c1530ade0bfe88f4cc1d5642243b4cd486c5c349567daddaea9baa4053cef4b |
| hovercard-subject-tag | issue:2674200129 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-virtualenvwrapper/virtualenvwrapper/114/issue_layout |
| twitter:image | https://opengraph.githubassets.com/23e035b44bae7cb0f46d0cb32a0067e3c51634175712c12b4bc62b7c97fe1db1/python-virtualenvwrapper/virtualenvwrapper/issues/114 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/23e035b44bae7cb0f46d0cb32a0067e3c51634175712c12b4bc62b7c97fe1db1/python-virtualenvwrapper/virtualenvwrapper/issues/114 |
| og:image:alt | Problem pipenv is a very popular manager for virtual environments and respects WORKON_HOME through pev, but environments created by pipenv end in a hash that causes it to be a little inconvenient t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | danizen |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4dd496afc954da9c207b2d9fbe86e3074619f565754aa1d9274aec30d9e5b8d7 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-virtualenvwrapper/virtualenvwrapper git https://github.com/python-virtualenvwrapper/virtualenvwrapper.git |
| octolytics-dimension-user_id | 122572748 |
| octolytics-dimension-user_login | python-virtualenvwrapper |
| octolytics-dimension-repository_id | 589228542 |
| octolytics-dimension-repository_nwo | python-virtualenvwrapper/virtualenvwrapper |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 589228542 |
| octolytics-dimension-repository_network_root_nwo | python-virtualenvwrapper/virtualenvwrapper |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 31496a13b80a2f6ad77d6c617ee2255a3545b539 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width