[Distutils] Parsing requirements, pip has no API ...

Thomas Güttler guettliml at thomas-guettler.de
Fri Feb 13 22:27:58 CET 2015


I was told:

{{{
Pip does not have a public API and because of that there is no backwards compatibility contract. It's impossible to fully parse every type of requirements.txt without a session so either parse_requirements needs to create one if it doesn't (which means if we forget to pass in a session somewhere it'll use the wrong one) or it needs one passed in.
}}}
>From https://github.com/pypa/pip/issues/2422#issuecomment-74271718


Up to now we used parse_requirements() of pip, but in new versions you need to pass in a 
session.

If I see changes like this:

setup.py
- install_requires=[str(req.req) for req in parse_requirements("requirements.txt")],
+ install_requires=[str(req.req) for req in parse_requirements("requirements.txt", session=uuid.uuid1())],

 ... I think something is wrong.


I am not an expert in python packaging details. I just want it to work.

What is wrong here?

  - You should not use parse_requirements() in setup.py
  - pip should not change its API.
  - you should not use pip at all, you should use ...?

Regards,
  Thomas


-- 
http://www.thomas-guettler.de/


More information about the Distutils-SIG mailing list