-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add a --save option to install ala npm's save option #1479
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
Comments
I agree with this feature, though I don't want it to include dependencies because I want to introduce proper lockfile support at some point :) |
Maybe an additional option to include deps then?
or something like that? |
That could make sense, then when we get lockfile support we can deprecate --save-deps. |
I'm 👍 on that. |
Is managing environments within the scope of pip? I was always under the impression that the pip team officially decided that pip was only for modifying environments, and something else would need to be built for managing them in a more conclusive fashion. |
I dunno :] Depends on the feature itself I guess. e.g. I wouldn't want pip generating virtualenvs but dealing with the current environment seems reasonable to me. Maybe the other devs feel differently. |
I've seen at least a few features now, that could make sense with a command extension infrastructure for pip? E.G install |
pip is the only one that deals in requirements.txt, and can generate them with the |
This one's a much needed feature! |
Ok, I'm fairly sure this is something where we need a more complex feature than the issue requests.
Having a --save flag that can handle these would pretty much give us parity with the NPM --save option. -- Update -- |
The fact that setup.py is executable code makes it rather unsuited for the above wont, I think. An unfortunate fact of history. One thing that makes A great aide to reasoning about the ideas in this issue might therefore reside in considering it with requirements 2.0 in mind. Coincidentally it also describes a purely-metadata json format, and greatly expands on a next-generation |
+1 I am also a Node.js developing using |
+1 on this also |
Are you accepting Pull Requests for features such as this one? I just finished my exams and hopefully will have some time over the summer to contribute to more open source projects. If there is interest -- I know I sure am interested in this feature -- and the maintainers of pip are willing to accept a pull request, then I am open for developing this out. We should discuss ideal implementation, of course, before I begin any coding on this. @Ivoz mentions
I am not an experienced Python developer, however I see a custom file such as @wraithan had a good idea with
Instead of having the simplicity that I see Once something like requirements 2.0 exists, this will all become deprecated and we will have the ideal solution. For now, what do you all think of simply |
|
+1 for --save |
1 similar comment
+1 for --save |
Just my two cents, but I think it would be awesome if Example setup.cfg: [pip]
base = config/requirements/base.txt ; location for --save
dev = config/requirements/dev.txt ; location for --save-dev |
+1 for --save |
+1 for --save and also --save-dev if possible. ( |
+1 this would be so helpful |
+1 |
2 similar comments
+1 |
+1 |
+1 as well :) |
This is the PR #2988. There are only --save and --save-dest for now. |
+1 |
+1 do it |
How about adding a flag with which pip only outputs the installed packages in requirements format? That would enable one to do:
and saves the copy pasting of the output, and then replacing the "-" with "==" :). (Obviously there are probably better candidates for the name |
+1 |
|
FWIW; I use the following bash function for saving to pip-save ()
{
for pkg in $@;
do
pip install "$pkg" && {
name="$(pip show "$pkg" | grep Name: | awk '{print $2}')";
version="$(pip show "$pkg" | grep Version: | awk '{print $2}')";
echo "${name}==${version}" >> requirements.txt
};
done
} |
It should probably wait for pipfile yea. |
I created this package pipm exactly for this reason. It can be used only during development and use pip in CI/CD. It just wraps around pip and not another standard. |
2018 and a so useful feature still not available! Why? |
@mehulmpt nobody with time and skill available to make a good one - pip is volunteer driven and on very low manpower |
@mehulmpt If you are neither writing it nor hiring other people to write it then you should not complain. |
@matkoniecz I was asking, not complaining, it was a genuine question because I wanted to know if there's any specific reason why this is still not there. And I got my answer, no need to get offended. |
2018 and you can't figure out why a feature is not implemented in FOSS! Why? |
I want to make tow requirement file one for development package and another for production |
https://pypi.org/project/requirementslib/ can read and write Pipfile and requirements.txt; but pip does not (yet?) depend upon requirementslib at this time. https://mail.python.org/archives/list/[email protected]/message/IQVZVVWX2BLEP6D4WQMKNXZHBF2NZINU/ |
IDK what requirementslib currently does with comments and blank lines?
|
def add_or_update_requirement(req, reqfile,
save_hash=True,
hash=sha256): ? Should there be a |
I have created a small module to automatically insert package versions to Currently working on inserting new packages to setup.py so it will be much more comfortable. |
|
|
https://packaging.python.org/discussions/install-requires-vs-requirements/ |
Don't know of any way to do that.
A possible solution would be for me to make a change in |
I do not support the idea of modifying setup.py files to do this; none the less, I think this should be answered:
I know of: https://github.com/PyCQA/baron |
I wrote https://github.com/jnoortheen/pipm sometime back using setup.cfg as the metadata provider. It works for simple cases, but writing data back to setup.cfg using configparser wasn't stable . With the acceptance of pip can manage dependencies too while using requirements*.txt as the lockfile format. |
What this would do is add the package to the requirements file specified along with the version number of it.
I think it would also be great if it included the dependencies but maybe put a comment in there about them, or maybe that would be another option.
The text was updated successfully, but these errors were encountered: