cloudfoundry / python-buildpack

Cloud Foundry buildpack for the Python Language
http://docs.cloudfoundry.org/buildpacks/
Apache License 2.0
121 stars 279 forks source link

Buildpack generates broken `requirements.txt` when multiple sources specified in Pipfile.lock #212

Closed fg-j closed 3 years ago

fg-j commented 4 years ago

What version of the buildpack you are using? Multiple versions including 1.7.20

If you were attempting to accomplish a task, what was it you were attempting to do? cf push this sample app

What did you expect to happen? The buildpack should generate a requirements.txt file during the build that uses the --extra-index-url flag, since there are multiple sources in the Pipfile.lock

What was the actual behavior? The buildpack generates a requirements.txt file that looks like:

-i https://pypi.org/simple
 -i https://test.pypi.org/simple
 certifi==2020.4.5.1
  idna==2.9
 markupsafe==1.1.1
 requests==2.23.0
 urllib3==1.25.8
  webob==1.8.6
   chardet==3.0.4
 jinja2==2.11.2
parse==1.15.0
regiuss==0.0.3

Note that includes two instances of the -i flag, where pip install will only accept one. (See this post) and the pip man page linked therein.

The faulty line of code within the buildpack is here.

Please confirm where necessary:

cf-gitbot commented 4 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/174628026

The labels on this github issue will be updated when the story is started.

arjun024 commented 3 years ago

Solved in cf205e2fed0334d7b6b8e6c0118bb7f61c490793. Should be available from next release

fg-j commented 3 years ago

Looks like the fix works for my sample app. After updating the contents of runtime.txt to contain:

python-3.8.7

I can now cf push the app and I see the resulting output:

cf push
Pushing from manifest to org system / space my-space as admin...
Using manifest file /home/ubuntu/workspace/cloudfoundry/python-buildpack/sample-app/manifest.yml
Getting app info...
...
...
...
Downloaded app package (7.4K)
   -----> Python Buildpack version 1.7.28.20210107191246
   -----> Supplying Python
   -----> Installing python 3.8.7
          Download [https://buildpacks.cloudfoundry.org/dependencies/python/python_3.8.7_linux_x64_cflinuxfs3_4abd87d1.tgz]
   -----> Installing pip-pop 0.1.5
          Download [https://buildpacks.cloudfoundry.org/dependencies/manual-binaries/pip-pop/pip-pop-0.1.5-b32efe86.tar.gz]
          Generating 'requirements.txt' from Pipfile.lock
   -----> Running Pip Install
          Looking in indexes: https://pypi.org/simple, https://test.pypi.org/simple

So it does seem like the change makes Pip able to see both desired indexes.