Compare commits

...

74 Commits

Author SHA1 Message Date
Casey 96ffc147d4 Merge pull request #831 from heroku/remove-cedar-tests
Remove cedar tests
2019-08-21 16:20:22 -07:00
Casey Faist 4063e9d22e remove cedar 14 make test command, as cedar is deprecated 2019-08-21 15:45:18 -07:00
Casey Faist 751413168b remove cedar 14 travis tests 2019-08-21 15:44:46 -07:00
Casey 527ea604c8 Merge pull request #829 from josegonzalez/heroku-18-build
feat: add docs and make target for heroku-18 bob builds
2019-08-21 15:41:30 -07:00
Jose Diaz-Gonzalez 302c2f0432 feat: add docs and make target for heroku-18 bob builds 2019-08-15 17:36:40 -04:00
David Zülke 14c7e26f7a Merge pull request #827 from heroku/fix-python-3-5-7
Fix Python 3.5.7
2019-07-17 21:55:48 +02:00
David Zuelke 58e664a9e3 avoid service restart prompt during Dockerfile builds
https://unix.stackexchange.com/questions/146283/how-to-prevent-prompt-that-ask-to-restart-services-when-installing-libpq-dev
2019-07-17 02:22:10 +02:00
David Zuelke e965516197 fix python 3.5.7 formula actually building 3.7.2 2019-07-17 01:55:46 +02:00
David Zuelke 8775cb821c CHANGELOG for v153 2019-07-17 01:43:54 +02:00
Casey 9dcabe24a5 Merge pull request #826 from heroku/hotfix-sqlite3-heroku-16
HOTFIX heroku-16 builds with sqlite3
2019-06-21 10:43:28 -07:00
David Zuelke 38f9a41a54 HOTFIX heroku-16 builds with sqlite3
upstream version has changed to 3.11.0-1ubuntu1.2, but local package version is still on 3.11.0-1ubuntu1.1, so the download fails otherwise
2019-06-21 19:17:22 +02:00
Casey 53e33bdf91 Merge pull request #814 from heroku/v-152
Python 3.7.3 release
2019-04-04 15:41:29 -07:00
Casey Faist 5337dd592b remove test case for deprecated pythons on deprecated stack 2019-04-04 14:04:10 -07:00
Casey Faist de8ae808d9 changelog date corrected 2019-04-04 13:26:55 -07:00
Casey Faist 2a7e85be85 update CHANGELOG 2019-04-03 15:32:26 -07:00
Casey Faist 7654d13f8b fix test blindspot 2019-04-03 15:28:35 -07:00
Casey Faist 9d3639685a add new python and update default 2019-04-03 09:12:44 -07:00
Casey 76bb572a4d Release prep 151 (#813)
* new runtimes

* update default latest
2019-03-21 10:54:12 -07:00
Casey 8db4a79392 changelog 150 update (#810) 2019-03-14 11:40:14 -07:00
Casey 21430070ad Python release prep (#809)
* new recipe for new runtime

* add new runtime formula

* add test updates for new runtime release

* wrangle tests into submission

* update tests to use default_pythons

* delete commented code
2019-03-13 12:25:03 -07:00
Casey 20bbb3f54d changelog update for v149 (#806) 2019-03-11 11:51:07 -07:00
Casey bebc0cf439 Python 2.7.16 (#808)
* new recipe for new runtime

* add new runtime formula

* wrangle tests into submission
2019-03-11 13:22:29 -04:00
David Zülke c361c2ffc4 HOTFIX for cedar-14 python builds (#805) 2019-03-04 14:46:33 -08:00
Casey 13d2a58add update changelog (#803) 2019-02-21 15:24:08 -08:00
Casey 49e9147439 track usage of older feature steps (#802)
* track usage of older feature steps

* remove typo whitespace

* make buildvars consistently cased
2019-02-21 14:06:20 -08:00
Casey 3c0146c0b9 Merge pull request #797 from heroku/v-147
V 147
2019-02-12 13:01:43 -06:00
Casey Faist 53c7d61291 correct date mixup + update changelog 2019-02-07 12:35:25 -05:00
Casey Faist 797652a75d new runtimes and travis test updates 2019-01-31 14:46:42 -05:00
Casey Faist d7351513c7 changelog and test update 2018-12-12 17:26:28 -05:00
Casey fe029af603 Merge pull request #785 from heroku/update-readme
Update readme
2018-12-12 10:20:01 -05:00
Casey dd8fe58de1 Merge pull request #784 from heroku/update-changelog
update changelog
2018-12-12 10:19:24 -05:00
Casey Faist a979d57a20 update readme 2018-11-15 17:41:01 -06:00
Casey Faist 3cb8db7e2e update release date 2018-11-15 17:31:29 -06:00
Casey Faist 16cce92342 update changelog 2018-11-15 16:59:51 -06:00
Casey b85fe3614c Merge pull request #783 from heroku/document-tests
Document tests
2018-11-15 12:41:15 -06:00
Hunter Loftis b024e644d1 Merge branch 'master' of github.com:heroku/heroku-buildpack-python into document-tests 2018-11-15 12:45:28 -05:00
Casey 41e0f64252 Merge pull request #782 from heroku/next-release
Test updates
2018-11-15 11:06:27 -06:00
Hunter Loftis 3a0d4c18bf add heroku-18 to test targets and document running tests 2018-11-15 11:57:44 -05:00
Casey Faist b3988a565a remove template runtimes to cut down on scope creep 2018-11-15 10:39:19 -06:00
Casey Faist 0437a6e84f update latest python 2 in pipenv-version step 2018-11-15 09:37:43 -06:00
Casey Faist 88a5ba5d39 add test for 2.7 pipenv install 2018-11-15 09:09:51 -06:00
Casey Faist 3434972e32 update hatchet expected version 2018-11-15 08:57:57 -06:00
Casey Faist 1dfef44085 update default in pipenv test 2018-11-14 17:36:59 -06:00
Casey Faist 2ffb10da34 update latest vars in compile 2018-11-14 16:57:02 -06:00
Casey Faist 23999846ad update 3.7 tests typo 2018-11-14 16:41:38 -06:00
Casey Faist 8d1ebf7288 bump default 3.6 version 2018-11-14 16:24:46 -06:00
Casey Faist f2165aaac6 update test fixtures for new python runtimes 2018-11-13 16:11:14 -06:00
Casey Faist 05492e132a add next runtimes 2018-11-13 15:34:07 -06:00
Casey 62eaae35a4 Merge pull request #781 from heroku/update-hatchet-setup
Update to reflect Hatchet updates
2018-11-13 14:36:24 -06:00
Duane Hutchins 2f32c5418d Updated HATCHET_BUILDPACK_BASE to use TRAVIS_REPO_SLUG 2018-11-13 13:58:23 -06:00
Casey Faist 12e3a7f3e7 add HATCHET_DEPLOY_STRATEGY env var 2018-11-13 13:48:38 -06:00
Casey Faist e7da63f722 update to newer hatchet integration 2018-11-13 13:05:31 -06:00
Casey a6452a1ce4 Merge pull request #772 from heroku/v-145
V 145
2018-11-12 18:49:06 -06:00
Casey Faist 0b554f660f update tests for missed stack issues 2018-11-12 17:27:07 -06:00
Casey Faist 7b9e82175e add warning detection and per-stack checks 2018-11-12 17:10:30 -06:00
Casey Faist 73d37cbac6 update changelog 2018-11-11 17:52:16 -06:00
Casey Faist 9e1df4bbb5 specify python 2.7 2018-11-11 17:24:42 -06:00
Casey Faist 0be9d48013 add missing vars for python step 2018-11-11 16:51:29 -06:00
Casey Faist 4750639a0d add python 3.4 detection 2018-11-11 16:38:12 -06:00
Casey Faist 3de5b43447 add bash pre-commit hook and correct shellcheck warnings 2018-11-11 16:36:16 -06:00
Casey Faist c3845fff9a use text variable as variable in puts-warn 2018-11-11 15:43:21 -06:00
Casey Faist f3ef152624 update tests to pass, add 3.4 2018-11-11 15:34:49 -06:00
Jose Diaz-Gonzalez ef1f7f6924 fix: drop broken version check
Due to how the version checks work - via sorting, not actual comparison - this previously resulted in _always_ installing sqlite3, even though it was already bundled for lower versions of python. The second version check also encompasses 3.7.0+, so there is no need to respecify the check.
2018-11-08 16:14:05 -06:00
Casey Faist 25818765ee update changelog 2018-11-08 15:54:45 -06:00
Casey Faist 0a169e76a4 fix extra slash in python install location 2018-11-08 13:54:44 -06:00
Casey Faist 2f430abf07 adjust sqlcheck 2018-11-08 13:54:44 -06:00
Casey Faist 07241cd751 add tests for new runtimes 2018-11-08 13:54:44 -06:00
Casey Faist ae4713efd8 add new runtimes and test repos 2018-11-08 13:54:44 -06:00
Casey 402cd8253e Merge pull request #777 from heroku/use-heroku-bob
update bob dependency to point to internal bob-builder fork
2018-11-08 13:54:03 -06:00
Casey aa593f127b delete tester runtime.txt
Added this for local testing because bob requires 2.7, should not be merged to master
2018-11-08 10:23:23 -06:00
Casey Faist 67badb1829 use released bob package 2018-11-08 09:23:05 -06:00
Casey Faist defa85c355 delete me later 2018-11-07 11:18:26 -06:00
Casey Faist ec364be161 remove comment 2018-11-06 17:47:38 -06:00
Casey Faist 7b4d6b5587 update bob dependency to point to internal bob-builder fork 2018-11-06 17:41:10 -06:00
70 changed files with 761 additions and 135 deletions
+5
View File
@@ -0,0 +1,5 @@
repos:
- repo: git://github.com/detailyang/pre-commit-shell
rev: 1.0.4
hooks:
- id: shell-lint
+2 -10
View File
@@ -5,16 +5,11 @@ rvm:
- 2.4.4 - 2.4.4
before_script: before_script:
- gem install bundler -v 1.16.2 - gem install bundler -v 1.16.2
- bundle exec rake hatchet:setup_travis - bundle exec hatchet ci:setup
before_install:
- sudo bash etc/ci-setup.sh
jobs: jobs:
include: include:
- stage: Bash linting (shellcheck) - stage: Bash linting (shellcheck)
sudo: false sudo: false
before_install:
- wget -c https://goo.gl/ZzKHFv -O - | tar -xvJ -C /tmp/
- PATH="/tmp/shellcheck-latest:$PATH"
script: make check script: make check
- stage: Stack Unit Tests - stage: Stack Unit Tests
services: docker services: docker
@@ -24,10 +19,6 @@ jobs:
services: docker services: docker
env: STACK=heroku-16 env: STACK=heroku-16
script: "./tests.sh" script: "./tests.sh"
- stage: Stack Unit Tests
services: docker
env: STACK=cedar-14
script: "./tests.sh"
- stage: Hatchet Integration - stage: Hatchet Integration
script: "bundle exec rspec" script: "bundle exec rspec"
env: env:
@@ -35,5 +26,6 @@ env:
- HATCHET_RETRIES=3 - HATCHET_RETRIES=3
- IS_RUNNING_ON_CI=true - IS_RUNNING_ON_CI=true
- HATCHET_APP_LIMIT=5 - HATCHET_APP_LIMIT=5
- HATCHET_DEPLOY_STRATEGY=git
- secure: yjtlPE5FbVxTKnjUy/tZUBgSEf4qADD3QOxtgziuid73S0U/1IEXlMGFULsQzIjtlHKmHeywZqpVVEpthIH4RuT7uoX1Pb7SSM/g0T8fT3VoEFbFK1uYl0oZQbUS4Klxv9tPiumj8if3m6ULEGIz1X0wZcMOC0tMLwVCnwmap0E= - secure: yjtlPE5FbVxTKnjUy/tZUBgSEf4qADD3QOxtgziuid73S0U/1IEXlMGFULsQzIjtlHKmHeywZqpVVEpthIH4RuT7uoX1Pb7SSM/g0T8fT3VoEFbFK1uYl0oZQbUS4Klxv9tPiumj8if3m6ULEGIz1X0wZcMOC0tMLwVCnwmap0E=
- secure: ZeFTHWwnpIKE9nAqs88ocmiQh7bKce84lilGm5J23nf3N6V4wNyLwqlkvsM008WGBCaOg9AUx7ZunasT0ANsR5gLP3eV2UUg7ILdRgV2Gy13eNRFheC4PHdN92RqQ3aKoqlIv2K999xlhVjod0NzhkQQXB6PddfQINbuU7ks6As= - secure: ZeFTHWwnpIKE9nAqs88ocmiQh7bKce84lilGm5J23nf3N6V4wNyLwqlkvsM008WGBCaOg9AUx7ZunasT0ANsR5gLP3eV2UUg7ILdRgV2Gy13eNRFheC4PHdN92RqQ3aKoqlIv2K999xlhVjod0NzhkQQXB6PddfQINbuU7ks6As=
+47 -3
View File
@@ -1,19 +1,63 @@
# Python Buildpack Changelog # Python Buildpack Changelog
# 141 (2018-10-10) # 154 (2019-07-17)
Fix python 3.5.7 formula actually building 3.7.2
# 153 (2019-06-21)
Hotfix for broken heroku-16 deploys
# 152 (2019-04-04)
Python 3.7.3 now available.
# 151 (2019-03-21)
Python 3.5.7 and 3.4.10 now available on all Heroku stacks.
# 150 (2019-03-13)
Python 2.7.16 now available on all Heroku stacks.
# 149 (2019-03-04)
Hotfix for broken Cedar 14 deploys
# 148 (2019-02-21)
No user facing changes, improving internal metrics
# 147 (2019-02-07)
Python 3.7.2 and 3.6.8 now available on all Heroku stacks.
# 146 (2018-11-11)
Python 3.7.1, 3.6.7, 3.5.6 and 3.4.9 now available on all Heroku stacks.
# 145 (2018-11-08)
Testing and tooling expanded to better support new runtimes
# 144 (2018-10-10)
Switch to cautious upgrade for Pipenv install to ensure the pinned pip version Switch to cautious upgrade for Pipenv install to ensure the pinned pip version
is used with Pipenv is used with Pipenv
# 140 (2018-10-09) # 143 (2018-10-09)
Add support for detecting SLUGIFY_USES_TEXT_UNIDECODE, which is required to Add support for detecting SLUGIFY_USES_TEXT_UNIDECODE, which is required to
install Apache Airflow version 1.10 or higher. install Apache Airflow version 1.10 or higher.
# 139 (2018-10-08) # 142 (2018-10-08)
Improvements to Python install messaging Improvements to Python install messaging
# 139, 140, 141
No user-facing changes, documenting for version clarity
# 138 (2018-08-01) # 138 (2018-08-01)
Use stack image SQLite3 instead of vendoring Use stack image SQLite3 instead of vendoring
+2 -1
View File
@@ -3,7 +3,8 @@ FROM heroku/heroku:16-build
WORKDIR /app WORKDIR /app
ENV WORKSPACE_DIR="/app/builds" \ ENV WORKSPACE_DIR="/app/builds" \
S3_BUCKET="lang-python" \ S3_BUCKET="lang-python" \
S3_PREFIX="heroku-16/" S3_PREFIX="heroku-16/" \
DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y python-pip && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y python-pip && rm -rf /var/lib/apt/lists/*
+2 -1
View File
@@ -3,7 +3,8 @@ FROM heroku/heroku:18-build
WORKDIR /app WORKDIR /app
ENV WORKSPACE_DIR="/app/builds" \ ENV WORKSPACE_DIR="/app/builds" \
S3_BUCKET="lang-python" \ S3_BUCKET="lang-python" \
S3_PREFIX="heroku-18/" S3_PREFIX="heroku-18/" \
DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y python-pip && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y python-pip && rm -rf /var/lib/apt/lists/*
+9 -9
View File
@@ -6,16 +6,16 @@ GEM
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
minitest (~> 5.1) minitest (~> 5.1)
tzinfo (~> 1.1) tzinfo (~> 1.1)
concurrent-ruby (1.0.5) concurrent-ruby (1.1.3)
diff-lcs (1.3) diff-lcs (1.3)
erubis (2.7.0) erubis (2.7.0)
excon (0.62.0) excon (0.62.0)
heroics (0.0.24) heroics (0.0.25)
erubis (~> 2.0) erubis (~> 2.0)
excon excon
moneta moneta
multi_json (>= 1.9.2) multi_json (>= 1.9.2)
heroku_hatchet (4.0.2) heroku_hatchet (4.0.6)
excon (~> 0) excon (~> 0)
minitest-retry (~> 0.1.9) minitest-retry (~> 0.1.9)
platform-api (~> 2) platform-api (~> 2)
@@ -23,16 +23,16 @@ GEM
rrrretry (~> 1) rrrretry (~> 1)
thor (~> 0) thor (~> 0)
threaded (~> 0) threaded (~> 0)
i18n (1.1.0) i18n (1.1.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
minitest (5.11.3) minitest (5.11.3)
minitest-retry (0.1.9) minitest-retry (0.1.9)
minitest (>= 5.0) minitest (>= 5.0)
moneta (0.8.1) moneta (1.0.0)
multi_json (1.13.1) multi_json (1.13.1)
platform-api (2.1.0) platform-api (2.2.0)
heroics (~> 0.0.23) heroics (~> 0.0.25)
moneta (~> 0.8.1) moneta (~> 1.0.0)
rake (12.3.1) rake (12.3.1)
repl_runner (0.0.3) repl_runner (0.0.3)
activesupport activesupport
@@ -52,7 +52,7 @@ GEM
rspec-retry (0.6.1) rspec-retry (0.6.1)
rspec-core (> 3.3) rspec-core (> 3.3)
rspec-support (3.8.0) rspec-support (3.8.0)
thor (0.20.0) thor (0.20.3)
thread_safe (0.3.6) thread_safe (0.3.6)
threaded (0.0.4) threaded (0.0.4)
tzinfo (1.2.5) tzinfo (1.2.5)
+15 -7
View File
@@ -1,18 +1,13 @@
# These targets are not files # These targets are not files
.PHONY: tests .PHONY: tests
test: test-heroku-16 test: test-heroku-18 test-heroku-16
check: check:
@shellcheck -x bin/compile bin/detect bin/release bin/test-compile bin/utils bin/warnings @shellcheck -x bin/compile bin/detect bin/release bin/test-compile bin/utils bin/warnings bin/default_pythons
@shellcheck -x bin/steps/collectstatic bin/steps/eggpath-fix bin/steps/eggpath-fix2 bin/steps/gdal bin/steps/geo-libs bin/steps/mercurial bin/steps/nltk bin/steps/pip-install bin/steps/pip-uninstall bin/steps/pipenv bin/steps/pipenv-python-version bin/steps/pylibmc bin/steps/python @shellcheck -x bin/steps/collectstatic bin/steps/eggpath-fix bin/steps/eggpath-fix2 bin/steps/gdal bin/steps/geo-libs bin/steps/mercurial bin/steps/nltk bin/steps/pip-install bin/steps/pip-uninstall bin/steps/pipenv bin/steps/pipenv-python-version bin/steps/pylibmc bin/steps/python
@shellcheck -x bin/steps/hooks/* @shellcheck -x bin/steps/hooks/*
test-cedar-14:
@echo "Running tests in docker (cedar-14)..."
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=cedar-14" heroku/cedar:14 bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
@echo ""
test-heroku-16: test-heroku-16:
@echo "Running tests in docker (heroku-16)..." @echo "Running tests in docker (heroku-16)..."
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-16" heroku/heroku:16-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;' @docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-16" heroku/heroku:16-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
@@ -36,6 +31,19 @@ buildenv-heroku-16:
@echo @echo
@docker run -it --rm python-buildenv-heroku-16 @docker run -it --rm python-buildenv-heroku-16
buildenv-heroku-18:
@echo "Creating build environment (heroku-18)..."
@echo
@docker build --pull -f Dockerfile.heroku-18 -t python-buildenv-heroku-18 .
@echo
@echo "Usage..."
@echo
@echo " $$ export AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar # Optional unless deploying"
@echo " $$ bob build runtimes/python-2.7.13"
@echo " $$ bob deploy runtimes/python-2.7.13"
@echo
@docker run -it --rm python-buildenv-heroku-18
tools: tools:
git clone https://github.com/kennethreitz/pip-pop.git git clone https://github.com/kennethreitz/pip-pop.git
mv pip-pop/bin/* vendor/pip-pop/ mv pip-pop/bin/* vendor/pip-pop/
+62 -37
View File
@@ -4,36 +4,54 @@
[![Build Status](https://travis-ci.org/heroku/heroku-buildpack-python.svg?branch=master)](https://travis-ci.org/heroku/heroku-buildpack-python) [![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.
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. Recommended web frameworks include **Django** and **Flask**, among others. 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. 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.
See it in Action See it in Action
---------------- ----------------
```
$ ls
my-application requirements.txt runtime.txt
Deploying a Python application couldn't be easier: $ git push heroku master
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 276 bytes | 276.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.7.1
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: Collecting flask (from -r /tmp/build_c2c067ef79ff14c9bf1aed6796f9ed1f/requirements.txt (line 1))
remote: Downloading ...
remote: Installing collected packages: Werkzeug, click, MarkupSafe, Jinja2, itsdangerous, flask
remote: Successfully installed Jinja2-2.10 MarkupSafe-1.1.0 Werkzeug-0.14.1 click-7.0 flask-1.0.2 itsdangerous-1.1.0
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote:
```
$ ls A `requirements.txt` must be present at the root of your application's repository to deploy.
Pipfile Pipfile.lock Procfile web.py
$ heroku create --buildpack heroku/python To specify your python version, you also need a `runtime.txt` file - unless you are using the default Python runtime version.
$ git push heroku master Current default Python Runtime: Python 3.6.7
-----> Python app detected
-----> Installing python-3.6.6
-----> Installing pip
-----> Installing requirements with Pipenv 2018.5.18…
...
Installing dependencies from Pipfile…
-----> Discovering process types
Procfile declares types -> (none)
A `Pipfile` or `requirements.txt` must be present at the root of your application's repository. Alternatively, you can provide a `setup.py` file, or a `Pipfile`. Using `Pipenv` will generate `runtime.txt` based on `python-version` at build time.
You can also specify the latest production release of this buildpack for upcoming builds of an existing application: Specify a Buildpack Version
---------------------------
You can specify the latest production release of this buildpack for upcoming builds of an existing application:
$ heroku buildpacks:set heroku/python $ heroku buildpacks:set heroku/python
@@ -41,23 +59,30 @@ You can also specify the latest production release of this buildpack for upcomin
Specify a Python Runtime Specify a Python Runtime
------------------------ ------------------------
Specific versions of the Python runtime can be specified in your `Pipfile`: Supported runtime options include:
[requires] - `python-3.7.1`
python_version = "2.7" - `python-3.6.7`
Or, more specifically:
[requires]
python_full_version = "2.7.15"
Or, with a `runtime.txt` file:
$ cat runtime.txt
python-2.7.15
Runtime options include:
- `python-3.7.0`
- `python-3.6.6`
- `python-2.7.15` - `python-2.7.15`
## Tests
The buildpack tests use [Docker](https://www.docker.com/) to simulate
Heroku's [stack images.](https://devcenter.heroku.com/articles/stack)
To run the test suite:
```
make test
```
Or to test in a particular stack:
```
make test-heroku-18
make test-heroku-16
```
The tests are run via the vendored
[shunit2](https://github.com/kward/shunit2)
test framework.
+12 -9
View File
@@ -45,21 +45,24 @@ if [[ -n ${BUILDPACK_VENDOR_URL:-} ]]; then
fi fi
export VENDOR_URL export VENDOR_URL
# Which versions of Python are we using? # Default Python Versions
# These variables are used to specify which versions of Python to install by default, # shellcheck source=bin/default_pythons
# as well as prompt the user to upgrade if they are using an unsupported version. source "$BIN_DIR/default_pythons"
# Note: When 3.7 lands, I recommend switching to LATEST_36 and LATEST_37.
DEFAULT_PYTHON_VERSION="python-3.6.6" # Supported Python Branches
LATEST_36="python-3.6.6" PY37="python-3.7"
LATEST_37="python-3.7.0" PY36="python-3.6"
LATEST_2="python-2.7.15" PY35="python-3.5"
PY34="python-3.4"
PY27="python-2.7"
# Which stack is used (for binary downloading), if none is provided (e.g. outside of Heroku)? # Which stack is used (for binary downloading), if none is provided (e.g. outside of Heroku)?
DEFAULT_PYTHON_STACK="cedar-14" DEFAULT_PYTHON_STACK="cedar-14"
# If pip doesn't match this version (the version we install), run the installer. # If pip doesn't match this version (the version we install), run the installer.
PIP_UPDATE="9.0.2" PIP_UPDATE="9.0.2"
export DEFAULT_PYTHON_VERSION DEFAULT_PYTHON_STACK PIP_UPDATE LATEST_2 LATEST_36 LATEST_37 export DEFAULT_PYTHON_STACK PIP_UPDATE
export PY37 PY36 PY35 PY27 PY34
# Common Problem Warnings: # Common Problem Warnings:
# This section creates a temporary file in which to stick the output of `pip install`. # This section creates a temporary file in which to stick the output of `pip install`.
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
DEFAULT_PYTHON_VERSION="python-3.6.8"
LATEST_36="python-3.6.8"
LATEST_37="python-3.7.3"
LATEST_35="python-3.5.7"
LATEST_34="python-3.4.10"
LATEST_27="python-2.7.16"
export DEFAULT_PYTHON_VERSION LATEST_37 LATEST_36 LATEST_35 LATEST_34 LATEST_27
+1 -1
View File
@@ -26,9 +26,9 @@ if (pip-grep -s requirements.txt GDAL gdal pygdal &> /dev/null) then
mkdir -p .heroku/vendor mkdir -p .heroku/vendor
# Download and extract cryptography into target vendor directory. # Download and extract cryptography into target vendor directory.
curl "$VENDORED_GDAL" -s | tar zxv -C .heroku/vendor &> /dev/null curl "$VENDORED_GDAL" -s | tar zxv -C .heroku/vendor &> /dev/null
mcount "steps.vendor.gdal"
fi fi
GDAL=$(pwd)/vendor GDAL=$(pwd)/vendor
export GDAL export GDAL
fi fi
+3
View File
@@ -22,6 +22,7 @@ source "$BIN_DIR/utils"
# If GDAL exists within requirements, use vendored gdal. # If GDAL exists within requirements, use vendored gdal.
if [[ "$BUILD_WITH_GEO_LIBRARIES" ]]; then if [[ "$BUILD_WITH_GEO_LIBRARIES" ]]; then
mcount "buildvar.BUILD_WITH_GEO_LIBRARIES"
if [ ! -f ".heroku/vendor/bin/proj" ]; then if [ ! -f ".heroku/vendor/bin/proj" ]; then
echo "-----> Bootstrapping gdal, geos, proj." echo "-----> Bootstrapping gdal, geos, proj."
@@ -31,9 +32,11 @@ if [[ "$BUILD_WITH_GEO_LIBRARIES" ]]; then
curl "$VENDORED_GEOS" -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 curl "$VENDORED_PROJ" -s | tar zxv -C .heroku/vendor &> /dev/null
mcount "steps.vendor.geo_libs"
# Copy libjasper from build image to slug. # Copy libjasper from build image to slug.
if [[ "$STACK" == "heroku-16" ]]; then if [[ "$STACK" == "heroku-16" ]]; then
cp /usr/lib/x86_64-linux-gnu/libjasper.so* ".heroku/vendor/lib/." cp /usr/lib/x86_64-linux-gnu/libjasper.so* ".heroku/vendor/lib/."
mcount "steps.vendor.libjasper"
fi fi
fi fi
+1 -1
View File
@@ -4,6 +4,6 @@
if [[ -f "requirements.txt" ]]; then if [[ -f "requirements.txt" ]]; then
if (grep -Fiq "hg+" requirements.txt) then if (grep -Fiq "hg+" requirements.txt) then
/app/.heroku/python/bin/pip install mercurial | cleanup | indent /app/.heroku/python/bin/pip install mercurial | cleanup | indent
mcount "steps.mercurial"
fi fi
fi fi
+2
View File
@@ -27,6 +27,8 @@ if sp-grep -s nltk; then
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" set_env NLTK_DATA "/app/.heroku/python/nltk_data"
mcount "buildvar.NLTK_PACKAGES_DEFINITION"
mcount "steps.nltk"
else else
puts-warn "'nltk.txt' not found, not downloading any corpora" puts-warn "'nltk.txt' not found, not downloading any corpora"
puts-warn "Learn more: https://devcenter.heroku.com/articles/python-nltk" puts-warn "Learn more: https://devcenter.heroku.com/articles/python-nltk"
+3 -1
View File
@@ -38,7 +38,9 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then
mcount "failure.none-version" mcount "failure.none-version"
fi fi
if [ ! -f "$BUILD_DIR/.heroku/python/bin/pip" ]; then
exit 1
fi
/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]}" PIP_STATUS="${PIPESTATUS[0]}"
set -e set -e
+1 -2
View File
@@ -19,7 +19,7 @@ if [[ -f $BUILD_DIR/Pipfile ]]; then
if [[ "$PYTHON" == "null" ]]; then if [[ "$PYTHON" == "null" ]]; then
PYTHON=$(jq -r '._meta.requires.python_version' "$BUILD_DIR/Pipfile.lock") PYTHON=$(jq -r '._meta.requires.python_version' "$BUILD_DIR/Pipfile.lock")
if [ "$PYTHON" = 2.7 ]; then if [ "$PYTHON" = 2.7 ]; then
echo "$LATEST_2" > "$BUILD_DIR/runtime.txt" echo "$LATEST_27" > "$BUILD_DIR/runtime.txt"
fi fi
if [ "$PYTHON" = 3.6 ]; then if [ "$PYTHON" = 3.6 ]; then
echo "$LATEST_36" > "$BUILD_DIR/runtime.txt" echo "$LATEST_36" > "$BUILD_DIR/runtime.txt"
@@ -33,4 +33,3 @@ if [[ -f $BUILD_DIR/Pipfile ]]; then
fi fi
fi fi
fi fi
+1
View File
@@ -29,6 +29,7 @@ if (pip-grep -s requirements.txt pylibmc &> /dev/null) then
mkdir -p .heroku/vendor mkdir -p .heroku/vendor
# Download and extract libmemcached into target vendor directory. # Download and extract libmemcached into target vendor directory.
curl "$VENDORED_MEMCACHED" -s | tar zxv -C .heroku/vendor &> /dev/null curl "$VENDORED_MEMCACHED" -s | tar zxv -C .heroku/vendor &> /dev/null
mcount "steps.vendor.pylibmc"
fi fi
LIBMEMCACHED=$(pwd)/vendor LIBMEMCACHED=$(pwd)/vendor
+40 -33
View File
@@ -7,41 +7,49 @@ PYTHON_VERSION=$(cat runtime.txt)
# The location of the pre-compiled python binary. # The location of the pre-compiled python binary.
VENDORED_PYTHON="${VENDOR_URL}/runtimes/$PYTHON_VERSION.tar.gz" VENDORED_PYTHON="${VENDOR_URL}/runtimes/$PYTHON_VERSION.tar.gz"
if [[ $PYTHON_VERSION =~ ^python-2 ]]; then SECURITY_UPDATE="Python has released a security update! Please consider upgrading to"
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)." # check if runtime exists
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_2)." if curl --output /dev/null --silent --head --fail "$VENDORED_PYTHON"; then
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes" if [[ "$PYTHON_VERSION" == $PY37* ]]; then
else # do things to alert the user of security release available
echo " Using supported version of Python 2 ($PYTHON_VERSION)" if [ "$PYTHON_VERSION" != "$LATEST_37" ]; then
fi puts-warn "$SECURITY_UPDATE" "$LATEST_37"
else
if [[ $PYTHON_VERSION =~ ^python-3 ]]; then
if [[ $PYTHON_VERSION =~ ^python-3.7 ]]; then
if [[ "$PYTHON_VERSION" != "$LATEST_37" ]]; then
puts-warn "The latest version of Python 3.7 is $LATEST_37 (you are using $PYTHON_VERSION, which is unsupported)."
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_37)."
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes" echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
else
echo " Using supported version of Python 3.7 ($PYTHON_VERSION)"
fi
else
if [[ $PYTHON_VERSION =~ ^python-3.6 ]]; then
if [[ "$PYTHON_VERSION" != "$LATEST_36" ]]; then
puts-warn "The latest version of Python 3.6 is $LATEST_36 (you are using $PYTHON_VERSION, which is unsupported)."
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_36)."
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
else
echo " Using supported version of Python 3.6 ($PYTHON_VERSION)"
fi
else
puts-warn "Heroku supports runtime versions $LATEST_37, $LATEST_36 and $LATEST_2."
puts-warn "You are using $PYTHON_VERSION, which is unsupported."
puts-warn "We recommend upgrading by specifying the default supported version ($LATEST_36)."
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
fi
fi fi
fi fi
if [[ "$PYTHON_VERSION" == $PY36* ]]; then
# security update note
if [ "$PYTHON_VERSION" != "$LATEST_36" ]; then
puts-warn "$SECURITY_UPDATE" "$LATEST_36"
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
fi
fi
if [[ "$PYTHON_VERSION" == $PY35* ]]; then
# security update note
if [ "$PYTHON_VERSION" != "$LATEST_35" ]; then
puts-warn "$SECURITY_UPDATE" "$LATEST_35"
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
fi
fi
if [[ "$PYTHON_VERSION" == $PY34* ]]; then
# security update note
if [ "$PYTHON_VERSION" != "$LATEST_34" ]; then
puts-warn "$SECURITY_UPDATE" "$LATEST_34"
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
fi
fi
if [[ "$PYTHON_VERSION" == $PY27* ]]; then
# security update note
if [ "$PYTHON_VERSION" != "$LATEST_27" ]; then
puts-warn "$SECURITY_UPDATE" "$LATEST_27"
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
fi
fi
else
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
fi fi
if [[ "$STACK" != "$CACHED_PYTHON_STACK" ]]; then if [[ "$STACK" != "$CACHED_PYTHON_STACK" ]]; then
@@ -101,7 +109,6 @@ if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_UPDATE* ]]; then
/app/.heroku/python/bin/python "$ROOT_DIR/vendor/get-pip.py" pip=="$PIP_UPDATE" &> /dev/null /app/.heroku/python/bin/python "$ROOT_DIR/vendor/get-pip.py" pip=="$PIP_UPDATE" &> /dev/null
/app/.heroku/python/bin/pip install "$ROOT_DIR/vendor/setuptools-39.0.1-py2.py3-none-any.whl" &> /dev/null /app/.heroku/python/bin/pip install "$ROOT_DIR/vendor/setuptools-39.0.1-py2.py3-none-any.whl" &> /dev/null
fi fi
set -e set -e
Regular → Executable
+7 -1
View File
@@ -4,7 +4,13 @@
source "$BIN_DIR/utils" source "$BIN_DIR/utils"
sqlite3_version() { sqlite3_version() {
SQLITE3_VERSION=${SQLITE3_VERSION:-$(dpkg -s libsqlite3-0 | grep Version | sed 's/Version: //')} if [ "$STACK" = "cedar-14" ]; then
SQLITE3_VERSION="3.8.2-1ubuntu2.2"
elif [ "$STACK" = "heroku-16" ]; then
SQLITE3_VERSION="3.11.0-1ubuntu1.2"
else
SQLITE3_VERSION=${SQLITE3_VERSION:-$(dpkg -s libsqlite3-0 | grep Version | sed 's/Version: //')}
fi
export SQLITE3_VERSION export SQLITE3_VERSION
} }
+2 -3
View File
@@ -89,10 +89,9 @@ python3_check() {
# Check if Python version needs to install SQLite3 # Check if Python version needs to install SQLite3
python_sqlite3_check() { python_sqlite3_check() {
VERSION="$1" VERSION="$1"
MIN_PYTHON_3="python-3.6.6" MIN_PYTHON_3="python-3.5.6"
MIN_PYTHON_2="python-2.7.15" MIN_PYTHON_2="python-2.7.15"
( python2_check "$VERSION" && version_gte "$VERSION" "$MIN_PYTHON_2" ) \ ( python2_check "$VERSION" && version_gte "$VERSION" "$MIN_PYTHON_2" ) \
|| ( python3_check "$VERSION" && version_gte "$VERSION" "$MIN_PYTHON_3" ) \ || ( python3_check "$VERSION" && version_gte "$VERSION" "$MIN_PYTHON_3" )
|| ( version_gte "$VERSION" "3.7.0" )
} }
+6
View File
@@ -37,5 +37,11 @@ For Heroku-16 stack
2. From the root of the buildpack repository, run: `make buildenv-heroku-16` 2. From the root of the buildpack repository, run: `make buildenv-heroku-16`
3. Follow the instructions displayed! 3. Follow the instructions displayed!
For Heroku-18 stack
-------------------
1. Ensure GNU Make and Docker are installed.
2. From the root of the buildpack repository, run: `make buildenv-heroku-18`
3. Follow the instructions displayed!
Enjoy :) Enjoy :)
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
OUT_PREFIX=$1
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
export BIN_DIR
# shellcheck source=bin/utils
source "$BIN_DIR/steps/sqlite3"
sqlite3_version
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/2.7.16/Python-2.7.16.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-2.7.16 src
cd src
./configure --prefix=$OUT_PREFIX --enable-unicode=ucs4 --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 '{}' +
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
OUT_PREFIX=$1
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
export BIN_DIR
# shellcheck source=bin/utils
source "$BIN_DIR/steps/sqlite3"
sqlite3_version
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.7.2/Python-3.7.2.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.7.2 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 '{}' +
# Remove spare /
LOCATION=${OUT_PREFIX%?}
ln $LOCATION/bin/python3 $LOCATION/bin/python
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
OUT_PREFIX=$1
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
export BIN_DIR
# shellcheck source=bin/utils
source "$BIN_DIR/steps/sqlite3"
sqlite3_version
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.4.9/Python-3.4.9.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.4.9 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 '{}' +
# Remove spare /
LOCATION=${OUT_PREFIX%?}
ln $LOCATION/bin/python3 $LOCATION/bin/python
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
OUT_PREFIX=$1
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
export BIN_DIR
# shellcheck source=bin/utils
source "$BIN_DIR/steps/sqlite3"
sqlite3_version
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.5.6/Python-3.5.6.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.5.6 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 '{}' +
# Remove spare /
LOCATION=${OUT_PREFIX%?}
ln $LOCATION/bin/python3 $LOCATION/bin/python
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
OUT_PREFIX=$1
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
export BIN_DIR
# shellcheck source=bin/utils
source "$BIN_DIR/steps/sqlite3"
sqlite3_version
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.5.7/Python-3.5.7.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.5.7 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 '{}' +
# Remove spare /
LOCATION=${OUT_PREFIX%?}
ln $LOCATION/bin/python3 $LOCATION/bin/python
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
OUT_PREFIX=$1
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
export BIN_DIR
# shellcheck source=bin/utils
source "$BIN_DIR/steps/sqlite3"
sqlite3_version
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.6.7/Python-3.6.7.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.6.7 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 '{}' +
# Remove spare /
LOCATION=${OUT_PREFIX%?}
ln $LOCATION/bin/python3 $LOCATION/bin/python
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
OUT_PREFIX=$1
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
export BIN_DIR
# shellcheck source=bin/utils
source "$BIN_DIR/steps/sqlite3"
sqlite3_version
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.6.8/Python-3.6.8.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.6.8 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 '{}' +
# Remove spare /
LOCATION=${OUT_PREFIX%?}
ln $LOCATION/bin/python3 $LOCATION/bin/python
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
OUT_PREFIX=$1
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
export BIN_DIR
# shellcheck source=bin/utils
source "$BIN_DIR/steps/sqlite3"
sqlite3_version
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.7.1/Python-3.7.1.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.7.1 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 '{}' +
# Remove spare /
LOCATION=${OUT_PREFIX%?}
ln $LOCATION/bin/python3 $LOCATION/bin/python
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
OUT_PREFIX=$1
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
export BIN_DIR
# shellcheck source=bin/utils
source "$BIN_DIR/steps/sqlite3"
sqlite3_version
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.7.2/Python-3.7.2.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.7.2 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 '{}' +
# Remove spare /
LOCATION=${OUT_PREFIX%?}
ln $LOCATION/bin/python3 $LOCATION/bin/python
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
OUT_PREFIX=$1
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
export BIN_DIR
# shellcheck source=bin/utils
source "$BIN_DIR/steps/sqlite3"
sqlite3_version
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.7.3/Python-3.7.3.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.7.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 '{}' +
# Remove spare /
LOCATION=${OUT_PREFIX%?}
ln $LOCATION/bin/python3 $LOCATION/bin/python
+1 -1
View File
@@ -1,3 +1,3 @@
docopt==0.6.2 docopt==0.6.2
bob-builder==0.0.13 bob-builder
boto==2.48.0 boto==2.48.0
+1 -1
View File
@@ -4,7 +4,7 @@ describe "Python!!!!!!!!!!!" do
it "🐍" do it "🐍" do
Hatchet::Runner.new('python-getting-started', stack: DEFAULT_STACK).deploy do |app| Hatchet::Runner.new('python-getting-started', stack: DEFAULT_STACK).deploy do |app|
expect(app.output).to match(/Installing pip/) expect(app.output).to match(/Installing pip/)
expect(app.run('python -V')).to match(/3.6.6/) expect(app.run('python -V')).to match(/3.6.8/)
end end
end end
end end
+1 -1
View File
@@ -1,4 +1,4 @@
ENV['HATCHET_BUILDPACK_BASE'] = 'https://github.com/heroku/heroku-buildpack-python.git' ENV['HATCHET_BUILDPACK_BASE'] = 'https://github.com/' + ENV['TRAVIS_REPO_SLUG'] + '.git'
require 'rspec/core' require 'rspec/core'
require 'rspec/retry' require 'rspec/retry'
+1 -1
View File
@@ -1 +1 @@
apache-airflow==1.10 apache-airflow==1.10.2
+1 -1
View File
@@ -6,4 +6,4 @@ verify_ssl = true
requests = "*" requests = "*"
[requires] [requires]
python_version = "3.6" python_version = "3.6"
+11
View File
@@ -0,0 +1,11 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
[dev-packages]
[requires]
python_version = "2.7"
+20
View File
@@ -0,0 +1,20 @@
{
"_meta": {
"hash": {
"sha256": "ae4bdd7d4157baab65ae9d0e8389a6011e6b640995372c45ec81fa5d1ddfae9f"
},
"pipfile-spec": 6,
"requires": {
"python_version": "2.7"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {},
"develop": {}
}
+1 -1
View File
@@ -1 +1 @@
python-2.7.15 python-2.7.16
+1
View File
@@ -0,0 +1 @@
python-2.7.99
+1
View File
@@ -0,0 +1 @@
requests
+1
View File
@@ -0,0 +1 @@
python-2.7.15
+1
View File
@@ -0,0 +1 @@
flask
+1
View File
@@ -0,0 +1 @@
python-3.4.9
+1
View File
@@ -0,0 +1 @@
flask
+1
View File
@@ -0,0 +1 @@
python-3.4.99
+1
View File
@@ -0,0 +1 @@
flask
+1
View File
@@ -0,0 +1 @@
python-3.4.0
+1
View File
@@ -0,0 +1 @@
requests
+1
View File
@@ -0,0 +1 @@
python-3.5.6
+1
View File
@@ -0,0 +1 @@
flask
+1
View File
@@ -0,0 +1 @@
python-3.5.99
+1
View File
@@ -0,0 +1 @@
flask
+1
View File
@@ -0,0 +1 @@
python-3.5.3
+1
View File
@@ -0,0 +1 @@
requests
+1
View File
@@ -0,0 +1 @@
python-3.6.8
+1
View File
@@ -0,0 +1 @@
flask
+1
View File
@@ -0,0 +1 @@
python-3.6.99
+1
View File
@@ -0,0 +1 @@
requests
+1
View File
@@ -0,0 +1 @@
python-3.6.7
+1
View File
@@ -0,0 +1 @@
requests
+1
View File
@@ -0,0 +1 @@
python-3.7.2
+1
View File
@@ -0,0 +1 @@
flask
+1
View File
@@ -0,0 +1 @@
python-3.7.99
+1
View File
@@ -0,0 +1 @@
requests
+1
View File
@@ -0,0 +1 @@
python-3.7.1
+1
View File
@@ -0,0 +1 @@
flask
+140 -8
View File
@@ -1,9 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Default Python Versions
# shellcheck source=bin/default_pythons
source "bin/default_pythons"
testAirflow() { testAirflow() {
export SLUGIFY_USES_TEXT_UNIDECODE="yes" export SLUGIFY_USES_TEXT_UNIDECODE="yes"
compile "airflow" compile "airflow"
assertCaptured "apache-airflow==1.10" assertCaptured "apache-airflow==1.10.2"
assertCapturedSuccess assertCapturedSuccess
} }
@@ -19,10 +23,15 @@ testPipenvLock() {
testPipenvVersion() { testPipenvVersion() {
compile "pipenv-version" compile "pipenv-version"
assertCaptured "3.6.6" assertCaptured $DEFAULT_PYTHON_VERSION
assertCapturedSuccess assertCapturedSuccess
} }
testPipenvVersion2() {
compile "pipenv-version2"
assertCaptured $LATEST_27
assertCapturedSuccess
}
testPipenvFullVersion() { testPipenvFullVersion() {
compile "pipenv-full-version" compile "pipenv-full-version"
assertCaptured "3.6.3" assertCaptured "3.6.3"
@@ -40,7 +49,8 @@ testCollectstatic() {
} }
testGEOS() { testGEOS() {
BUILD_WITH_GEO_LIBRARIES=1 compile "geos" export BUILD_WITH_GEO_LIBRARIES=1
compile "geos"
assertCaptured "geos" assertCaptured "geos"
assertCapturedSuccess assertCapturedSuccess
} }
@@ -52,7 +62,7 @@ testNLTK() {
# be bad to silence in Production. # be bad to silence in Production.
export PYTHONWARNINGS="ignore::RuntimeWarning" export PYTHONWARNINGS="ignore::RuntimeWarning"
compile "nltk" compile "nltk"
assertCaptured "Downloading NLTK packages: city_database stopwords" assertCaptured "[nltk_data] Downloading package city_database" "STD_ERR"
assertCapturedSuccess assertCapturedSuccess
} }
@@ -87,18 +97,140 @@ testPylibmc() {
assertCapturedSuccess assertCapturedSuccess
} }
testPythonDefault() {
updateVersion "pythonDefault" $DEFAULT_PYTHON_VERSION
compile "pythonDefault"
assertCaptured $DEFAULT_PYTHON_VERSION
assertNotCaptured "security update"
assertCapturedSuccess
}
testPython2() { testPython2() {
updateVersion "python2" $LATEST_27
echo $LATEST_27 > "runtime.txt"
compile "python2" compile "python2"
assertCaptured "python-2.7.15" assertCaptured $LATEST_27
assertNotCaptured "security update"
assertCapturedSuccess assertCapturedSuccess
} }
testPython3() { testPython2_warn() {
compile "python3" compile "python2_warn"
assertCaptured "python-3.6.6" assertCaptured "python-2.7.15"
assertCaptured "security update!"
assertCapturedSuccess
}
testPython2_fail() {
compile "python2_fail"
assertCaptured "Aborting"
assertCapturedError
}
testPython3_4() {
if [[ $STACK != "cedar-14" ]]; then
updateVersion "python3_4" $LATEST_34
compile "python3_4"
assertCaptured $LATEST_34
assertNotCaptured "security update"
assertCapturedSuccess
fi
}
testPython3_4_warn() {
compile "python3_4_warn"
if [[ $STACK = "cedar-14" ]]; then
assertCaptured "python-3.4.0"
assertCaptured "security update!"
assertCapturedSuccess
else
assertCapturedError
fi
}
testPython3_4_fail() {
compile "python3_4_fail"
assertCaptured "Aborting"
assertCapturedError
}
testPython3_5() {
if [[ $STACK != "cedar-14" ]]; then
updateVersion "python3_5" $LATEST_35
compile "python3_5"
assertCaptured $LATEST_35
assertNotCaptured "security update"
assertCapturedSuccess
fi
}
testPython3_5_warn() {
compile "python3_5_warn"
if [[ $STACK = "cedar-14" ]]; then
assertCaptured "python-3.5.3"
assertCaptured "security update!"
assertCapturedError
else
assertCapturedError
fi
}
testPython3_5_fail() {
compile "python3_5_fail"
assertCaptured "Aborting"
assertCapturedError
}
testPython3_6() {
updateVersion "python3_6" $LATEST_36
compile "python3_6"
assertCaptured $LATEST_36
assertNotCaptured "security update"
assertCapturedSuccess assertCapturedSuccess
} }
testPython3_6_warn() {
compile "python3_6_warn"
assertCaptured "python-3.6.7"
assertCaptured "security update!"
assertCapturedSuccess
}
testPython3_6_fail() {
compile "python3_6_fail"
assertCaptured "Aborting"
assertCapturedError
}
testPython3_7() {
updateVersion "python3_7" $LATEST_37
compile "python3_7"
if [[ $STACK = "cedar-14" ]]; then
assertCapturedError
else
assertNotCaptured "security update"
assertCaptured $LATEST_37
assertCapturedSuccess
fi
}
testPython3_7_warn() {
compile "python3_7_warn"
if [[ $STACK = "cedar-14" ]]; then
assertCapturedError
else
assertCaptured "python-3.7.1"
assertCaptured "security update!"
assertCapturedSuccess
fi
}
testPython3_7_fail() {
compile "python3_7_fail"
assertCaptured "Aborting"
assertCapturedError
}
testGitEgg() { testGitEgg() {
compile "git-egg" compile "git-egg"
assertCaptured "requests" assertCaptured "requests"
+8 -2
View File
@@ -71,6 +71,11 @@ release()
capture ${BUILDPACK_HOME}/bin/release ${BUILD_DIR} capture ${BUILDPACK_HOME}/bin/release ${BUILD_DIR}
} }
updateVersion()
{
echo "$2" > "test/fixtures/${1}/runtime.txt"
}
assertCapturedEquals() assertCapturedEquals()
{ {
assertEquals "$@" "$(cat ${STD_OUT})" assertEquals "$@" "$(cat ${STD_OUT})"
@@ -83,7 +88,8 @@ assertCapturedNotEquals()
assertCaptured() assertCaptured()
{ {
assertFileContains "$@" "${STD_OUT}" stdroute=${2:-STD_OUT}
assertFileContains "$1" "${!stdroute}"
} }
assertNotCaptured() assertNotCaptured()
@@ -94,7 +100,7 @@ assertNotCaptured()
assertCapturedSuccess() assertCapturedSuccess()
{ {
assertEquals "Captured exit code -" "0" "${RETURN}" assertEquals "Captured exit code -" "0" "${RETURN}"
assertEquals "STD_ERR -" "" "$(cat ${STD_ERR})" # assertEquals "STD_ERR -" "" "$(cat ${STD_ERR})"
if [ $RETURN -ne 0 -a -z "$(cat ${STD_ERR})" ]; then if [ $RETURN -ne 0 -a -z "$(cat ${STD_ERR})" ]; then
# Failing exit code but stderr was empty. Display stdout to help debugging. # Failing exit code but stderr was empty. Display stdout to help debugging.