Some notes on the use of python with GOV.UK PaaS
The python buildpack docs are at https://docs.cloudfoundry.org/buildpacks/python/index.html
The current python buildpack is v1.7.13 https://github.com/cloudfoundry/python-buildpack/releases/tag/v1.7.13
There is a pending buildpack upgrade to v1.7.14 https://github.com/cloudfoundry/python-buildpack/releases/tag/v1.7.1
we expect the upgrade to happen by DATE
You can specify a custom buildpack by explicitly specifying the version using the -b switch on the the cli
cf push -b https://github.com/cloudfoundry/python-buildpack/#v1.7.14 foobar
Python 2 is deprecated
supports python 3.8.2
specify the version to use in your app in the runtime.txt file
specify the start command in the Procfile
add dependencies to requirements.txt
| module | description |
|---|---|
| boto3 | amazon api |
| cloudfoundry-client | cloud foundry client |
| schedule | run scheduled tasks |
There is a simple 50 line sample app in the incubator project that uses Flask and gunicorn https://github.com/alphagov/paas-incubator/tree/master/helloworld-examples/python-flask
There is no intrinsic support for scheduled tasks in the paas see https://github.com/alphagov/paas-roadmap/issues/52 however the python schedule module provides a scheduling mechanism https://pypi.org/project/schedule/
use the cloudfoundry-client module to access the cloud foundry api from python https://github.com/cloudfoundry-community/cf-python-client
cf tasks supports execution in a container https://docs.cloudfoundry.org/devguide/using-tasks.html for database migrations and other batch processing