This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add --upgrade-deps to venv module
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: John Hagen, cooperlees, hauntsaninja, lukasz.langa, miss-islington, vinay.sajip, zach.ware
Priority: normal Keywords: patch

Created on 2018-08-31 15:25 by cooperlees, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13100 merged cooperlees, 2019-05-05 16:05
PR 20135 merged hauntsaninja, 2020-05-16 21:13
Messages (11)
msg324431 - (view) Author: Cooper Lees (cooperlees) * Date: 2018-08-31 15:25
I'd like to propose add a `--upgrade` to venv module to automatically update pip and potentially setuptools if supplied. This will allow ensuring you have the latest and greatest of these core components.

Example Usage:
python3 -m venv --upgrade /tmp/awesome_venv

This will allow me to skip my next command that I usually always do:
/tmp/awesome_venv/bin/pip install --upgrade pip setuptools

Thoughts? If people are happy, I will look at doing the PR. 

I would envision I'll either import (which seems to be a no no from pip maintainers) the upgrade code or just fork pip ...
msg324433 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2018-08-31 15:42
This sounds good to me; my `python -m venv venv` commands are also almost always followed up by `venv/bin/python -m pip install -U pip setuptools wheel`.  I wouldn't get the `wheel` from this, but it's not always necessary anyway.

Rather than importing or forking, I would expect this could just be done by invoking the venv's pip as a subprocess.

Also, it would need to be a different flag than `--upgrade`, which already exists.
msg324435 - (view) Author: Cooper Lees (cooperlees) * Date: 2018-08-31 15:59
Thanks for hi-lighting, yes, sorry. I should of been clearer here.

What should we use other than `--upgrade`? I just wanted the topic to be generic:
- `-U`
- `--upgrade-modules`
- `--pip-upgrade`
- `--pull-latest`

In regards to using subprocess, it calls exec or fork to run the child process/command, so that's what I wished to communicate via the term 'fork'.
msg345885 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2019-06-17 18:18
New changeset 4acdbf11b1fae1af24c47413a6caa593010d1b6f by Łukasz Langa (Cooper Lees) in branch 'master':
bpo-34556: Add --upgrade-deps to venv module (#13100)
https://github.com/python/cpython/commit/4acdbf11b1fae1af24c47413a6caa593010d1b6f
msg346278 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2019-06-22 12:51
Can this issue be closed now?
msg346344 - (view) Author: Cooper Lees (cooperlees) * Date: 2019-06-23 21:42
I believe so - Would love it could be included with latest 3.8 or is there no chance of that?
msg346355 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2019-06-24 06:59
> included with latest 3.8 or is there no chance of that?

Unfortunately not, I think, as it missed the cut for 3.8beta1. Never mind! Thanks for your contribution.
msg346396 - (view) Author: Cooper Lees (cooperlees) * Date: 2019-06-24 13:19
That’s very disappointing. I had the very small PR ready to merge ~3 weeks before beta1. I now have to wait ~1.5years to be able to use this anywhere that I won’t be back porting it.

I am happy to be on the hook and forward fix anything it causes, but as a new CLI argument that does nothing unless specified, I can’t really see any disadvantages of merging this into 3.8. Is there any way other than discussing with the release manager to have this considered?
msg346901 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2019-06-29 21:54
> Is there any way other than discussing with the release manager to have this considered?

I don't believe so.
msg369708 - (view) Author: miss-islington (miss-islington) Date: 2020-05-23 09:59
New changeset 1cba1c9abadf76f458ecf883a48515aa3b534dbd by Shantanu in branch 'master':
bpo-34556: Document addition of upgrade_deps to venv.create (GH-20135)
https://github.com/python/cpython/commit/1cba1c9abadf76f458ecf883a48515aa3b534dbd
msg376434 - (view) Author: John Hagen (John Hagen) * Date: 2020-09-05 16:13
I noticed this new feature was not added to the Python 3.9 what's new: https://docs.python.org/3.9/whatsnew/3.9.html#venv

Should it be?
History
Date User Action Args
2022-04-11 14:59:05adminsetgithub: 78737
2020-09-05 16:13:00John Hagensetnosy: + John Hagen
messages: + msg376434
2020-05-23 09:59:14miss-islingtonsetnosy: + miss-islington
messages: + msg369708
2020-05-16 21:13:25hauntsaninjasetnosy: + hauntsaninja

pull_requests: + pull_request19440
2019-06-29 21:54:38vinay.sajipsetmessages: + msg346901
2019-06-24 21:08:24cooperleessettitle: Add --upgrade to venv module -> Add --upgrade-deps to venv module
2019-06-24 13:19:22cooperleessetmessages: + msg346396
2019-06-24 06:59:01vinay.sajipsetstatus: open -> closed
versions: + Python 3.9, - Python 3.8
messages: + msg346355

resolution: fixed
stage: patch review -> resolved
2019-06-23 21:42:26cooperleessetmessages: + msg346344
2019-06-22 12:51:07vinay.sajipsetmessages: + msg346278
2019-06-17 18:18:28lukasz.langasetnosy: + lukasz.langa
messages: + msg345885
2019-05-05 16:05:25cooperleessetkeywords: + patch
stage: patch review
pull_requests: + pull_request13013
2018-08-31 15:59:04cooperleessetmessages: + msg324435
2018-08-31 15:42:45zach.waresetnosy: + vinay.sajip, zach.ware
messages: + msg324433
2018-08-31 15:25:51cooperleescreate