Export VIRTUAL_ENV_PROMPT in activation scripts (#2194)#2606
Export VIRTUAL_ENV_PROMPT in activation scripts (#2194)#2606gaborbernat merged 1 commit intopypa:mainfrom jimporter:2194/export-virtual-env-prompt
VIRTUAL_ENV_PROMPT in activation scripts (#2194)#2606Conversation
gaborbernat
left a comment
There was a problem hiding this comment.
Please add extend the test suite to test for this.
VIRTUAL_ENV_PROMPT in activation scripts (#2914)VIRTUAL_ENV_PROMPT in activation scripts (#2194)
I'll take a look. I'm going to mark this as a draft for now until I get tests resolved (and ideally for my second |
|
@gaborbernat Ok, hopefully these tests pass. I had to make some educated guesses for a few of the shells. |
gaborbernat
left a comment
There was a problem hiding this comment.
You'll need to make the CI pass 😊
Will do. I'm working on fixing them on my fork right now (but in a separate branch to keep the noise of pushing to CI repeatedly down over here). I'll push to this branch once things look green. |
|
@gaborbernat Ok, I think these tests should be good now. One small note is that I renamed |
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [virtualenv](https://togithub.com/pypa/virtualenv) | `==20.23.1` -> `==20.24.1` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>pypa/virtualenv (virtualenv)</summary> ### [`v20.24.1`](https://togithub.com/pypa/virtualenv/releases/tag/20.24.1) [Compare Source](https://togithub.com/pypa/virtualenv/compare/20.24.0...20.24.1) <!-- Release notes generated using configuration in .github/release.yml at 20.24.1 --> ##### What's Changed - release 20.24.0 by [@​gaborbernat](https://togithub.com/gaborbernat) in [https://github.com/pypa/virtualenv/pull/2608](https://togithub.com/pypa/virtualenv/pull/2608) - Upgrade `pip` by [@​arielkirkwood](https://togithub.com/arielkirkwood) in [https://github.com/pypa/virtualenv/pull/2611](https://togithub.com/pypa/virtualenv/pull/2611) ##### New Contributors - [@​arielkirkwood](https://togithub.com/arielkirkwood) made their first contribution in [https://github.com/pypa/virtualenv/pull/2611](https://togithub.com/pypa/virtualenv/pull/2611) **Full Changelog**: pypa/virtualenv@20.24.0...20.24.1 ### [`v20.24.0`](https://togithub.com/pypa/virtualenv/releases/tag/20.24.0) [Compare Source](https://togithub.com/pypa/virtualenv/compare/20.23.1...20.24.0) <!-- Release notes generated using configuration in .github/release.yml at 20.24.0 --> #### What's Changed - release 20.23.1 by [@​gaborbernat](https://togithub.com/gaborbernat) in [https://github.com/pypa/virtualenv/pull/2590](https://togithub.com/pypa/virtualenv/pull/2590) - Fix the CI by [@​gaborbernat](https://togithub.com/gaborbernat) in [https://github.com/pypa/virtualenv/pull/2593](https://togithub.com/pypa/virtualenv/pull/2593) - Quickstart guide by [@​AlvesJorge](https://togithub.com/AlvesJorge) in [https://github.com/pypa/virtualenv/pull/2599](https://togithub.com/pypa/virtualenv/pull/2599) - Updated CLI documentation with config file name by [@​nathanczh](https://togithub.com/nathanczh) in [https://github.com/pypa/virtualenv/pull/2602](https://togithub.com/pypa/virtualenv/pull/2602) - Exclude dependabot and pre-commit ci from release notes by [@​gaborbernat](https://togithub.com/gaborbernat) in [https://github.com/pypa/virtualenv/pull/2603](https://togithub.com/pypa/virtualenv/pull/2603) - Export `VIRTUAL_ENV_PROMPT` in activation scripts ([#​2194](https://togithub.com/pypa/virtualenv/issues/2194)) by [@​jimporter](https://togithub.com/jimporter) in [https://github.com/pypa/virtualenv/pull/2606](https://togithub.com/pypa/virtualenv/pull/2606) - Upgrade setuptools by [@​gaborbernat](https://togithub.com/gaborbernat) in [https://github.com/pypa/virtualenv/pull/2607](https://togithub.com/pypa/virtualenv/pull/2607) #### New Contributors - [@​AlvesJorge](https://togithub.com/AlvesJorge) made their first contribution in [https://github.com/pypa/virtualenv/pull/2599](https://togithub.com/pypa/virtualenv/pull/2599) - [@​nathanczh](https://togithub.com/nathanczh) made their first contribution in [https://github.com/pypa/virtualenv/pull/2602](https://togithub.com/pypa/virtualenv/pull/2602) - [@​jimporter](https://togithub.com/jimporter) made their first contribution in [https://github.com/pypa/virtualenv/pull/2606](https://togithub.com/pypa/virtualenv/pull/2606) **Full Changelog**: pypa/virtualenv@20.23.1...20.24.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "every weekend" in timezone Etc/UTC, Automerge - "before 07:00" in timezone Etc/UTC. 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/canonical/charmcraft). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44LjExIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
And ignore VIRTUAL_ENV_PROMPT variable for now as it is different between venv and virtualenv implementations: * python/cpython#106726 * pypa/virtualenv#2606
The upstream virtualenv started to export VIRTUAL_ENV_PROMPT in 20.24.0 (2023-07-14): pypa/virtualenv#2606


See issue #2194. This change exports a
VIRTUAL_ENV_PROMPTenvironment variable during venv activation so that users can use this in their own custom shell prompts if they like.I didn't add a test for this since I don't see any similar tests, and I'm not quite sure the bet way to go about writing one...I manually tested these changes in Bash and the results look good to me, though my changes for the other shell scripts are speculative. I did my best to guess how they should work, but there may be bugs!
Thanks for contributing, make sure you address all the checklists (for details on how see development documentation)
tox -e fix)docs/changelogfolder