{"action":"created","issue":{"url":"https://api.github.com/repos/pypa/pip/issues/1479","labels_url":"https://api.github.com/repos/pypa/pip/issues/1479/labels{/name}","comments_url":"https://api.github.com/repos/pypa/pip/issues/1479/comments","events_url":"https://api.github.com/repos/pypa/pip/issues/1479/events","html_url":"https://github.com/pypa/pip/issues/1479","id":25839232,"number":1479,"title":"Add a --save option to install ala npm's save option","user":{"login":"wraithan","id":90898,"avatar_url":"https://avatars.githubusercontent.com/u/90898?v=3","gravatar_id":"","url":"https://api.github.com/users/wraithan","html_url":"https://github.com/wraithan","followers_url":"https://api.github.com/users/wraithan/followers","following_url":"https://api.github.com/users/wraithan/following{/other_user}","gists_url":"https://api.github.com/users/wraithan/gists{/gist_id}","starred_url":"https://api.github.com/users/wraithan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wraithan/subscriptions","organizations_url":"https://api.github.com/users/wraithan/orgs","repos_url":"https://api.github.com/users/wraithan/repos","events_url":"https://api.github.com/users/wraithan/events{/privacy}","received_events_url":"https://api.github.com/users/wraithan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2014-01-17T21:41:15Z","updated_at":"2015-04-20T20:21:30Z","closed_at":null,"body":"What this would do is add the package to the requirements file specified along with the version number of it.\r\n\r\n```\r\n$ cat requirements.txt\r\nold-package==1.0.0\r\n\r\n$ pip install new-package --save requirements.txt\r\n\r\n# Install logs, installs version 1.5.3 of new-package\r\n\r\n$ cat requirements.txt\r\nold-package==1.0.0\r\nnew-package==1.5.3\r\n```\r\n\r\nI 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.\r\n"},"comment":{"url":"https://api.github.com/repos/pypa/pip/issues/comments/94558853","html_url":"https://github.com/pypa/pip/issues/1479#issuecomment-94558853","issue_url":"https://api.github.com/repos/pypa/pip/issues/1479","id":94558853,"user":{"login":"Glavin001","id":1885333,"avatar_url":"https://avatars.githubusercontent.com/u/1885333?v=3","gravatar_id":"","url":"https://api.github.com/users/Glavin001","html_url":"https://github.com/Glavin001","followers_url":"https://api.github.com/users/Glavin001/followers","following_url":"https://api.github.com/users/Glavin001/following{/other_user}","gists_url":"https://api.github.com/users/Glavin001/gists{/gist_id}","starred_url":"https://api.github.com/users/Glavin001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Glavin001/subscriptions","organizations_url":"https://api.github.com/users/Glavin001/orgs","repos_url":"https://api.github.com/users/Glavin001/repos","events_url":"https://api.github.com/users/Glavin001/events{/privacy}","received_events_url":"https://api.github.com/users/Glavin001/received_events","type":"User","site_admin":false},"created_at":"2015-04-20T20:21:30Z","updated_at":"2015-04-20T20:21:30Z","body":"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.\r\n\r\n@Ivoz mentions `requirements 2.0` which looks great, and I am very excited for it. \r\n\r\n@techdragon:\r\n\r\n> I actually would prefer to not update the requirements.txt file because that would help perpetuate the bad practice of 'install my library by running pip install -r requirements.txt' and doesn't help the packaging story as much as adding this feature for 'only setup.py' would do.\r\n\r\nI am not an experienced Python developer, however I see a custom file such as `setup.py` being less preferrable given that it is Python executible code and therefore cannot be easily manipulated by helpful tools like `pip`. Ideally, we should have a file  like `requirements 2.0` with a purely-metadata json format. However, this is not the case and does not exist, yet. I look forward to that day when it does. Until then, I do prefer something along the lines of `pip install -r requirements.txt` or more preferably `pip install` ( see https://github.com/pypa/pip/issues/2488 ) and hope to bring that into reality.\r\n\r\n@wraithan had a good idea with `pip install new-package --save requirements.txt --save-deps` that addressed your two requirements:\r\n\r\n> I think there are two things a save option must be capable of.\r\n>\r\n> - Specifying how we are saving dependencies, setup.py or requirements.txt\r\n> - Specifying dependency groups. Like these https://pythonhosted.org/setuptools/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies ( I am not sure if its possible to do this with requirements.txt files other than making 'requirements-<suffix>.txt' files )\r\n\r\nInstead of having the simplicity that `npm` has with `npm install --save <package>` we can come close and in addition specify the path to the `requirements.txt` file.\r\n\r\nI see `pip install <package> --save requirements.txt` being sufficient. The argument would be `--save <requirements.txt file path>` and by specifying different requirement.txt files you could have both normal and dev-dependencies (think `--save requirements.txt` and `--save requirements-dev.txt`, for example).\r\n\r\nOnce 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 `--save <requirements file path>` as the new argument?"}}