Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
heroku-buildpack-python
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
heroku-buildpack-python
Commits
bc043e99
Commit
bc043e99
authored
Jul 12, 2018
by
Liu Junxiao
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master'
parents
401a3576
06b7f97e
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
145 additions
and
18 deletions
+145
-18
.travis.yml
.travis.yml
+5
-0
CHANGELOG.md
CHANGELOG.md
+8
-0
Makefile
Makefile
+5
-0
README.md
README.md
+4
-3
compile
bin/compile
+4
-3
pipenv-python-version
bin/steps/pipenv-python-version
+4
-1
python
bin/steps/python
+9
-4
python-3.6.6
builds/runtimes/python-3.6.6
+21
-0
python-3.7.0
builds/runtimes/python-3.7.0
+21
-0
publish.sh
etc/publish.sh
+38
-0
runtime.txt
test/fixtures/nltk/runtime.txt
+1
-1
run
test/run
+19
-5
tests.sh
tests.sh
+6
-1
No files found.
.travis.yml
View file @
bc043e99
...
...
@@ -9,6 +9,11 @@ jobs:
-
PATH="/tmp/shellcheck-latest:$PATH"
script
:
make check
-
stage
:
"
Stack
Tests"
services
:
docker
env
:
STACK=heroku-18
script
:
./tests.sh
-
stage
:
"
Stack
Tests"
services
:
docker
env
:
STACK=heroku-16
...
...
CHANGELOG.md
View file @
bc043e99
# Python Buildpack Changelog
# 136
Upgrade to 3.6.6 and support 3.7.0 on all runtimes.
# 135
Upgrade Pipenv to v2018.5.18.
# 134
Default to 3.6.5, bugfixes.
...
...
Makefile
View file @
bc043e99
...
...
@@ -18,6 +18,11 @@ test-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;'
@
echo
""
test-heroku-18
:
@
echo
"Running tests in docker (heroku-18)..."
@
docker run
-v
$(
shell
pwd
)
:/buildpack:ro
--rm
-it
-e
"STACK=heroku-18"
heroku/heroku:18-build bash
-c
'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
@
echo
""
buildenv-heroku-16
:
@
echo
"Creating build environment (heroku-16)..."
@
echo
...
...
README.md
View file @
bc043e99
...
...
@@ -23,9 +23,9 @@ Deploying a Python application couldn't be easier:
$ git push heroku master
…
-----> Python app detected
-----> Installing python-3.6.
4
-----> Installing python-3.6.
6
-----> Installing pip
-----> Installing requirements with Pipenv
11.7.1
…
-----> Installing requirements with Pipenv
2018.5.18
…
...
Installing dependencies from Pipfile…
-----> Discovering process types
...
...
@@ -58,7 +58,8 @@ Or, with a `runtime.txt` file:
Runtime options include:
-
`python-3.6.4`
-
`python-3.7.0`
-
`python-3.6.6`
-
`python-2.7.15`
...
...
bin/compile
View file @
bc043e99
...
...
@@ -49,8 +49,9 @@ export VENDOR_URL
# These variables are used to specify which versions of Python to install by default,
# as well as prompt the user to upgrade if they are using an un–supported version.
# Note: When 3.7 lands, I recommend switching to LATEST_36 and LATEST_37.
DEFAULT_PYTHON_VERSION
=
"python-3.6.5"
LATEST_3
=
"python-3.6.5"
DEFAULT_PYTHON_VERSION
=
"python-3.6.6"
LATEST_36
=
"python-3.6.6"
LATEST_37
=
"python-3.7.0"
LATEST_2
=
"python-2.7.15"
# Which stack is used (for binary downloading), if none is provided (e.g. outside of Heroku)?
...
...
@@ -58,7 +59,7 @@ DEFAULT_PYTHON_STACK="cedar-14"
# If pip doesn't match this version (the version we install), run the installer.
PIP_UPDATE
=
"9.0.2"
export
DEFAULT_PYTHON_VERSION DEFAULT_PYTHON_STACK PIP_UPDATE LATEST_2 LATEST_3
export
DEFAULT_PYTHON_VERSION DEFAULT_PYTHON_STACK PIP_UPDATE LATEST_2 LATEST_3
6 LATEST_37
# Common Problem Warnings:
# This section creates a temporary file in which to stick the output of `pip install`.
...
...
bin/steps/pipenv-python-version
View file @
bc043e99
...
...
@@ -22,7 +22,10 @@ if [[ -f $BUILD_DIR/Pipfile ]]; then
echo
"
$LATEST_2
"
>
"
$BUILD_DIR
/runtime.txt"
fi
if
[
"
$PYTHON
"
=
3.6
]
;
then
echo
"
$LATEST_3
"
>
"
$BUILD_DIR
/runtime.txt"
echo
"
$LATEST_36
"
>
"
$BUILD_DIR
/runtime.txt"
fi
if
[
"
$PYTHON
"
=
3.7
]
;
then
echo
"
$LATEST_37
"
>
"
$BUILD_DIR
/runtime.txt"
fi
fi
...
...
bin/steps/python
View file @
bc043e99
...
...
@@ -14,12 +14,17 @@ if [[ $PYTHON_VERSION =~ ^python-2 ]]; then
echo
" Learn More: https://devcenter.heroku.com/articles/python-runtimes"
fi
else
if
[[
"
$PYTHON_VERSION
"
!=
"
$LATEST_3
"
]]
;
then
puts-warn
"The latest version of Python 3
is
$LATEST_3
(you are using
$PYTHON_VERSION
, which is unsupported)."
puts-warn
"We recommend upgrading by specifying the latest version (
$LATEST_3
)."
if
[[
$PYTHON_VERSION
=
~ ^python-3.7
]]
&&
[[
"
$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_3
7
)."
echo
" Learn More: https://devcenter.heroku.com/articles/python-runtimes"
else
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"
fi
fi
fi
if
[[
"
$STACK
"
!=
"
$CACHED_PYTHON_STACK
"
]]
;
then
...
...
builds/runtimes/python-3.6.6
0 → 100755
View file @
bc043e99
#!/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.6/Python-3.6.6.tgz'
curl
-L
$SOURCE_TARBALL
|
tar
xz
mv
Python-3.6.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
'{}'
+
ln
$OUT_PREFIX
/bin/python3
$OUT_PREFIX
/bin/python
builds/runtimes/python-3.7.0
0 → 100755
View file @
bc043e99
#!/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.7.0/Python-3.7.0.tgz'
curl
-L
$SOURCE_TARBALL
|
tar
xz
mv
Python-3.7.0 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
etc/publish.sh
0 → 100644
View file @
bc043e99
#!/bin/bash
set
-e
BP_NAME
=
${
1
:-
"heroku/python"
}
curVersion
=
$(
heroku buildpacks:versions
"
$BP_NAME
"
|
awk
'FNR == 3 { print $1 }'
)
newVersion
=
"v
$((
curVersion
+
1
))
"
read
-p
"Deploy as version:
$newVersion
[y/n]? "
choice
case
"
$choice
"
in
y|Y
)
echo
""
;;
n|N
)
exit
0
;;
*
)
exit
1
;;
esac
originMaster
=
$(
git rev-parse origin/master
)
echo
"Tagging commit
$originMaster
with
$newVersion
... "
git tag
"
$newVersion
"
"
${
originMaster
:?
}
"
git push origin refs/tags/
$newVersion
heroku buildpacks:publish
"
$BP_NAME
"
"
$newVersion
"
if
[
$(
git tag |
grep
-q
previous-version
)
]
;
then
echo
"Updating previous-version tag"
git tag
-d
previous-version
git push origin :previous-version
git tag previous-version latest-version
fi
if
[
$(
git tag |
grep
-q
latest-version
)
]
;
then
echo
"Updating latest-version tag"
git tag
-d
latest-version
git push origin :latest-version
git tag latest-version
"
${
originMaster
:?
}
"
git push
--tags
fi
echo
"Done."
test/fixtures/nltk/runtime.txt
View file @
bc043e99
python-2.7.13
\ No newline at end of file
python-3.6.6
test/run
View file @
bc043e99
...
...
@@ -12,7 +12,7 @@ testPipenvLock() {
testPipenvVersion
()
{
compile
"pipenv-version"
assertCaptured
"3.6.
5
"
assertCaptured
"3.6.
6
"
assertCapturedSuccess
}
...
...
@@ -39,6 +39,11 @@ testGEOS() {
}
testNLTK
()
{
# 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.
export
PYTHONWARNINGS
=
"ignore::RuntimeWarning"
compile
"nltk"
assertCaptured
"Downloading NLTK packages: city_database stopwords"
assertCapturedSuccess
...
...
@@ -76,14 +81,23 @@ testPylibmc() {
}
testPython2
()
{
compile
"python2"
assertCaptured
"python-2.7.15"
assertCapturedSuccess
if
[[
"
$STACK
"
==
"heroku-16"
]]
||
[[
"
$STACK
"
==
"cedar-14"
]]
;
then
compile
"python2"
assertCaptured
"python-2.7.15"
assertCapturedSuccess
fi
}
testNoPython2
()
{
if
[[
"
$STACK
"
==
"heroku-18"
]]
;
then
compile
"python2"
assertCapturedError
fi
}
testPython3
()
{
compile
"python3"
assertCaptured
"python-3.6.
5
"
assertCaptured
"python-3.6.
6
"
assertCapturedSuccess
}
...
...
tests.sh
View file @
bc043e99
...
...
@@ -13,4 +13,9 @@ fi
if
[[
"
$STACK
"
==
"heroku-16"
]]
;
then
make test-heroku-16
exit
$?
fi
\ No newline at end of file
fi
if
[[
"
$STACK
"
==
"heroku-18"
]]
;
then
make test-heroku-18
exit
$?
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment