Compare commits

..

50 Commits

Author SHA1 Message Date
kennethreitz b92accf8f1 Merge branch 'master' of github.com:heroku/heroku-buildpack-python
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.

Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 17:43:49 -04:00
kennethreitz 2975911bb0 Merge branch 'master' of github.com:heroku/heroku-buildpack-python 2017-09-26 17:43:22 -04:00
kennethreitz 4f1017f2fc Merge branch 'master' of github.com:heroku/heroku-buildpack-python 2017-09-26 11:43:45 -04:00
kennethreitz 2331a3131c ellipsis
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 11:34:39 -04:00
kennethreitz 372e79ab92 more tests
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 11:31:44 -04:00
kennethreitz d3f455ca3b more tests
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 11:30:19 -04:00
kennethreitz 8d11fddfd3 readme
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 11:28:55 -04:00
kennethreitz d7519075c6 comment out force color bits
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 11:27:31 -04:00
kennethreitz fb839075d1 2.7.14
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 11:27:08 -04:00
kennethreitz e5fcc9efd0 next version
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 11:06:07 -04:00
kennethreitz efb2f78a04 oops
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 11:04:14 -04:00
kennethreitz ffe0c305ee don't use the git version of pipenv
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 11:03:48 -04:00
kennethreitz 95cc7a4951 try …
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:56:14 -04:00
kennethreitz ebe3ff2e2f no more bash
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:54:00 -04:00
kennethreitz f9b74e8bfe use latest, to debug
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:35:25 -04:00
kennethreitz a1e31696f6 just -c
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:29:37 -04:00
kennethreitz 4e207e4bb8 confirmed env working
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:28:20 -04:00
kennethreitz e36d1a9406 try without -l
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:28:11 -04:00
kennethreitz 128a6dd0dc diagnose
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:27:10 -04:00
kennethreitz bf0aa7df8d interactive
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:25:20 -04:00
kennethreitz 41da9d6df8 interactive
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:25:11 -04:00
kennethreitz a3675f9c2a try this
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:20:06 -04:00
kennethreitz 3b3cb9e6c0 try this
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:18:58 -04:00
kennethreitz 7d3ecc7bb4 attempt to force color
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:14:41 -04:00
kennethreitz cb8ad83a06 capitalize Pipfile.lock
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:12:02 -04:00
kennethreitz 6fe93c9b9e be more specific
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:07:59 -04:00
kennethreitz 83e64a15dd consistiency
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:07:01 -04:00
kennethreitz 9634be2a40 unsupported
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:06:09 -04:00
kennethreitz f7488df407 cleanups
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:05:19 -04:00
kennethreitz 40a0640349 cleanups
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:03:30 -04:00
kennethreitz 0fec3dcc00 cleanups
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:01:37 -04:00
kennethreitz c05204d6b5 there we go
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 10:00:31 -04:00
kennethreitz 4db407f361 learn more
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 09:59:33 -04:00
kennethreitz 23929c97d0 try this
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 09:56:54 -04:00
kennethreitz a095dceb93 echo not puts
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 09:53:52 -04:00
kennethreitz 7a9a9787d4 oops
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 09:52:49 -04:00
kennethreitz 18c22492af oops
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 09:52:01 -04:00
kennethreitz 57e0a88585 oops
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 09:50:24 -04:00
kennethreitz 29aeefeba1 improvements to pipenv python version detection
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 09:49:41 -04:00
kennethreitz 2b7671369d remove hashes for conda buildpack
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 09:38:29 -04:00
kennethreitz a5b84e5ffb requirements for anaconda buildpack
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 09:37:52 -04:00
kennethreitz aeb4d075aa Merge branch 'master' of https://git.heroku.com/python-builder-cedar-14 into upgrades 2017-09-26 09:36:58 -04:00
kennethreitz 6010d1f3ed warn when using an older version of python
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 09:34:58 -04:00
kennethreitz fc4f686f1e 2.7.14
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 09:24:01 -04:00
kennethreitz f86ceaddfb check for python_full_version too
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 09:23:49 -04:00
kennethreitz c708a0af7d pipfile > requirements.txt
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 09:23:00 -04:00
kennethreitz a6ccde2bfd python 2.7.14
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-26 09:20:00 -04:00
kennethreitz 29775c020a changelog
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-24 23:20:01 -04:00
kennethreitz d380d949b7 Merge branch 'master' of https://git.heroku.com/python-builder-cedar-14 2017-08-01 14:38:14 -04:00
kennethreitz d6ccb1aa57 fixed the bug for pypy-5.8.0 2017-07-31 19:08:15 -04:00
28 changed files with 98 additions and 289 deletions
-29
View File
@@ -1,34 +1,5 @@
# Python Buildpack Changelog
# 126
Skip installs if Pipfile.lock hasn't changed, and uninstall stale dependencies with Pipenv.
- No longer warn if there is no `Procfile`.
# 125
Set `PYTHONPATH` during collectstatic runs, other updates.
- Update Set `PYTHONPATH` during collectstatic runs.
- Update Pipenv "3.6" to "3.6.4".
# 124
Update buildpack to automatically install [dev-packages] (Pipenv) during Heroku CI builds.
# 123
Update gunicorn init.d script to allow overrides.
# 122
Update default Python to v3.6.4.
# 121
Update default Python to v3.6.3.
# 120
Use Pipenv --deploy.
Generated
+2 -2
View File
@@ -5,14 +5,14 @@
},
"host-environment-markers": {
"implementation_name": "cpython",
"implementation_version": "3.6.3",
"implementation_version": "3.6.2",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_python_implementation": "CPython",
"platform_release": "16.7.0",
"platform_system": "Darwin",
"platform_version": "Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64",
"python_full_version": "3.6.3",
"python_full_version": "3.6.2",
"python_version": "3.6",
"sys_platform": "darwin"
},
+13 -11
View File
@@ -4,11 +4,11 @@
[![Build Status](https://travis-ci.org/heroku/heroku-buildpack-python.svg?branch=master)](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 [Pipenv](http://docs.pipenv.org/), [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.
Python packages with C dependencies that are not [available on the stack image](https://devcenter.heroku.com/articles/stack-packages) are generally not supported, unless `manylinux` wheels are provided by the package maintainers (common). For recommended solutions, check out [this article](https://devcenter.heroku.com/articles/python-c-deps) for more information.
Some Python packages with obscure C dependencies are [not compatible](https://devcenter.heroku.com/articles/python-c-deps).
See it in Action
----------------
@@ -16,14 +16,14 @@ See it in Action
Deploying a Python application couldn't be easier:
$ ls
Pipfile Pipfile.lock Procfile web.py
Pipfile Procfile web.py
$ heroku create --buildpack heroku/python
$ git push heroku master
-----> Python app detected
-----> Installing python-3.6.4
-----> Installing python-3.6.2
-----> Installing pip
-----> Installing requirements with latest pipenv…
...
@@ -41,7 +41,12 @@ You can also specify the latest production release of this buildpack for upcomin
Specify a Python Runtime
------------------------
Specific versions of the Python runtime can be specified in your `Pipfile`:
Specific versions of the Python runtime can be specified with a `runtime.txt` file:
$ cat runtime.txt
python-2.7.14
Or, with a `Pipfile.lock` (generated from the following `Pipfile`):
[requires]
python_version = "2.7"
@@ -51,12 +56,9 @@ Or, more specifically:
[requires]
python_full_version = "2.7.14"
Or, with a `runtime.txt` file:
$ cat runtime.txt
python-2.7.14
Runtime options include:
- `python-3.6.4`
- `python-3.6.2`
- `python-2.7.14`
- `pypy-5.7.1` (unsupported, experimental)
- `pypy3-5.5.1` (unsupported, experimental)
+19 -30
View File
@@ -33,15 +33,9 @@ ENV_DIR=$3
export BUILD_DIR CACHE_DIR ENV_DIR
VENDOR_URL="https://lang-python.s3.amazonaws.com/$STACK"
if [[ -n ${BUILDPACK_VENDOR_URL:-} ]]; then
VENDOR_URL="$BUILDPACK_VENDOR_URL"
fi
export VENDOR_URL
# Python defaults
DEFAULT_PYTHON_VERSION="python-3.6.4"
LATEST_3="python-3.6.4"
DEFAULT_PYTHON_VERSION="python-3.6.2"
LATEST_3="python-3.6.2"
LATEST_2="python-2.7.14"
DEFAULT_PYTHON_STACK="cedar-14"
@@ -100,6 +94,12 @@ export PKG_CONFIG_PATH=/app/.heroku/vendor/lib/pkg-config:/app/.heroku/python/li
# Switch to the repo's context.
cd "$BUILD_DIR"
# Warn for lack of Procfile.
if [[ ! -f Procfile ]]; then
puts-warn 'Warning: Your application is missing a Procfile. This file tells Heroku how to run your application.'
puts-warn 'Learn more: https://devcenter.heroku.com/articles/procfile'
fi
# Prepare the cache.
mkdir -p "$CACHE_DIR"
@@ -160,14 +160,7 @@ mtime "python.install.time" "${start}"
# Pipenv support.
# shellcheck source=bin/steps/pipenv
sub_env "$BIN_DIR/steps/pipenv"
# Uninstall removed dependencies with Pip.
let start=$(nowms)
# shellcheck source=bin/steps/pip-uninstall
source "$BIN_DIR/steps/pip-uninstall"
mtime "pip.uninstall.time" "${start}"
source "$BIN_DIR/steps/pipenv"
# If no requirements.txt file given, assume `setup.py develop` is intended.
if [ ! -f requirements.txt ] && [ ! -f Pipfile ]; then
@@ -198,6 +191,12 @@ sub_env "$BIN_DIR/steps/geo-libs"
# shellcheck source=bin/steps/gdal
source "$BIN_DIR/steps/gdal"
# Uninstall removed dependencies with Pip.
let start=$(nowms)
# shellcheck source=bin/steps/pip-uninstall
source "$BIN_DIR/steps/pip-uninstall"
mtime "pip.uninstall.time" "${start}"
# Install dependencies with Pip (where the magic happens).
let start=$(nowms)
# shellcheck source=bin/steps/pip-install
@@ -225,24 +224,14 @@ mtime "collectstatic.time" "${start}"
# Create .profile script for application runtime environment variables.
set_env PATH "\$HOME/.heroku/python/bin:\$PATH"
set_env PYTHONUNBUFFERED true
set_env PYTHONHOME "\$HOME/.heroku/python"
set_env PYTHONHOME /app/.heroku/python
set_env LIBRARY_PATH "\$HOME/.heroku/vendor/lib:\$HOME/.heroku/python/lib:\$LIBRARY_PATH"
set_env LD_LIBRARY_PATH "\$HOME/.heroku/vendor/lib:\$HOME/.heroku/python/lib:\$LD_LIBRARY_PATH"
set_env LIBRARY_PATH "/app/.heroku/vendor/lib:/app/.heroku/python/lib:\$LIBRARY_PATH"
set_env LD_LIBRARY_PATH "/app/.heroku/vendor/lib:/app/.heroku/python/lib:\$LD_LIBRARY_PATH"
set_default_env LANG en_US.UTF-8
set_default_env PYTHONHASHSEED random
set_default_env PYTHONPATH "\$HOME"
# python expects to be in /app, if at runtime, it is not, set
# up symlinks... this can occur when the subdir buildpack is used
cat <<EOT >> "$PROFILE_PATH"
if [[ \$HOME != "/app" ]]; then
mkdir -p /app/.heroku
ln -nsf "\$HOME/.heroku/python" /app/.heroku/python
ln -nsf "\$HOME/.heroku/vendor" /app/.heroku/vendor
fi
EOT
set_default_env PYTHONPATH /app/
# Install sane-default script for $WEB_CONCURRENCY and $FORWARDED_ALLOW_IPS.
cp "$ROOT_DIR/vendor/WEB_CONCURRENCY.sh" "$WEB_CONCURRENCY_PROFILE_PATH"
-1
View File
@@ -30,7 +30,6 @@ if [ ! "$DISABLE_COLLECTSTATIC" ] && [ -f "$MANAGE_FILE" ] && [ "$DJANGO_INSTALL
puts-step "$ python $MANAGE_FILE collectstatic --noinput"
# Run collectstatic, cleanup some of the noisy output.
export PYTHONPATH=.
python "$MANAGE_FILE" collectstatic --noinput --traceback 2>&1 | sed '/^Post-processed/d;/^Copying/d;/^$/d' | indent
COLLECTSTATIC_STATUS="${PIPESTATUS[0]}"
+1 -1
View File
@@ -15,7 +15,7 @@ if [[ "$STACK" == "heroku-16" ]]; then
fi
# The location of the pre-compiled libffi binary.
VENDORED_LIBFFI="${VENDOR_URL}/libraries/vendor/libffi.tar.gz"
VENDORED_LIBFFI="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/libffi.tar.gz"
PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH"
+1 -1
View File
@@ -10,7 +10,7 @@
# This script is invoked by [`bin/compile`](/).
# The location of the pre-compiled cryptography binary.
VENDORED_GDAL="${VENDOR_URL}/libraries/vendor/gdal.tar.gz"
VENDORED_GDAL="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/gdal.tar.gz"
PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH"
+4 -9
View File
@@ -10,9 +10,9 @@
# This script is invoked by [`bin/compile`](/).
# The location of the pre-compiled cryptography binary.
VENDORED_GDAL="${VENDOR_URL}/libraries/vendor/gdal.tar.gz"
VENDORED_GEOS="${VENDOR_URL}/libraries/vendor/geos.tar.gz"
VENDORED_PROJ="${VENDOR_URL}/libraries/vendor/proj.tar.gz"
VENDORED_GDAL="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/gdal.tar.gz"
VENDORED_GEOS="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/geos.tar.gz"
VENDORED_PROJ="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/proj.tar.gz"
PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH"
@@ -40,10 +40,5 @@ if [[ "$BUILD_WITH_GEO_LIBRARIES" ]]; then
GDAL=$(pwd)/vendor
export GDAL
# set path for post_compile hooks
export GDAL_LIBRARY_PATH="$BUILD_DIR/.heroku/vendor/lib/libgdal.so"
export GEOS_LIBRARY_PATH="$BUILD_DIR/.heroku/vendor/lib/libgeos_c.so"
# set path for runtime environmeht
set_env GDAL_LIBRARY_PATH "/app/.heroku/vendor/lib/libgdal.so"
set_env GEOS_LIBRARY_PATH "/app/.heroku/vendor/lib/libgeos_c.so"
fi
-20
View File
@@ -1,23 +1,11 @@
#!/usr/bin/env bash
# shellcheck source=bin/utils
source $BIN_DIR/utils
if [ ! "$SKIP_PIP_INSTALL" ]; then
# Install dependencies with Pip.
puts-step "Installing requirements with pip"
# Set PIP_EXTRA_INDEX_URL
if [[ -r $ENV_DIR/PIP_EXTRA_INDEX_URL ]]; then
PIP_EXTRA_INDEX_URL="$(cat "$ENV_DIR/PIP_EXTRA_INDEX_URL")"
export PIP_EXTRA_INDEX_URL
fi
set +e
# Measure that we're using pip.
mcount "tool.pip"
/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]}"
@@ -35,12 +23,4 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then
/app/.heroku/python/bin/pip freeze --disable-pip-version-check > .heroku/python/requirements-installed.txt
echo
# Install test dependencies, for CI.
if [ "$INSTALL_TEST" ]; then
if [[ -f "$1/requirements-test.txt" ]]; then
puts-step "Installing test dependencies…"
/app/.heroku/python/bin/pip install -r "$1/requirements-test.txt" --exists-action=w --src=./.heroku/src --disable-pip-version-check --no-cache-dir 2>&1 | cleanup | indent
fi
fi
fi
+8 -13
View File
@@ -2,24 +2,19 @@
set +e
# Install dependencies with Pip.
# shellcheck source=bin/utils
source $BIN_DIR/utils
if [ ! "$SKIP_PIP_INSTALL" ]; then
if [[ -f .heroku/python/requirements-declared.txt ]]; then
if [[ -f .heroku/python/requirements-declared.txt ]]; then
cp .heroku/python/requirements-declared.txt requirements-declared.txt
cp .heroku/python/requirements-declared.txt requirements-declared.txt
pip-diff --stale requirements-declared.txt requirements.txt --exclude setuptools pip wheel > .heroku/python/requirements-stale.txt
pip-diff --stale requirements-declared.txt requirements.txt --exclude setuptools pip wheel > .heroku/python/requirements-stale.txt
rm -fr requirements-declared.txt
rm -fr requirements-declared.txt
if [[ -s .heroku/python/requirements-stale.txt ]]; then
puts-step "Uninstalling stale dependencies"
/app/.heroku/python/bin/pip uninstall -r .heroku/python/requirements-stale.txt -y --exists-action=w | cleanup | indent
fi
if [[ -s .heroku/python/requirements-stale.txt ]]; then
puts-step "Uninstalling stale dependencies"
/app/.heroku/python/bin/pip uninstall -r .heroku/python/requirements-stale.txt -y --exists-action=w | cleanup | indent
fi
fi
set -e
Executable → Regular
+19 -66
View File
@@ -2,75 +2,28 @@
# export CLINT_FORCE_COLOR=1
# export PIPENV_FORCE_COLOR=1
# shellcheck source=bin/utils
source $BIN_DIR/utils
# Pipenv support (Generate requriements.txt with pipenv).
if [[ -f Pipfile ]]; then
if [[ ! -f requirements.txt ]]; then
puts-step "Installing requirements with latest Pipenv…"
if [[ -f Pipfile.lock ]]; then
if [[ -f .heroku/python/Pipfile.lock.sha256 ]]; then
if [[ $(openssl dgst -sha256 Pipfile.lock) == $(cat .heroku/python/Pipfile.lock.sha256) ]]; then
if [[ ! "$PIPENV_ALWAYS_INSTALL" ]]; then
echo "Skipping installation, as Pipfile.lock hasn't changed since last deploy." | indent
echo "To disable this functionality, run the following command:"
echo ""
echo " $ heroku config:set PIPENV_ALWAYS_INSTALL=1" | indent
# Install pipenv.
/app/.heroku/python/bin/pip install pipenv --upgrade &> /dev/null
SKIP_PIPENV_INSTALL=1
fi
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 --deploy 2>&1 | indent
fi
# Install the dependencies.
# Skip pip install, later.
export SKIP_PIP_INSTALL=1
# Pip freeze, for compatibility.
/app/.heroku/python/bin/pip freeze > requirements.txt
fi
fi
if [ ! "$SKIP_PIPENV_INSTALL" ]; then
# Pipenv support (Generate requriements.txt with pipenv).
if [[ -f Pipfile ]]; then
if [[ ! -f requirements.txt ]]; then
puts-step "Installing requirements with latest Pipenv…"
# Measure that we're using Pipenv.
mcount "tool.pipenv"
# Set PIP_EXTRA_INDEX_URL
if [[ -r $ENV_DIR/PIP_EXTRA_INDEX_URL ]]; then
PIP_EXTRA_INDEX_URL="$(cat "$ENV_DIR/PIP_EXTRA_INDEX_URL")"
export PIP_EXTRA_INDEX_URL
fi
# if [[ -f .heroku/python/requirements-declared.txt ]]; then
# cp .heroku/python/requirements-declared.txt requirements.txt
# fi
# Install pipenv.
/app/.heroku/python/bin/pip install pipenv --upgrade &> /dev/null
# Install the dependencies.
if [[ ! -f Pipfile.lock ]]; then
/app/.heroku/python/bin/pipenv install --system --skip-lock 2>&1 | indent
else
pipenv-to-pip Pipfile.lock > requirements.txt
"$BIN_DIR/steps/pip-uninstall"
cp requirements.txt .heroku/python/requirements-declared.txt
openssl dgst -sha256 Pipfile.lock > .heroku/python/Pipfile.lock.sha256
/app/.heroku/python/bin/pipenv install --system --deploy 2>&1 | indent
fi
# Install the test dependencies, for CI.
if [ "$INSTALL_TEST" ]; then
puts-step "Installing test dependencies…"
/app/.heroku/python/bin/pipenv install --dev --system --deploy 2>&1 | cleanup | indent
fi
# Skip pip install, later.
export SKIP_PIP_INSTALL=1
# Pip freeze, for compatibility.
pip freeze > requirements.txt
fi
fi
else
pipenv-to-pip Pipfile.lock > requirements.txt
export SKIP_PIP_INSTALL=1
fi
+2 -2
View File
@@ -19,10 +19,10 @@ if [[ -f $BUILD_DIR/Pipfile ]]; then
if [[ "$PYTHON" == "null" ]]; then
PYTHON=$(jq -r '._meta.requires.python_version' "$BUILD_DIR/Pipfile.lock")
if [ "$PYTHON" = 2.7 ]; then
echo "$LATEST_2" > "$BUILD_DIR/runtime.txt"
echo "python-2.7.14" > "$BUILD_DIR/runtime.txt"
fi
if [ "$PYTHON" = 3.6 ]; then
echo "$LATEST_3" > "$BUILD_DIR/runtime.txt"
echo "python-3.6.2" > "$BUILD_DIR/runtime.txt"
fi
fi
+1 -1
View File
@@ -15,7 +15,7 @@ if [[ "$STACK" == "heroku-16" ]]; then
fi
# The location of the pre-compiled libmemcached binary.
VENDORED_MEMCACHED="${VENDOR_URL}/libraries/vendor/libmemcache.tar.gz"
VENDORED_MEMCACHED="https://lang-python.s3.amazonaws.com/$STACK/libraries/vendor/libmemcache.tar.gz"
# Syntax sugar.
# shellcheck source=bin/utils
+1 -4
View File
@@ -4,9 +4,6 @@ set +e
runtime-fixer runtime.txt
PYTHON_VERSION=$(cat runtime.txt)
# The location of the pre-compiled python binary.
VENDORED_PYTHON="${VENDOR_URL}/runtimes/$PYTHON_VERSION.tar.gz"
if [[ $PYTHON_VERSION =~ ^python-2 ]]; then
if [[ "$PYTHON_VERSION" != "$LATEST_2" ]]; then
puts-warn "The latest version of Python 2 is $LATEST_2 (you are using $PYTHON_VERSION, which is unsupported)."
@@ -44,7 +41,7 @@ if [ ! "$SKIP_INSTALL" ]; then
mcount "version.python.$PYTHON_VERSION"
if ! curl "${VENDORED_PYTHON}" -s | tar zxv -C .heroku/python &> /dev/null; then
if ! curl "https://lang-python.s3.amazonaws.com/$STACK/runtimes/$PYTHON_VERSION.tar.gz" -s | tar zxv -C .heroku/python &> /dev/null; then
puts-warn "Requested runtime ($PYTHON_VERSION) is not available for this stack ($STACK)."
puts-warn "Aborting. More info: https://devcenter.heroku.com/articles/python-support"
exit 1
+4 -4
View File
@@ -6,8 +6,8 @@ BIN_DIR=$(cd "$(dirname "$0")" || return; pwd) # absolute path
# shellcheck source=bin/utils
source "$BIN_DIR/utils"
# Locale support for Pipenv.
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
DISABLE_COLLECTSTATIC=1 "$(dirname "${0:-}")/compile" "$1" "$2" "$3"
DISABLE_COLLECTSTATIC=1 INSTALL_TEST=1 "$(dirname "${0:-}")/compile" "$1" "$2" "$3"
if [[ -f "$1/requirements-test.txt" ]]; then
/app/.heroku/python/bin/pip install -r "$1/requirements-test.txt" --exists-action=w --src=./.heroku/src --disable-pip-version-check --no-cache-dir 2>&1 | cleanup | indent
fi
-21
View File
@@ -1,21 +0,0 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
# Build Deps: libraries/sqlite
OUT_PREFIX=$1
echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.6.3/Python-3.6.3.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.6.3 src
cd src
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
make
make install
# Remove unneeded test directories, similar to the official Docker Python images:
# https://github.com/docker-library/python
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
-21
View File
@@ -1,21 +0,0 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
# Build Deps: libraries/sqlite
OUT_PREFIX=$1
echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.6.4/Python-3.6.4.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.6.4 src
cd src
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
make
make install
# Remove unneeded test directories, similar to the official Docker Python images:
# https://github.com/docker-library/python
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
+1 -1
View File
@@ -6,4 +6,4 @@ verify_ssl = true
requests = "*"
[requires]
python_full_version = "3.6.3"
python_full_version = "3.6.2"
+9 -9
View File
@@ -1,24 +1,24 @@
{
"_meta": {
"hash": {
"sha256": "22a052f4d1cfe6518b2f236fe45c3208c587a9ab1323bdd390632e27278b541e"
"sha256": "8f9e3d5a2863652d7495f17427a33383b3bd9ebd55d331be41fee3cf8631bcd3"
},
"host-environment-markers": {
"implementation_name": "cpython",
"implementation_version": "3.6.3",
"implementation_version": "3.6.2",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_python_implementation": "CPython",
"platform_release": "16.7.0",
"platform_release": "17.0.0",
"platform_system": "Darwin",
"platform_version": "Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64",
"python_full_version": "3.6.3",
"platform_version": "Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64",
"python_full_version": "3.6.2",
"python_version": "3.6",
"sys_platform": "darwin"
},
"pipfile-spec": 6,
"requires": {
"python_full_version": "3.6.3"
"python_full_version": "3.6.2"
},
"sources": [
{
@@ -30,10 +30,10 @@
"default": {
"certifi": {
"hashes": [
"sha256:244be0d93b71e93fc0a0a479862051414d0e00e16435707e5bf5000f92e04694",
"sha256:5ec74291ca1136b40f0379e1128ff80e866597e4e2c1e755739a913bbc3613c0"
"sha256:54a07c09c586b0e4c619f02a5e94e36619da8e2b053e20f594348c0611803704",
"sha256:40523d2efb60523e113b44602298f0960e900388cf3bb6043f645cf57ea9e3f5"
],
"version": "==2017.11.5"
"version": "==2017.7.27.1"
},
"chardet": {
"hashes": [
+2 -2
View File
@@ -5,14 +5,14 @@
},
"host-environment-markers": {
"implementation_name": "cpython",
"implementation_version": "3.6.3",
"implementation_version": "3.6.2",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_python_implementation": "CPython",
"platform_release": "16.7.0",
"platform_system": "Darwin",
"platform_version": "Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64",
"python_full_version": "3.6.3",
"python_full_version": "3.6.2",
"python_version": "3.6",
"sys_platform": "darwin"
},
+3 -3
View File
@@ -12,13 +12,13 @@ testPipenvLock() {
testPipenvVersion() {
compile "pipenv-version"
assertCaptured "3.6.4"
assertCaptured "3.6.2"
assertCapturedSuccess
}
testPipenvFullVersion() {
compile "pipenv-full-version"
assertCaptured "3.6.3"
assertCaptured "3.6.2"
assertCapturedSuccess
}
@@ -78,7 +78,7 @@ testPython2() {
testPython3() {
compile "python3"
assertCaptured "python-3.6.4"
assertCaptured "python-3.6.2"
assertCapturedSuccess
}
+3 -3
View File
@@ -25,9 +25,9 @@ SHUNIT_ERROR=2
# enable strict mode by default
SHUNIT_STRICT=${SHUNIT_STRICT:-${SHUNIT_TRUE}}
_shunit_warn() { echo "shunit2:WARN $*" >&2; }
_shunit_error() { echo "shunit2:ERROR $*" >&2; }
_shunit_fatal() { echo "shunit2:FATAL $*" >&2; exit ${SHUNIT_ERROR}; }
_shunit_warn() { echo "shunit2:WARN $@" >&2; }
_shunit_error() { echo "shunit2:ERROR $@" >&2; }
_shunit_fatal() { echo "shunit2:FATAL $@" >&2; exit ${SHUNIT_ERROR}; }
# specific shell checks
if [ -n "${ZSH_VERSION:-}" ]; then
+1 -1
View File
@@ -36,7 +36,7 @@ capture()
LAST_COMMAND="$@"
"$@" >${STD_OUT} 2>${STD_ERR}
$@ >${STD_OUT} 2>${STD_ERR}
RETURN=$?
rtrn=${RETURN} # deprecated
}
-1
View File
@@ -41,7 +41,6 @@ class Requirements(object):
if not getattr(requirement.req, 'name', None):
# Prior to pip 8.1.2 the attribute `name` did not exist.
requirement.req.name = requirement.req.project_name
requirement.req.name = requirement.req.name.lower()
self.requirements.append(requirement.req)
-26
View File
@@ -1,26 +0,0 @@
#!/usr/bin/env python
import json
import sys
def main():
INFILE = sys.argv[1]
with open(INFILE, 'rb') as f:
lockfile = json.load(f)
packages = []
for package in lockfile.get('default', {}):
try:
packages.append('{0}{1}'.format(package, lockfile['default'][package]['version']))
except KeyError:
pass
print('\n'.join(packages))
try:
main()
except Exception:
pass
-3
View File
@@ -1,5 +1,2 @@
# Automatic configuration for Gunicorn's ForwardedAllowIPS setting.
export FORWARDED_ALLOW_IPS='*'
# Automatic configuration for Gunicorn's stdout access log setting.
export GUNICORN_CMD_ARGS=${GUNICORN_CMD_ARGS:-"--access-logfile -"}
+3 -3
View File
@@ -25,9 +25,9 @@ SHUNIT_ERROR=2
# enable strict mode by default
SHUNIT_STRICT=${SHUNIT_STRICT:-${SHUNIT_TRUE}}
_shunit_warn() { echo "shunit2:WARN $*" >&2; }
_shunit_error() { echo "shunit2:ERROR $*" >&2; }
_shunit_fatal() { echo "shunit2:FATAL $*" >&2; exit ${SHUNIT_ERROR}; }
_shunit_warn() { echo "shunit2:WARN $@" >&2; }
_shunit_error() { echo "shunit2:ERROR $@" >&2; }
_shunit_fatal() { echo "shunit2:FATAL $@" >&2; exit ${SHUNIT_ERROR}; }
# specific shell checks
if [ -n "${ZSH_VERSION:-}" ]; then
+1 -1
View File
@@ -36,7 +36,7 @@ capture()
LAST_COMMAND="$@"
"$@" >${STD_OUT} 2>${STD_ERR}
$@ >${STD_OUT} 2>${STD_ERR}
RETURN=$?
rtrn=${RETURN} # deprecated
}