mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
fcf696b835
This adds support for the upcoming Heroku-20 stack. The Heroku-20 Dockerfile is identical to that for Heroku-18, other than the base image, and stack-related env var changes. The initial Python versions made available will be those in: https://devcenter.heroku.com/articles/python-support#supported-runtimes https://devcenter.heroku.com/articles/python-support#supported-pypy-runtimes ...minus CPython 2.7, since it's EOL. Which are: * `python-3.6.12` * `python-3.7.9` * `python-3.8.6` * `python-3.9.0` * `pypy2.7-7.3.2` * `pypy3.6-7.3.2` Note: Unlike CPython 2.7, the PyPy 2.7 branch is still supported: https://doc.pypy.org/en/latest/faq.html#how-long-will-pypy-support-python2 In addition, I've generated binaries for each patch release immediately prior to the latest versions (with the exception of 3.9.0, since there isn't one), otherwise it's not possible to run the "out of date Python" warning tests. The binaries were generated using the process here: https://github.com/heroku/heroku-buildpack-python/blob/main/builds/README.md Specifically: ``` make deploy-runtimes STACKS='heroku-20' \ RUNTIMES='python-3.6.11 python-3.6.12 python-3.7.8 python-3.7.9 python-3.8.5 python-3.8.6 python-3.9.0 pypy2.7-7.3.1 pypy2.7-7.3.2 pypy3.6-7.3.1 pypy3.6-7.3.2' \ ENV_FILE=... ``` Binaries for the GDAL/GEOS/PROJ feature have not been generated, since it's deprecated and due for removal shortly: https://help.heroku.com/D5INLB1A/python-s-build_with_geo_libraries-legacy-feature-is-now-deprecated Note: Like the Python 3.9.0 release, this uses the new S3 bucket, so apps will need to be using a recent version of the buildpack in order to build on Heroku-20: https://devcenter.heroku.com/articles/python-support#checking-the-python-buildpack-version Closes @W-7485877@.
82 lines
2.3 KiB
Bash
Executable File
82 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Default Python Versions
|
|
# shellcheck source=bin/default_pythons
|
|
source "bin/default_pythons"
|
|
|
|
testAirflow() {
|
|
local env_dir="$(mktmpdir)"
|
|
echo 'yes' > "${env_dir}/SLUGIFY_USES_TEXT_UNIDECODE"
|
|
compile 'airflow' '' "${env_dir}"
|
|
assertCaptured "apache-airflow==1.10.2"
|
|
assertCapturedSuccess
|
|
}
|
|
|
|
testCollectstatic() {
|
|
compile "collectstatic"
|
|
assertCaptured "collectstatic"
|
|
}
|
|
|
|
testGEOS() {
|
|
local env_dir="$(mktmpdir)"
|
|
echo '1' > "${env_dir}/BUILD_WITH_GEO_LIBRARIES"
|
|
compile 'geos' '' "${env_dir}"
|
|
if [[ $STACK == "heroku-20" ]]; then
|
|
assertCaptured " ! The GDAL, GEOS and PROJ binaries and BUILD_WITH_GEO_LIBRARIES functonality is not supported on Heroku-20."
|
|
else
|
|
assertCaptured " ! The GDAL, GEOS and PROJ binaries and BUILD_WITH_GEO_LIBRARIES functonality are now deprecated."
|
|
fi
|
|
# This should assertCapturedError on Heroku-20, but the test doesn't actually
|
|
# install anything that uses GEOS so succeeds (see W-8145375)
|
|
assertCapturedSuccess
|
|
}
|
|
|
|
testNLTK() {
|
|
local env_dir="$(mktmpdir)"
|
|
# NOTE: This is a RuntimeWarning emitted by Python 3's runpy.py script
|
|
# which is what is used when you call `python -m <module>`. This is due to
|
|
# how nltk imports things. It's not actually an error, but it would probably
|
|
# be bad to silence in Production.
|
|
echo 'ignore::RuntimeWarning' > "${env_dir}/PYTHONWARNINGS"
|
|
compile 'nltk' '' "${env_dir}"
|
|
assertCaptured "[nltk_data] Downloading package city_database" "STD_ERR"
|
|
# Can't use `assertCapturedSuccess` since the NLTK downloader outputs all
|
|
# progress/status messages to stderr (W-8146040).
|
|
assertCapturedSuccessWithStdErr
|
|
}
|
|
|
|
testPsycopg2() {
|
|
compile "psycopg2"
|
|
assertCaptured "psycopg2"
|
|
assertCapturedSuccess
|
|
}
|
|
|
|
testPysqlite() {
|
|
# pysqlite does not support Python 3 (since the sqlite3 stdlib can be used there),
|
|
# so we have to test with Python 2, which we've not made available for Heroku-20.
|
|
if [[ $STACK == "heroku-20" ]]; then
|
|
return
|
|
fi
|
|
compile "pysqlite"
|
|
assertCaptured "pysqlite"
|
|
assertCapturedSuccess
|
|
}
|
|
|
|
testCffi() {
|
|
compile "cffi"
|
|
assertCaptured "cffi"
|
|
assertCapturedSuccess
|
|
}
|
|
|
|
testPylibmc() {
|
|
compile "pylibmc"
|
|
assertCaptured "pylibmc"
|
|
assertCapturedSuccess
|
|
}
|
|
|
|
pushd $(dirname 0) >/dev/null
|
|
popd >/dev/null
|
|
|
|
source $(pwd)/test/utils
|
|
source $(pwd)/test/shunit2
|