acsone / setuptools-odoo

A library to help packaging Odoo addons with setuptools. It mainly populates the usual setup.py keywords from the Odoo manifest files.
GNU Lesser General Public License v3.0
41 stars 46 forks source link

Generate requirements: duplicated entries when specific version pinned #59

Closed simahawk closed 3 years ago

simahawk commented 3 years ago

Specific version pinned https://github.com/OCA/rest-framework/blob/14.0/base_rest/__manifest__.py#L27 leads to duplicated entries into requirements.txt:

image

Example: https://github.com/OCA/rest-framework/runs/3652923710#step:4:164

CC @lmignon

sbidoul commented 3 years ago

Does this cause issues in practice ?

simahawk commented 3 years ago

The final result seems correct anyway but in the case of lower pinning you get 2 downloads. Eg:

$ cat test-bad-requirements.txt 
apispec
apispec<5.1.0

$ pip install -r test-bad-requirements.txt --no-cache-dir
Collecting apispec
  Downloading apispec-5.1.0-py2.py3-none-any.whl (28 kB)
  Downloading apispec-5.0.0-py2.py3-none-any.whl (28 kB)
Installing collected packages: apispec
Successfully installed apispec-5.0.0

Greater pinning (same case as base_rest):

$ cat test-bad-requirements.txt 
apispec
apispec>=4.0.0

$ pip install -r test-bad-requirements.txt --no-cache-dir
Collecting apispec
  Downloading apispec-5.1.0-py2.py3-none-any.whl (28 kB)
Installing collected packages: apispec
Successfully installed apispec-5.1.0

So, not really harmful, but still weird and sub-optimal if we have many duplicated entries. In fact, this does not happen that often...

sbidoul commented 3 years ago

Yep, the pip resolver is correctly handling these cases. This would be hard to "fix" for little benefit. Moreover when mixing requirements.txt from different repos people still need to rely on pip to resolve correctly. So closing.