2088 Commits

Author SHA1 Message Date
Ed Morley 4d17846600 Check Changelog improvements (#1128)
The Check Changelog GitHub action now:
* is skipped for dependabot PRs
* uses a more descriptive job name than `check`

Closes @W-8052460@.
Closes @W-8098931@.

[skip changelog]
2020-11-30 13:13:14 +00:00
Ed Morley 74f2d09a5e Exclude more files when publishing the buildpack (#1127)
Since these files are not required at compile time.

The incorrect indentation has also been corrected.

Closes @W-8065952@.

[skip changelog]
2020-11-24 08:55:49 +00:00
Ed Morley b8e432edf1 Release v186 (#1124)
Closes @W-8440921@.
v186
2020-11-18 13:26:39 +00:00
Ed Morley 74a6c86c4f Add a make target for running a local compile (#1123)
It's often useful to be able to run a compile outside of the unit or
Hatchet tests when developing the buildpack or debugging.

Whilst running the compile locally inside Docker won't fully replicate
a compile on the platform, for many use-cases it's close enough and
importantly gives a faster development feedback loop, since buildpack
changes don't have to be committed/pushed prior to triggering a compile.

Closes @W-8436406@.
2020-11-17 15:19:48 +00:00
Ed Morley 54115fc89b Update the BUILD_WITH_GEO_LIBRARIES error message (#1121)
So that it links to the changelog post now that it exists:
https://devcenter.heroku.com/changelog-items/1947

And to adjust the emphasis towards the migration guide
over the Geo buildpack repository link.

Closes @W-8391415@.
2020-11-13 13:10:52 +00:00
Ed Morley 6a914193b9 Remove env vars used by legacy build systems (#1120)
These variables were used by Anvil and/or the legacy `slug_compiler`
that predated cytokine.

I've not added a changelog entry since none were exported, so wouldn't
have been available to subprocesses anyway.

Closes @W-8387606@.

[skip changelog]
2020-11-12 18:40:31 +00:00
Ed Morley 71aef447a6 Migrate away from sp-grep (#1119)
Switches the last consumers of it to a simpler utility function that
uses `pkgutil.find_loader()`:
https://docs.python.org/3/library/pkgutil.html#pkgutil.find_loader

Both of these consumers are covered by existing tests.

Then removes `sp-grep` and the remaining parts of `pip-pop`.

Closes @W-8208817@.
2020-11-12 17:42:51 +00:00
Ed Morley 768d3fb9e5 Remove vendored pip-diff script (#1118)
Since the last usage was removed in #1117.

Whilst this tool was intended for internal buildpack usage only, the
vendor directory is on `PATH`, so I've documented the removal in
CHANGELOG just in case.

Refs @W-8208817@.
2020-11-12 13:54:14 +00:00
Ed Morley eb44bc03f1 Remove vendored pip-grep script (#1116)
Since the last usage was removed in #1113, and pip-grep is actually
broken on newer pip anyway (though helpfully silently ignores
exceptions, so one wouldn't know).

This is the first of the pip-pop removals, the rest will follow as the
last usages are switched over.

Whilst this tool was intended for internal buildpack usage only, the
vendor directory is on `PATH`, so I've documented the removal in
CHANGELOG just in case.

Refs @W-8208817@.
2020-11-12 13:45:27 +00:00
Ed Morley c112ef81ad Remove unused pip-uninstall step (#1117)
The pip-uninstall step has been unused for pip-using apps since #925,
since the buildpack now invalidates the entire package cache instead.

Whilst the step appears to still be used for pipenv-using apps, the
code is not run, since `SKIP_PIP_INSTALL=1` is set too early.

This bug was introduced in a334672a1a
which landed straight to `master` two days after the feature was
introduced in #650.

Longer term we should likely get pipenv installs to do something similar
to pip (invalidate the whole cache based on checksum of the lockfile),
however for now I'm removing this deadcode since it's the last consumer
of the `pip-diff` script which we want to remove.

Closes @W-8386830@.

[skip changelog]
2020-11-12 13:43:49 +00:00
Ed Morley 5012113d68 Release v185 (#1114)
Closes @W-8381914@.
v185
2020-11-12 07:57:11 +00:00
Ed Morley ce684e4539 Make the BUILD_WITH_GEO_LIBRARIES warning fatal (#1115)
The `BUILD_WITH_GEO_LIBRARIES` feature was removed in the previous PR,
and replaced with a warning that the feature is no longer supported.

After further thought I believe it would be best to make this warning
fatal, to prevent unexpected failures at runtime, if consumers of the
library either aren't invoked during the build, or were previously
installed/cached and were dynamically linked against the library.

Continuation of #1113 / @W-7654424@.
2020-11-11 18:47:45 +00:00
Ed Morley 42076f1bf4 Remove deprecated GDAL/GEOS/PROJ support (#1113)
The standalone Geo buildpack offers more modern GDAL/GEOS/PROJ library
versions, and can be used by apps in all languages, not just Python:
https://github.com/heroku/heroku-geo-buildpack

As such the Python buildpack's undocumented built-in support was
deprecated back in April 2020, with a scheduled removal date of
6th October 2020:
https://devcenter.heroku.com/changelog-items/1759
https://help.heroku.com/D5INLB1A/python-s-build_with_geo_libraries-legacy-feature-is-now-deprecated

Metrics show very few builds continuing to use the built-in support.

Apps with the `BUILD_WITH_GEO_LIBRARIES` env var set will now be shown a
warning directing them to the standalone buildpack, as well as apps that
hit GDAL related pip install errors but aren't using the env var.

This also moves us one step closer to being able to remove
the vendored copy of pip-pop (which is partially broken on
newer pip).

Closes @W-7654424@.
2020-11-11 12:39:30 +00:00
Ed Morley 41f657fbff Remove vendored jq binary (#1112)
Since `jq` is installed in the `-build` stack image for all stacks:
https://github.com/heroku/stack-images/pull/174

Closes @W-7974682@.
2020-11-10 15:34:56 +00:00
Ed Morley 5f6941f04a Remove redundant Mercurial install step (#1111)
Mercurial is installed in the stack image for all stacks, so the
pip install of packages from Mercurial VCS URLs works without the
need for the buildpack to install it itself.

See:
https://github.com/heroku/stack-images/pull/141
https://github.com/heroku/stack-images/search?q=mercurial

Closes @W-7906950@.
2020-11-10 14:33:52 +00:00
Ed Morley 452443d420 Remove support for the Cedar-14 stack (#1110)
Since the stack is end of life and builds have been disabled:
https://devcenter.heroku.com/changelog-items/1943

There are only two temporarily exempted customers using Python, who
can switch to the Cedar-14 support branch if they still need to build
their Python apps (most of which haven't been built recently).

Closes @W-8054727@.
2020-11-10 13:58:33 +00:00
dependabot[bot] c08cad592d Bump rspec from 3.9.0 to 3.10.0 (#1107)
Bumps [rspec](https://github.com/rspec/rspec) from 3.9.0 to 3.10.0.
- [Release notes](https://github.com/rspec/rspec/releases)
- [Commits](https://github.com/rspec/rspec/compare/v3.9.0...v3.10.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-10 11:51:30 +00:00
Ed Morley c9504ffd2e Release v184 (#1106) v184 2020-10-21 14:56:33 +01:00
Ed Morley 96822983ed Add Heroku-20 to deploy-runtimes default stacks list (#1104)
Now `make deploy-runtimes` will build binaries for Heroku-20 by default
too, without the need to pass it in via an explicit `STACKS=...`list.

Closes @W-8233698@.

[skip changelog]
2020-10-19 20:48:34 +01:00
Ed Morley f9d5c0010d Move changelog entries to the correct section (#1103)
The changelog entries for #1099 and #1100 were added to the previous
release section (rather than the "unreleased" section) by mistake.
2020-10-19 13:02:12 +01:00
Ed Morley 9b1a69a1b3 Vendor buildpack-stdlib instead of fetching from S3 (#1100)
Since fetching buildpack-stdlib from S3 has a number of disadvantages:
- it's not possible to grep the repo when trying to work out what
  something from the stdlib is doing
- shellcheck can't fully scan the code, since it similarly doesn't
  have the source
- another compile-time HTTP request that can fail due to transient
  network issues and so reduce reliability
- dependency on the security/release-process of an additional bucket

Since the stdlib is small, doesn't often change, and is not a binary,
it's a great fit for just vendoring in the repo.

The `BIN_DIR` calculation added to `bin/utils` is based on the approach
mentioned here:
https://www.ostricher.com/2014/10/the-right-way-to-get-the-directory-of-a-bash-script/

...rather than copying the version in `bin/compile`, since the latter uses
`$0` so doesn't work with sourced scripts (such as `bin/utils`).

Closes W-8094463.
2020-10-19 12:27:16 +01:00
dependabot[bot] 58dd638fb6 Bump heroku_hatchet from 7.3.1 to 7.3.3 (#1102)
Bumps [heroku_hatchet](https://github.com/heroku/hatchet) from 7.3.1 to 7.3.3.
- [Release notes](https://github.com/heroku/hatchet/releases)
- [Changelog](https://github.com/heroku/hatchet/blob/main/CHANGELOG.md)
- [Commits](https://github.com/heroku/hatchet/compare/v7.3.1...v7.3.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-19 12:20:27 +01:00
Ed Morley ead59ac7ff Expose BPLOG_PREFIX to sub-shells again (#1099)
In #1011 the number of buildpack variables that are exported (and so
exposed to subprocesses) was reduced, since in general we don't want
to leak buildpack internals into end-user steps such as the pre/post
compile hooks.

However since this change, any buildpack metric emitted from within
a `sub_env` wrapper (which is a buildpack-stdlib utility function)
is missing its `buildpack.python` prefix.

This is because buildpack-stdlib:
* lazy-loads `BPLOG_PREFIX` (rather than doing so when initially
  sourced, which is the approach used for `BUILDPACK_LOG_FILE`)
* doesn't check whether `BPLOG_PREFIX` is set before emitting metrics

See:
https://github.com/heroku/buildpack-stdlib/blob/v8/stdlib.sh

As a stop-gap until we either fix this in buildpack-stdlib (W-8095466),
or remove usages of the `sub_env` wrapper (since I think they are
counter-productive in this buildpack), I've added back the export
for `BPLOG_PREFIX`.

Fixes @W-8095436@.
2020-10-15 15:31:32 +01:00
Ed Morley ac8fd555b8 Release v183 (#1097) v183 2020-10-12 12:31:44 +01:00
dependabot[bot] f825896c4e Bump heroku_hatchet from 7.3.0 to 7.3.1 (#1095)
Bumps [heroku_hatchet](https://github.com/heroku/hatchet) from 7.3.0 to 7.3.1.
- [Release notes](https://github.com/heroku/hatchet/releases)
- [Changelog](https://github.com/heroku/hatchet/blob/main/CHANGELOG.md)
- [Commits](https://github.com/heroku/hatchet/compare/v7.3.0...v7.3.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-12 10:01:20 +01:00
Ed Morley fcf696b835 Add support for Heroku-20 (#968)
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@.
2020-10-07 19:44:33 +01:00
Ed Morley a98ef91566 Tests: Clean up the Python version unit tests (#1092)
* Fixes the "Installing <version>" assertions so that they don't false
  positive against the "please upgrade to <version>" output.
* Removes modification of test fixtures during tests, since it can lead
  to failures depending on test order, and confusion when debugging.
* Updates the PyPy version warning tests to use a slightly newer (but
  still not latest) PyPy version, which means that the test now passes
  on Cedar-14 and can be unskipped.
* Switches to using an empty requirements file for version tests that
  duplicate the main test, to save spending time installing dependencies
  unnecessarily.
* Switches the NLTK test to using the default buildpack Python version,
  rather than an ancient Python 3.6.
* Skips the Python 3.7/3.8 tests on Cedar-14 rather than asserting
  failure, since we know they'll never pass due to Cedar-14's libssl being
  older than required.
* Removes redundant `testSqliteInstall` test since it duplicates the
  Python version install tests.

Longer term I'll be moving many of the unit tests to Hatchet, however
this at least makes the tests more dependable in the meantime.

Closes @W-8060219@.
Closes @W-8176779@.

[skip changelog]
2020-10-07 15:10:20 +01:00
Ed Morley e67235f906 Release v182 (#1091) v182 2020-10-06 10:25:07 +01:00
Ed Morley b1690e9f47 Add support for Python 3.9.0 (#1090)
https://pythoninsider.blogspot.com/2020/10/python-390-is-now-available-and-you-can.html
https://www.python.org/downloads/release/python-390/
https://docs.python.org/release/3.9.0/whatsnew/3.9.html

Binaries generated using:

```
make deploy-runtimes RUNTIMES='python-3.9.0' STACKS='heroku-16 heroku-18' ENV_FILE=...
```

Closes @W-7791272@.
2020-10-06 09:35:36 +01:00
Ed Morley b250300b74 Migrate to a new S3 bucket (#1089)
Since:
* We want the S3 bucket to be owned by a different AWS account and it's
  not possible to transfer ownership of an existing bucket.
* In the future we want to rebuild some of the Python runtime archives
  (for example to improve the sqlite3 handling, or to tweak the compile
  flags used), and it will be easier to reason about the change if we
  can guarantee only recent buildpack versions are using the assets
  rather than several year old unmaintained forks.

The assets were synced from the old bucket using (minus the `--dryrun`):

```
aws s3 sync s3://lang-python s3://heroku-buildpack-python \
  --dryrun \
  --metadata-directive REPLACE \
  --exclude "*" \
  --include 'common/*' \
  --include 'heroku-*/runtimes/*' \
  --include 'heroku-*/libraries/vendor/gdal.tar.gz' \
  --include 'heroku-*/libraries/vendor/geos.tar.gz' \
  --include 'heroku-*/libraries/vendor/proj.tar.gz' \
  --exclude 'common/pip-20.0.2-py2.py3-none-any.whl' \
  --exclude '*/runtimes/*-opt.tar.gz' \
  --exclude '*/runtimes/sqlite-free/*'
```

The files that were `--exclude`d are those that are no longer used,
or test assets that were not officially released.

The Cedar-14 assets were not migrated since it's EOL next month.

The old S3 bucket will be left untouched for the foreseeable future
(ie: we won't be deleting it), since builds using older versions of this
buildpack (either due to pinning to a tag or via a fork) will still be
using assets from it.

Closes @W-8060097@.
2020-10-06 09:23:38 +01:00
dependabot[bot] 096709dcf7 Bump bob-builder from 0.0.18 to 0.0.19 (#1088)
Bumps [bob-builder](https://github.com/heroku-python/bob-builder) from 0.0.18 to 0.0.19.
- [Release notes](https://github.com/heroku-python/bob-builder/releases)
- [Commits](https://github.com/heroku-python/bob-builder/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-05 08:47:36 +01:00
Ed Morley ff8945c0c2 Tests: Make assertCapturedSuccess check stderr is empty again (#1087)
`assertCapturedSuccess` used to check that `stderr` was empty, until:
https://github.com/heroku/heroku-buildpack-python/commit/797652a75d69a1fece96a26bf4514fe9e9e1c020#diff-65c067a6f0a3aef292fb54ec21a1fe8cR98

Adding back the assertion exposes some new bugs, which I'll fix in
later PRs. In the meantime affected tests have been adjusted to use
a new `assertCapturedSuccessWithStdErr`.

The test harness output for the failing case has also been improved,
to ease debugging.

Closes @W-7918492@.

[skip changelog]
2020-10-01 17:29:13 +01:00
Ed Morley 4e78b5d57c Remove duplicate copy of shunit2 (#1086)
The tests use `test/shunit2` so the copy under `vendor/` is redundant.

I've added to the CHANGELOG since `vendor/` is added by the buildpack to
`PATH` (something long term we should stop doing), increasing the chance
an app was accidentally relying upon `shunit2` (albeit still unlikely).

Closes @W-8145517@.
2020-10-01 16:02:09 +01:00
Ed Morley b74a41395e Refactor S3 asset URL handling (#1085)
Previously the buildpack's S3 bucket was defined in two places - once
in `VENDOR_URL` and again during the pip installation step. This
duplication was necessary since `VENDOR_URL` also contained the stack's
name, whereas the pip use-case used a non-stack-specific S3 key prefix.

In order to:
* reduce this duplication
* simplify this buildpack's S3 bucket migration (where we'll soon be
  needing the vary the bucket name and wouldn't want to have to
  duplicate that logic in multiple places)
* allow overriding of the URL for the pip use-case

...the `VENDOR_URL` variable has been replaced with `S3_BASE_URL` which
no longer contains the stack name.

The user-configurable override has similarly been renamed from
`BUILDPACK_VENDOR_URL` to `BUILDPACK_S3_BASE_URL`. Note: As before,
this override cannot be set via standard app variables (see #989).

The unused `USE_STAGING_BINARIES` environment variable has been
removed, since it's a leftover from the project to stand up a staging S3 bucket.
It's redundant given the `BUILDPACK_S3_BASE_URL` variable.

Closes @W-8142401@.
2020-10-01 10:13:26 +01:00
Ed Morley c550143a59 Use 'rm -rf' instead of 'rm -fr' (#1084)
Not super urgent, but seeing as it closes #927, might as well do now.

[skip changelog]
2020-09-29 15:34:13 +01:00
Ed Morley 838f4c125b Simplify binary build process and documentation (#1083)
* Moves all manual build steps to make targets, to simplify
  the commands run, and reduce chance for error.
* Removes the need to remember to rebuild the builder
  image by building it automatically prior to launching.
* Adds a new make target for deploying multiple runtime
  versions at once to speed up the common case.
* Reduces repetition/superfluous content in documentation.
* Removes unused `S3_REGION` from `dockerenv.default`
  (the contents of S3 buckets inherit the region of the bucket).
* Documents build dependencies in `requirements.txt`.

Closes @W-8119717@.

[skip changelog]
2020-09-29 13:40:56 +01:00
Ed Morley 0020aae078 Release v181 (#1082)
Closes @W-8133372@.
v181
2020-09-29 13:14:41 +01:00
Ed Morley 63651e042f Add support for PyPy 2.7 and 3.6 version 7.3.2 (#1081)
Since they were released yesterday:
https://morepypy.blogspot.com/2020/09/pypy-732-triple-release-python-27-36.html

The archive URL had to be updated now that PyPy has migrated from BitBucket.
The new URLs are from:
https://www.pypy.org/download.html

Skipping PyPy 3.7 for now, since it's in alpha.

Closes @W-8128094@.
2020-09-29 09:30:51 +01:00
Ed Morley c0609a881c Clean up binary generation Dockerfiles (#1080)
* Switches from using Python 2 to Python 3 for `bob-builder`
* Adds `--no-install-recommends` to reduce unnecessary packages
* Removes unnecessary pinning of pip for Heroku-18 build
* Moves `DEBIAN_FRONTEND` to RUN level env var, given:
   https://serverfault.com/a/797318

Refs @W-8119717@.

[skip changelog]
2020-09-29 09:29:33 +01:00
dependabot[bot] ef4696a922 Bump heroku_hatchet from 7.2.0 to 7.3.0 (#1079)
Bumps [heroku_hatchet](https://github.com/heroku/hatchet) from 7.2.0 to 7.3.0.
- [Release notes](https://github.com/heroku/hatchet/releases)
- [Changelog](https://github.com/heroku/hatchet/blob/main/CHANGELOG.md)
- [Commits](https://github.com/heroku/hatchet/compare/v7.2.0...v7.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-09-28 10:38:03 +01:00
Ed Morley 6c612a7fb1 Release v180 (#1078)
Closes @W-8120452@.
v180
2020-09-24 19:17:18 +01:00
Ed Morley f91f4ee4ce Add support for Python 3.8.6 (#1072)
https://www.python.org/downloads/release/python-386/
https://pythoninsider.blogspot.com/2020/09/python-386-is-now-available.html

Closes @W-7791243@.
2020-09-24 18:55:27 +01:00
Eric Carmichael eea9a7fd0f Fix code comment typo in bin/steps/pipenv (#1076) 2020-09-23 14:49:46 +01:00
Ed Morley 215a3e3670 Release v179 (#1073) v179 2020-09-23 11:15:54 +01:00
Ed Morley 4505968fcb Tests: Remove redundant Python version tests (#1075)
There were previously 6 virtually identical tests checking the handling of
a non-existent Python version being specified in `runtime.txt`. 

Only one is necessary - removing the rest will improve CI run time.

Closes @W-8110383@.

[skip changelog]
2020-09-22 18:48:31 +01:00
Ed Morley 37d1474bee Tests: Prevent shadowing of the Python 3.7 version warning test (#1074)
Previously the test for Python 3.8 version warnings was named the same
as an earlier test for Python 3.7, meaning the earlier test definition
was overwritten and so never run.

The later test has now been renamed to the correct version, and the
test ordering adjusted for consistency with the rest of the file.

Closes @W-8110123@.

[skip changelog]
2020-09-22 18:04:11 +01:00
dependabot[bot] 40167d83f6 Bump heroku_hatchet from 7.1.3 to 7.2.0 (#1071)
Bumps [heroku_hatchet](https://github.com/heroku/hatchet) from 7.1.3 to 7.2.0.
- [Release notes](https://github.com/heroku/hatchet/releases)
- [Changelog](https://github.com/heroku/hatchet/blob/main/CHANGELOG.md)
- [Commits](https://github.com/heroku/hatchet/compare/v7.1.3...v7.2.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-09-21 12:41:14 +01:00
Ed Morley 64fb396b73 Remove duplicate pipenv metric event (#1070)
Since the `tool.pipenv` event is being emitted twice per pipenv build,
inflating its usage.

This whole file could do with a massive refactor (4 levels deep of
conditionals is never a good sign), but that can wait until a later PR.

In the future it would also be great to have testing of metrics events.

Closes @W-8094963@.
2020-09-18 19:04:28 +01:00
Ed Morley eb6ee49dfe Emit metrics for how the Python version was chosen (#1069)
Currently an app's Python version can be set via a few different means:
- explicitly by the user (via `runtime.txt` or `Pipfile.lock`)
- implicitly via the sticky versions feature (for existing apps)
- implicitly via default version for new apps / those with empty cache

In order to determine the priority of features like automatic Python
patch version upgrades for sticky-versioned apps, it's useful to have
metrics for these.

There were previously no tests for either the sticky versions feature,
or changing the Python version by updating the `runtime.txt` file, so
I've added some now (given that I updated the conditional to add the
metrics, so useful to have coverage).

I've also removed the confusing overwrite of `DEFAULT_PYTHON_VERSION`
with the cached version, and kept them as two separate variables.

Closes @W-8099632@.
Closes @W-8099645@.
2020-09-18 18:48:57 +01:00
Ed Morley 64abfb2978 Emit Python version metric events for all builds (#1066)
Previously the metric events describing the chosen Python version were
only emitted when that Python version was installed, and not when it
was being used from the build cache (the common case).

Now the version is emitted for all builds, improving visibility into
the distribution of Python usage, and helping determine the priority
of features like opt-in automatic Python patch updates.

Closes @W-8059668@.
2020-09-16 12:28:15 +01:00