-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add --save and --save-to options to install #3873
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
Conversation
saved_packages[name] = line_number | ||
|
||
for requirement in requirement_set.requirements.values(): | ||
if not requirement.comes_from: # not a dependency of smth |
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.
What is smth
?
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.
"Something". I'll remove a comment in a couple of hours, it's redundant there.
@xavfernandez Could it be possibly added to 8.2 milestone? Is there anything else I have to add before? |
Hello @mkurnikov , Thanks for your contribution but I'm not sure we want to include this feature. A limitation of the current implementation is if you have a Extras ( |
@@ -0,0 +1,56 @@ | |||
def test_save_installed_package_in_requirements(script): | |||
freezed_requests = 'requests==1.0.0' |
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.
Nitpick: "frozen" rather than "freezed".
I'm concerned that there are a lot of vague areas here. What if the requirements file contains a URL for the same project as we just installed? Will we end up with the project name plus the URL? As @xavfernandez points out, what about extras? And I don't think the code copes with a requirements line like When I've seen this feature requested, the motivation seems to typically be "like npm". For those of us who don't know npm, I think fuller documentation is needed - and that documentation should cover precisely how the feature interacts with an existing requirements file (covering the various complexities that could be in such a file - I have the feeling that the npm equivalent of a requirements file is much simpler than pip's version). Maybe a more practical approach would be for There's obviously a need for something like this - the request keeps coming up. But I'd rather see a good spec of what's needed before we dive into implementation. |
Can't we just move to a single json file for all the dependencies, like it's been done in the npm? Is there any purpose of having the |
That would be a major compatibility breaking change. You'd need a far better justification to even consider something like that. And if you removed any of the capabilities currently in requirements files (for example, the ability to specify options or extra indexes) you'd need to justify that and offer an alternative solution for the people using those capabilities. tl; dr; No, we can't. |
I can imagine something like
and backward compatibility through generation of the But yes, I completely understand, that is exactly what I thought the answer will be. |
I'm closing the PR until better times. |
Resolves #1479.
--save
is a boolean flag to save aname==version
line to the requirements file, and--save-to
specifies which requirements file to use.Features:
FileNotFoundError
if base directory for the requirements file does not exist-r requirements.txt
in the beginning of the file)