-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add pip download
command and deprecate pip install --download
.
#3085
Add pip download
command and deprecate pip install --download
.
#3085
Conversation
action='store_true', | ||
default=False, | ||
help="Include pre-release and development versions. By default, " | ||
"pip only finds stable versions.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now defined in https://github.com/pypa/pip/blob/develop/pip/cmdoptions.py#L499
Thanks for the quick review, @xavfernandez . First three issues were corrected. |
@@ -139,7 +139,7 @@ def test_download_vcs_link(script): | |||
It should allow -d flag for vcs links, regression test for issue #798. | |||
""" | |||
result = script.pip( | |||
'install', '-d', '.', 'git+git://github.com/pypa/pip-test-package.git' | |||
'download', '-d', '.', 'git+git://github.com/pypa/pip-test-package.git' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering whether we should duplicate all those tests to keep checking for the 2 next versions that the existingpip install --download ...
commands keep working along with the new pip download
command...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the more I think about it, the more I think we should.
New features might be added to pip download
without affecting the current pip install --download
behavior and having tests will help ensure we do not break anything :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
ed810ea
to
3d2f45c
Compare
pip download
command and deprecate pip install --download
.
'-d', '--dest', '--destination-dir', '--destination-directory', | ||
dest='download_dir', | ||
metavar='dir', | ||
default=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one should default to something like the current directory or maybe ./pip_downloads
(to mimic the way pip wheel
works, cf https://github.com/pypa/pip/blob/develop/pip/commands/wheel.py#L18).
With the default being None, pip download something
currently deletes everything it has downloaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I don't have a strong opinion on this, but here's a question... Does it make sense to have a default directory? What if we made the CLI pip download <directory> <pkgs>
? Is that better or worse?
I don't know! I certainly don't think having a default is wrong, but I'm curious if we're having a default just to have one when we really expect it to always be specified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my point of view, pip download
is very similar to pip wheel
so I expect it to behave the same.
I'm not a fan of pip download <directory> <pkgs>
, I'd rather use pip download -d <directory> <pkgs>
, not much longer but way clearer.
An other (bad) reason we need a default: currently if download_dir is None, the RequirementSet won't download/keep anything. ^^
9228f92
to
df6ba42
Compare
34fc4da
to
e8cfbe8
Compare
'-d', '--dest', '--destination-dir', '--destination-directory', | ||
dest='download_dir', | ||
metavar='dir', | ||
default=DEFAULT_DOWNLOAD_DIR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better but the directory is not automatically created and a simple pip download setuptools
crashes.
We need to create the dir if it doesn't exist, I'd again copy the pip wheel
command behavior, cf https://github.com/pypa/pip/blob/develop/pip/req/req_set.py#L330-L331
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally with a new test case for the download command without --download-dir option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, and test added.
e8cfbe8
to
b04ba0d
Compare
|
||
.. pip-command-usage:: download | ||
|
||
``pip download`` is used just like ``pip install --download`` was used in the past. The same rules apply to this command: it should be very comfortable to use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be documented on it's own and not in relation to pip install --download
which will be deprecated and removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarified the documentation. I noted explicitly that this replaces pip install --download
, but that the latter is deprecated and will be removed. I'm not very familiar with this doc formatting, so if there's any extra cross-linking I should be doing to pip install
, please point me at an example of how to do so.
`pip download` has the same functionality as `pip install --download`, and the behavior of `pip install --download` is preserved with a deprecation warning. `pip install --download` will be removed in pip version 10.
b04ba0d
to
417f79d
Compare
Add `pip download` command and deprecate `pip install --download`.
Thanks for your work ! 👍 |
This is a followup to #2995