ehmatthes / heroku-buildpack-python

A demonstration version of the official Heroku buildpack for Python apps, showing how Django deployment can be further simplified.
https://ehmatthes.com/blog/simplified_heroku/
MIT License
16 stars 2 forks source link

Support Pipfiles #16

Closed ehmatthes closed 3 years ago

ehmatthes commented 3 years ago

Handling projects that use a Pipfile instead of requirements.txt shouldn't be too difficult. It should be a matter of:

ehmatthes commented 3 years ago
ehmatthes commented 3 years ago

In modifying Pipfile, I can't just append new package names onto the end of the file. They need to go in the [packages] section. Awk should be able to do this:

$ cat Pipfile
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]
requests = "*"

[dev-packages]
$ DATA='[packages]\ndjango = "*"'
$ awk -v r="$DATA" '{gsub(/\[packages\]/,r)}1' Pipfile | xargs -0 echo > PipfileModified && mv PipfileModified Pipfile
$ cat Pipfile
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]
django = "*"
requests = "*"

[dev-packages]

I'm sure there's a cleaner way to do this without the temporary PipfileModified, but this should get things working.

ehmatthes commented 3 years ago

A simple project using Pipenv to manage dependencies deploys successfully.