@@ -30,10 +30,10 @@ PYTHON_FULL_VERSION_REGEX="${INT_REGEX}\.${INT_REGEX}\.${INT_REGEX}"
30
30
# resolved to an exact Python version.
31
31
#
32
32
# If an app specifies the Python version via multiple means, then the order of precedence is:
33
- # 1. runtime.txt
34
- # 2. .python-version
35
- # 3. Pipfile.lock ( `python_full_version` field)
36
- # 4. Pipfile.lock ( `python_version` field)
33
+ # 1. ` runtime.txt` file (deprecated)
34
+ # 2. ` .python-version` file (recommended)
35
+ # 3. The `python_full_version` field in the `Pipfile.lock` file
36
+ # 4. The `python_version` field in the `Pipfile.lock` file
37
37
#
38
38
# If a version wasn't specified by the app, then new apps/those with an empty cache will use
39
39
# a buildpack default version for the first build, and then subsequent cached builds will use
@@ -100,21 +100,29 @@ function python_version::parse_runtime_txt() {
100
100
output::error << -EOF
101
101
Error: Invalid Python version in runtime.txt.
102
102
103
- The Python version specified in ' runtime.txt' isn't in
104
- the correct format.
103
+ The Python version specified in your runtime.txt file isn't
104
+ in the correct format.
105
105
106
- The following file contents were found:
106
+ The following file contents were found, which aren't valid :
107
107
${contents}
108
108
109
- However, the version must be specified as either:
110
- 1. 'python-<major>.<minor>' (recommended, for automatic patch updates)
111
- 2. 'python-<major>.<minor>.<patch>' (to pin to an exact patch version)
109
+ However, the runtime.txt file is deprecated since it has
110
+ been replaced by the .python-version file. As such, we
111
+ recommend that you switch to using a .python-version file
112
+ instead of fixing your runtime.txt file.
112
113
113
- Remember to include the 'python-' prefix. Comments aren't supported.
114
+ Please delete your runtime.txt file and create a new file named:
115
+ .python-version
114
116
115
- For example, to request the latest version of Python ${DEFAULT_PYTHON_MAJOR_VERSION} ,
116
- update the 'runtime.txt' file so it contains:
117
- python-${DEFAULT_PYTHON_MAJOR_VERSION}
117
+ Make sure to include the '.' at the start of the filename.
118
+
119
+ In the new file, specify your app's Python version without
120
+ quotes or a 'python-' prefix. For example:
121
+ ${DEFAULT_PYTHON_MAJOR_VERSION}
122
+
123
+ We strongly recommend that you use the major version form
124
+ instead of pinning to an exact version, since it will allow
125
+ your app to receive Python security updates.
118
126
EOF
119
127
meta_set " failure_reason" " runtime-txt::invalid-version"
120
128
exit 1
@@ -144,22 +152,26 @@ function python_version::parse_python_version_file() {
144
152
output::error << -EOF
145
153
Error: Invalid Python version in .python-version.
146
154
147
- The Python version specified in ' .python-version' isn't in
148
- the correct format.
155
+ The Python version specified in your .python-version file
156
+ isn't in the correct format.
149
157
150
158
The following version was found:
151
159
${line}
152
160
153
- However, the version must be specified as either:
154
- 1. '< major>.<minor>' (recommended, for automatic patch updates )
155
- 2. '<major>.<minor>.<patch>' (to pin to an exact patch version)
161
+ However, the Python version must be specified as either:
162
+ 1. The major version only: 3.X (recommended )
163
+ 2. An exact patch version: 3.X.Y
156
164
157
165
Don't include quotes or a 'python-' prefix. To include
158
166
comments, add them on their own line, prefixed with '#'.
159
167
160
168
For example, to request the latest version of Python ${DEFAULT_PYTHON_MAJOR_VERSION} ,
161
- update the ' .python-version' file so it contains:
169
+ update your .python-version file so it contains:
162
170
${DEFAULT_PYTHON_MAJOR_VERSION}
171
+
172
+ We strongly recommend that you use the major version form
173
+ instead of pinning to an exact version, since it will allow
174
+ your app to receive Python security updates.
163
175
EOF
164
176
meta_set " failure_reason" " python-version-file::invalid-version"
165
177
exit 1
@@ -169,10 +181,13 @@ function python_version::parse_python_version_file() {
169
181
output::error << -EOF
170
182
Error: Invalid Python version in .python-version.
171
183
172
- No Python version was found in the ' .python-version' file.
184
+ No Python version was found in your .python-version file.
173
185
174
- Update the file so that it contains a valid Python version
175
- such as '${DEFAULT_PYTHON_MAJOR_VERSION} '.
186
+ Update the file so that it contains a valid Python version.
187
+
188
+ For example, to request the latest version of Python ${DEFAULT_PYTHON_MAJOR_VERSION} ,
189
+ update your .python-version file so it contains:
190
+ ${DEFAULT_PYTHON_MAJOR_VERSION}
176
191
177
192
If the file already contains a version, check the line doesn't
178
193
begin with a '#', otherwise it will be treated as a comment.
@@ -184,8 +199,7 @@ function python_version::parse_python_version_file() {
184
199
output::error << -EOF
185
200
Error: Invalid Python version in .python-version.
186
201
187
- Multiple Python versions were found in the '.python-version'
188
- file:
202
+ Multiple versions were found in your .python-version file:
189
203
190
204
$(
191
205
IFS=$' \n '
@@ -194,8 +208,8 @@ function python_version::parse_python_version_file() {
194
208
195
209
Update the file so it contains only one Python version.
196
210
197
- If the additional versions are actually comments, prefix
198
- those lines with '#'.
211
+ If you have added comments to the file, make sure that those
212
+ lines begin with a '#', so that they are ignored .
199
213
EOF
200
214
meta_set " failure_reason" " python-version-file::multiple-versions"
201
215
exit 1
@@ -245,20 +259,24 @@ function python_version::read_pipenv_python_version() {
245
259
echo " ${version} "
246
260
else
247
261
output::error << -EOF
248
- Error: Invalid Python version in Pipfile / Pipfile .lock.
262
+ Error: Invalid Python version in Pipfile.lock.
249
263
250
- The Python version specified in Pipfile / Pipfile.lock by the
251
- 'python_version' or 'python_full_version' field isn't valid.
264
+ The Python version specified in your Pipfile.lock file by the
265
+ 'python_version' or 'python_full_version' fields isn't valid.
252
266
253
267
The following version was found:
254
268
${version}
255
269
256
- However, the version must be specified as either:
257
- 1. '<major>.<minor>' (recommended, for automatic patch updates)
258
- 2. '<major>.<minor>.<patch>' (to pin to an exact patch version)
270
+ However, the Python version must be specified as either:
271
+ 1. The major version only: 3.X (recommended)
272
+ 2. An exact patch version: 3.X.Y
273
+
274
+ Please update your Pipfile to use a valid Python version and
275
+ then run 'pipenv lock' to regenerate Pipfile.lock.
259
276
260
- Please update your 'Pipfile' to use a valid Python version and
261
- then run 'pipenv lock' to regenerate the lockfile.
277
+ We strongly recommend that you use the major version form
278
+ instead of pinning to an exact version, since it will allow
279
+ your app to receive Python security updates.
262
280
263
281
For more information, see:
264
282
https://pipenv.pypa.io/en/stable/specifiers.html#specifying-versions-of-python
@@ -297,10 +315,15 @@ function python_version::resolve_python_version() {
297
315
As such, it's no longer supported by this buildpack:
298
316
https://devcenter.heroku.com/articles/python-support#supported-python-versions
299
317
300
- Please upgrade to at least Python 3.${OLDEST_SUPPORTED_PYTHON_3_MINOR_VERSION} by creating a
301
- .python-version file in the root directory of your app,
302
- that contains a Python version like:
303
- 3.${OLDEST_SUPPORTED_PYTHON_3_MINOR_VERSION}
318
+ Please upgrade to at least Python 3.${OLDEST_SUPPORTED_PYTHON_3_MINOR_VERSION} by configuring an
319
+ explicit Python version for your app.
320
+
321
+ Create a .python-version file in the root directory of your
322
+ app, that contains a Python version like:
323
+ 3.${NEWEST_SUPPORTED_PYTHON_3_MINOR_VERSION}
324
+
325
+ When creating this file make sure to include the '.' at the
326
+ start of the filename.
304
327
EOF
305
328
else
306
329
output::error << -EOF
0 commit comments