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

Export VIRTUAL_ENV_PROMPT in activation scripts (#2194) #2606

Merged
merged 1 commit into from
Jul 14, 2023
Merged

Export VIRTUAL_ENV_PROMPT in activation scripts (#2194) #2606

merged 1 commit into from
Jul 14, 2023

Conversation

jimporter
Copy link
Contributor

@jimporter jimporter commented Jul 13, 2023

See issue #2194. This change exports a VIRTUAL_ENV_PROMPT environment 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)

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation

Copy link
Contributor

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add extend the test suite to test for this.

@jimporter jimporter changed the title Export VIRTUAL_ENV_PROMPT in activation scripts (#2914) Export VIRTUAL_ENV_PROMPT in activation scripts (#2194) Jul 13, 2023
@jimporter jimporter marked this pull request as draft July 13, 2023 23:51
@jimporter
Copy link
Contributor Author

Please add extend the test suite to test for this.

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 venv PR to merge so that I can be sure the behavior is the same between venv and virtualenv).

@jimporter jimporter marked this pull request as ready for review July 14, 2023 01:06
@jimporter jimporter requested a review from gaborbernat July 14, 2023 01:06
@jimporter
Copy link
Contributor Author

@gaborbernat Ok, hopefully these tests pass. I had to make some educated guesses for a few of the shells.

Copy link
Contributor

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to make the CI pass 😊

@jimporter
Copy link
Contributor Author

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.

@jimporter
Copy link
Contributor Author

@gaborbernat Ok, I think these tests should be good now. One small note is that I renamed VIRTUAL_PROMPT to VIRTUAL_PREFIX in Nushell to reduce ambiguity, though I could revert that. As far as I can tell, that variable is only there to make it easier to write a unit test (this is the variable that holds (<env-name>) , as opposed to VIRTUAL_ENV_PROMPT which holds <env-name>).

@jimporter jimporter requested a review from gaborbernat July 14, 2023 18:05
Copy link
Contributor

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaborbernat gaborbernat merged commit e5ce384 into pypa:main Jul 14, 2023
lengau referenced this pull request in canonical/charmcraft Jul 25, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](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` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/virtualenv/20.24.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/virtualenv/20.24.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/virtualenv/20.23.1/20.24.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/virtualenv/20.23.1/20.24.1?slim=true)](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
[@&#8203;gaborbernat](https://togithub.com/gaborbernat) in
[https://github.com/pypa/virtualenv/pull/2608](https://togithub.com/pypa/virtualenv/pull/2608)
- Upgrade `pip` by
[@&#8203;arielkirkwood](https://togithub.com/arielkirkwood) in
[https://github.com/pypa/virtualenv/pull/2611](https://togithub.com/pypa/virtualenv/pull/2611)

##### New Contributors

- [@&#8203;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
[@&#8203;gaborbernat](https://togithub.com/gaborbernat) in
[https://github.com/pypa/virtualenv/pull/2590](https://togithub.com/pypa/virtualenv/pull/2590)
- Fix the CI by [@&#8203;gaborbernat](https://togithub.com/gaborbernat)
in
[https://github.com/pypa/virtualenv/pull/2593](https://togithub.com/pypa/virtualenv/pull/2593)
- Quickstart guide by
[@&#8203;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
[@&#8203;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
[@&#8203;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
([#&#8203;2194](https://togithub.com/pypa/virtualenv/issues/2194)) by
[@&#8203;jimporter](https://togithub.com/jimporter) in
[https://github.com/pypa/virtualenv/pull/2606](https://togithub.com/pypa/virtualenv/pull/2606)
- Upgrade setuptools by
[@&#8203;gaborbernat](https://togithub.com/gaborbernat) in
[https://github.com/pypa/virtualenv/pull/2607](https://togithub.com/pypa/virtualenv/pull/2607)

#### New Contributors

- [@&#8203;AlvesJorge](https://togithub.com/AlvesJorge) made their first
contribution in
[https://github.com/pypa/virtualenv/pull/2599](https://togithub.com/pypa/virtualenv/pull/2599)
- [@&#8203;nathanczh](https://togithub.com/nathanczh) made their first
contribution in
[https://github.com/pypa/virtualenv/pull/2602](https://togithub.com/pypa/virtualenv/pull/2602)
- [@&#8203;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>
artizirk added a commit to artizirk/dotfiles that referenced this pull request Oct 29, 2024
And ignore VIRTUAL_ENV_PROMPT variable for now as it is different
between venv and virtualenv implementations:

* python/cpython#106726
* pypa/virtualenv#2606
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

Successfully merging this pull request may close these issues.

2 participants