mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 29775c020a | |||
| 50950c59df | |||
| 9817eb149e | |||
| a703d2febe | |||
| e304405410 | |||
| 17f992a106 | |||
| 24895082d3 | |||
| 002780c2d9 | |||
| df7f8f3507 | |||
| 312a468cce | |||
| d4b8c2aeda | |||
| f86e8079b6 | |||
| 36c6f5e388 | |||
| 91a65b2984 | |||
| 3010070d55 | |||
| fedae5ceda | |||
| 4212e06309 | |||
| fd360bda14 | |||
| 4723abb896 |
+36
-5
@@ -1,5 +1,36 @@
|
||||
# Python Buildpack Changelog
|
||||
|
||||
# 118
|
||||
|
||||
Improvements to Pipenv support.
|
||||
|
||||
# 117
|
||||
|
||||
Bug fix.
|
||||
|
||||
# 116
|
||||
|
||||
Vendoring improvements.
|
||||
|
||||
- Geos libraries should work on Heroku-16 now.
|
||||
- The libffi/libmemcached vendoring step is now skipped on Heroku-16 (since they are installed in the base image).
|
||||
|
||||
# 115
|
||||
|
||||
Revert a pull request.
|
||||
|
||||
- No longer using `sub_env` for `pip install` step.
|
||||
|
||||
# 114
|
||||
|
||||
- Bugfixes.
|
||||
|
||||
Blacklisting `PYTHONHOME` and `PYTHONPATH` for older apps. Upgrades to nltk support.
|
||||
|
||||
# 113
|
||||
|
||||
Updates to Pipenv support.
|
||||
|
||||
# 112
|
||||
|
||||
Bugfix.
|
||||
@@ -12,17 +43,17 @@ Linting, bugfixes.
|
||||
|
||||
# 110
|
||||
|
||||
Update default Python to 3.6.2.
|
||||
|
||||
# 109
|
||||
|
||||
Update Default Python to 3.6.1, bugfixes.
|
||||
|
||||
- Fixed automatic pip uninstall of dependencies removed from requirements.txt.
|
||||
|
||||
# 109
|
||||
|
||||
Fix output for collectstatic step.
|
||||
|
||||
# 108
|
||||
|
||||
Updated setuptools.
|
||||
Fix output for collectstatic step.
|
||||
|
||||
# 107
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
[](https://travis-ci.org/heroku/heroku-buildpack-python)
|
||||
|
||||
This is the official [Heroku buildpack](https://devcenter.heroku.com/articles/buildpacks) for Python apps, powered by [pip](https://pip.pypa.io/) and other excellent software.
|
||||
This is the official [Heroku buildpack](https://devcenter.heroku.com/articles/buildpacks) for Python apps, powered by [Pipenv](http://docs.pipenv.org/en/latest/), [pip](https://pip.pypa.io/) and other excellent software.
|
||||
|
||||
Recommended web frameworks include **Django** and **Flask**. The recommended webserver is **Gunicorn**. There are no restrictions around what software can be used (as long as it's pip-installable). Web processes must bind to `$PORT`, and only the HTTP protocol is permitted for incoming connections.
|
||||
|
||||
@@ -16,7 +16,7 @@ See it in Action
|
||||
Deploying a Python application couldn't be easier:
|
||||
|
||||
$ ls
|
||||
Procfile requirements.txt web.py
|
||||
Pipfile Procfile web.py
|
||||
|
||||
$ heroku create --buildpack heroku/python
|
||||
|
||||
@@ -24,16 +24,14 @@ Deploying a Python application couldn't be easier:
|
||||
...
|
||||
-----> Python app detected
|
||||
-----> Installing python-3.6.2
|
||||
$ pip install -r requirements.txt
|
||||
Collecting requests (from -r requirements.txt (line 1))
|
||||
Downloading requests-2.12.4-py2.py3-none-any.whl (576KB)
|
||||
Installing collected packages: requests
|
||||
Successfully installed requests-2.12.4
|
||||
|
||||
-----> Installing pip
|
||||
-----> Installing requirements with latest pipenv...
|
||||
...
|
||||
Installing dependencies from Pipfile...
|
||||
-----> Discovering process types
|
||||
Procfile declares types -> (none)
|
||||
|
||||
A `requirements.txt` file must be present at the root of your application's repository.
|
||||
A `Pipfile` or `requirements.txt` must be present at the root of your application's repository.
|
||||
|
||||
You can also specify the latest production release of this buildpack for upcoming builds of an existing application:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script serves as the Cryptography build step of the
|
||||
# This script serves as the cffi build step of the
|
||||
# [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python)
|
||||
# compiler.
|
||||
#
|
||||
@@ -9,6 +9,11 @@
|
||||
#
|
||||
# This script is invoked by [`bin/compile`](/).
|
||||
|
||||
if [[ "$STACK" == "heroku-16" ]]; then
|
||||
# libffi is pre-installed in the stack image so there is no need to vendor it.
|
||||
return 0
|
||||
fi
|
||||
|
||||
# The location of the pre-compiled libffi binary.
|
||||
VENDORED_LIBFFI="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/libffi.tar.gz"
|
||||
|
||||
|
||||
@@ -30,6 +30,12 @@ if [[ "$BUILD_WITH_GEO_LIBRARIES" ]]; then
|
||||
curl "$VENDORED_GDAL" -s | tar zxv -C .heroku/vendor &> /dev/null
|
||||
curl "$VENDORED_GEOS" -s | tar zxv -C .heroku/vendor &> /dev/null
|
||||
curl "$VENDORED_PROJ" -s | tar zxv -C .heroku/vendor &> /dev/null
|
||||
|
||||
# Copy libjasper from build image to slug.
|
||||
if [[ "$STACK" == "heroku-16" ]]; then
|
||||
cp /usr/lib/x86_64-linux-gnu/libjasper.so* ".heroku/vendor/lib/."
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
GDAL=$(pwd)/vendor
|
||||
|
||||
+3
-4
@@ -21,10 +21,10 @@ if sp-grep -s nltk; then
|
||||
|
||||
if [ -f "$nltk_packages_definition" ]; then
|
||||
|
||||
nltk_packages=$(tr "\n" " " < "$nltk_packages_definition")
|
||||
puts-step "Downloading NLTK packages: $nltk_packages"
|
||||
readarray -t nltk_packages < "$nltk_packages_definition"
|
||||
puts-step "Downloading NLTK packages: ${nltk_packages[*]}"
|
||||
|
||||
python -m nltk.downloader -d "$BUILD_DIR/.heroku/python/nltk_data" "$nltk_packages" | indent
|
||||
python -m nltk.downloader -d "$BUILD_DIR/.heroku/python/nltk_data" "${nltk_packages[@]}" | indent
|
||||
set_env NLTK_DATA "/app/.heroku/python/nltk_data"
|
||||
|
||||
else
|
||||
@@ -32,4 +32,3 @@ if sp-grep -s nltk; then
|
||||
puts-warn "Learn more: https://devcenter.heroku.com/articles/python-nltk"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then
|
||||
puts-step "Installing requirements with pip"
|
||||
|
||||
set +e
|
||||
sub_env /app/.heroku/python/bin/pip install -r "$BUILD_DIR/requirements.txt" --exists-action=w --src=/app/.heroku/src --disable-pip-version-check --no-cache-dir 2>&1 | tee "$WARNINGS_LOG" | cleanup | indent
|
||||
|
||||
/app/.heroku/python/bin/pip install -r "$BUILD_DIR/requirements.txt" --exists-action=w --src=/app/.heroku/src --disable-pip-version-check --no-cache-dir 2>&1 | tee "$WARNINGS_LOG" | cleanup | indent
|
||||
PIP_STATUS="${PIPESTATUS[0]}"
|
||||
set -e
|
||||
|
||||
|
||||
+7
-2
@@ -3,13 +3,18 @@
|
||||
# Pipenv support (Generate requriements.txt with pipenv).
|
||||
if [[ -f Pipfile ]]; then
|
||||
if [[ ! -f requirements.txt ]]; then
|
||||
puts-step "Installing requirements with latest pipenv..."
|
||||
puts-step "Installing requirements with latest Pipenv..."
|
||||
|
||||
# Install pipenv.
|
||||
/app/.heroku/python/bin/pip install pipenv --upgrade &> /dev/null
|
||||
|
||||
if [[ ! -f Pipfile.lock ]]; then
|
||||
/app/.heroku/python/bin/pipenv install --system --skip-lock 2>&1 | indent
|
||||
else
|
||||
/app/.heroku/python/bin/pipenv install --system 2>&1 | indent
|
||||
fi
|
||||
# Install the dependencies.
|
||||
/app/.heroku/python/bin/pipenv install --system 2>&1 | indent
|
||||
|
||||
|
||||
# Skip pip install, later.
|
||||
export SKIP_PIP_INSTALL=1
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Detect Python-version with Pipenv.
|
||||
|
||||
if [[ -f $BUILD_DIR/Pipfile.lock ]]; then
|
||||
if [[ -f $BUILD_DIR/Pipfile ]]; then
|
||||
|
||||
if [[ ! -f $BUILD_DIR/runtime.txt ]]; then
|
||||
if [[ ! -f $BUILD_DIR/Pipfile.lock ]]; then
|
||||
|
||||
+5
-1
@@ -9,6 +9,11 @@
|
||||
#
|
||||
# This script is invoked by [`bin/compile`](/).
|
||||
|
||||
if [[ "$STACK" == "heroku-16" ]]; then
|
||||
# libmemcached is pre-installed in the stack image so there is no need to vendor it.
|
||||
return 0
|
||||
fi
|
||||
|
||||
# The location of the pre-compiled libmemcached binary.
|
||||
VENDORED_MEMCACHED="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/libmemcache.tar.gz"
|
||||
|
||||
@@ -16,7 +21,6 @@ VENDORED_MEMCACHED="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor
|
||||
# shellcheck source=bin/utils
|
||||
source "$BIN_DIR/utils"
|
||||
|
||||
|
||||
# If pylibmc exists within requirements, use vendored libmemcached.
|
||||
if (pip-grep -s requirements.txt pylibmc &> /dev/null) then
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -10,7 +10,7 @@ hash -r
|
||||
|
||||
echo "Building gdal..."
|
||||
|
||||
VERSION="1.11.5"
|
||||
VERSION="2.2.1"
|
||||
SOURCE_TARBALL="http://download.osgeo.org/gdal/${VERSION}/gdal-${VERSION}.tar.gz"
|
||||
|
||||
curl -L $SOURCE_TARBALL | tar zx
|
||||
|
||||
Vendored
+5
-3
@@ -10,14 +10,16 @@ hash -r
|
||||
|
||||
echo "Building geos..."
|
||||
|
||||
SOURCE_TARBALL='http://download.osgeo.org/geos/geos-3.4.3.tar.bz2'
|
||||
VERSION=3.6.2
|
||||
|
||||
SOURCE_TARBALL="http://download.osgeo.org/geos/geos-${VERSION}.tar.bz2"
|
||||
|
||||
curl -L $SOURCE_TARBALL | tar xj
|
||||
|
||||
cd geos-3.4.3
|
||||
pushd "geos-${VERSION}"
|
||||
./configure --prefix=$OUT_PREFIX --enable-static=no &&
|
||||
make
|
||||
make install
|
||||
|
||||
# Cleanup
|
||||
cd ..
|
||||
popd
|
||||
|
||||
Vendored
+5
-4
@@ -10,14 +10,15 @@ hash -r
|
||||
|
||||
echo "Building gdal..."
|
||||
|
||||
SOURCE_TARBALL='http://download.osgeo.org/proj/proj-4.8.0.tar.gz'
|
||||
VERSION=4.9.3
|
||||
SOURCE_TARBALL="http://download.osgeo.org/proj/proj-${VERSION}.tar.gz"
|
||||
|
||||
curl -L $SOURCE_TARBALL | tar zx
|
||||
|
||||
cd proj-4.8.0
|
||||
./configure --prefix=$OUT_PREFIX --enable-static=no &&
|
||||
pushd "proj-${VERSION}"
|
||||
./configure --prefix=$OUT_PREFIX --enable-static=no
|
||||
make
|
||||
make install
|
||||
|
||||
# Cleanup
|
||||
cd ..
|
||||
popd
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
cffi
|
||||
Vendored
+2
-1
@@ -1 +1,2 @@
|
||||
wordnet
|
||||
city_database
|
||||
stopwords
|
||||
|
||||
@@ -24,7 +24,7 @@ testGEOS() {
|
||||
|
||||
testNLTK() {
|
||||
compile "nltk"
|
||||
assertCaptured "wordnet"
|
||||
assertCaptured "Downloading NLTK packages: city_database stopwords"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
@@ -47,6 +47,12 @@ testPsycopg2() {
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testCffi() {
|
||||
compile "cffi"
|
||||
assertCaptured "cffi"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testPylibmc() {
|
||||
compile "pylibmc"
|
||||
assertCaptured "pylibmc"
|
||||
|
||||
@@ -150,6 +150,11 @@ _assertContains()
|
||||
esac
|
||||
|
||||
fail "${msg:-${default_msg}}"
|
||||
|
||||
if [ "${haystack_type}" == "file" ]; then
|
||||
echo
|
||||
cat "${haystack}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user