Re:Packaging Python software with pbr
by daenney on Wednesday September 13, 2017 @12:18PM
(#15239732)
I suppose it does doe that, so does this though:
I don't think it's worth the dependency. But perhaps for others it is.
[ Parent
| on HN ]
Re:Packaging Python software with pbr
by leetrout on Wednesday September 13, 2017 @12:45PM
(#15240036)
That works for simple use cases but it is not robust.
In case anyone sees this, at a minimum you need to use
from pip.req import parse_requirements
parse_requirements('path/to/requirements.txt')
to be safe here.
Re:Packaging Python software with pbr
by bobbyi_settv on Wednesday September 13, 2017 @01:12PM
(#15240334)
What if the user doesn't have pip installed? This is before we've installed the requirements, so we shouldn't be assuming anything outside the stdlib.
Re:Packaging Python software with pbr
by AndrewCHM on Wednesday September 13, 2017 @02:43PM
(#15241303)
if I'm not mistaken, requirements are parsed out to be installed before installing the desired package, so that should be fine
Re:Packaging Python software with pbr
by blamarvt on Wednesday September 13, 2017 @02:57PM
(#15241447)
Isn't that paradoxical? That code is for parsing requirements and those requirements can't be parsed until initial pre-requirements (pip, in this case) are installed.
Re:Packaging Python software with pbr
by AndrewCHM on Friday September 15, 2017 @03:10PM
(#15259880)
sorta
from my understanding, when you build the package, your computer extracts the relevant required packages, and sends up that data to pypi, which then in turn sends that data back to users when they install
At least thats how I think it works
I think you may be misunderstanding the problem being discussed. The code that uses pip will crash if pip is not already installed. There is no way to parse and satisfy the dependency on pip, because the author chose to import pip as a library.
Re:Packaging Python software with pbr
by AndrewCHM on Monday September 18, 2017 @11:57PM
(#15281672)
pip being a dependency is defined at upload time, it is parsed by the creator of the package, not the consumer, afaik
if you used any other package manager, it would need to resolve dependencies from the additional info in the package index, resulting in pip being downloaded and installed before the desired package is installed
This is actually less robust, since instead of relying on the setuptools API, you now also rely on the pip API.
If you control requirements.txt, there is nothing "not robust" about parsing it in setup.py.