From 0230b66874762593f18b9cbdb3249d36288be380 Mon Sep 17 00:00:00 2001 From: Paul Traylor Date: Thu, 20 Jul 2023 14:10:14 +0900 Subject: [PATCH] Upgrade to Python3.9 We will upgrade more dependencies later, but this PR attempts to upgrade just the Python version, and the minimum number of dependencies to get our builds working again. We remove several pinned versions from requirements.in to better show some of our minimal requirements for the docker container. Our next PR will do some more updates of the requirements. --- .github/workflows/django.yml | 2 +- .github/workflows/sphinx.yml | 4 +- Dockerfile | 11 ++-- Makefile | 2 +- docker/requirements.in | 40 ++---------- docker/requirements.txt | 119 ++++++++--------------------------- setup.cfg | 5 +- 7 files changed, 46 insertions(+), 137 deletions(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 74cd5ab4d..a2b60699d 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.6", "3.7", "3.8"] + python-version: ["3.9"] services: mysql: diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index fed2851e4..cf4c05eda 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - python-version: ["3.6"] + python-version: ["3.9"] steps: - uses: actions/checkout@v3 @@ -28,6 +28,8 @@ jobs: - name: Build Docs run: make docs + env: + SYSTEM_PYTHON: python${{ matrix.python-version }} - name: Deploy to GitHub Pages if: ${{ github.ref == 'refs/heads/main' }} diff --git a/Dockerfile b/Dockerfile index 5cbfab252..9df56f4f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.6.9-alpine +FROM python:3.9-alpine LABEL maintainer=paul.traylor@linecorp.com ENV PYTHONDONTWRITEBYTECODE 1 @@ -9,14 +9,14 @@ ENV PROMGEN_CONFIG_DIR=/etc/promgen RUN adduser -D -u 1000 promgen promgen # Upgrade Pip -RUN pip install --no-cache-dir -U pip==20.0.2 +RUN pip install --no-cache-dir -U pip~=23.2 # Install MySQL Support RUN set -ex \ && apk add --no-cache mariadb-dev \ && apk add --no-cache --virtual build-deps build-base \ && pip --no-cache-dir install mysqlclient \ - && apk del build-deps + && apk del build-deps # Install Postgres Support RUN set -ex \ @@ -35,7 +35,10 @@ COPY --from=prom/prometheus:v2.26.0 /bin/promtool /usr/local/bin/promtool COPY docker/requirements.txt /tmp/requirements.txt -RUN pip install --no-cache-dir -r /tmp/requirements.txt +RUN set -ex \ + && apk add --no-cache --virtual build-deps build-base libffi-dev \ + && pip install --no-cache-dir -r /tmp/requirements.txt \ + && apk del build-deps COPY docker/docker-entrypoint.sh / COPY setup.py /usr/src/app/setup.py diff --git a/Makefile b/Makefile index 7d1fed061..1fc8b07d0 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ CELERY_BIN := $(ENV_DIR)/bin/celery SPHINX := $(ENV_DIR)/bin/sphinx-build DOCKER_TAG := promgen:local -SYSTEM_PYTHON ?= python3.6 +SYSTEM_PYTHON ?= python3.9 # Help 'function' taken from # https://gist.github.com/prwhite/8168133#gistcomment-2278355 diff --git a/docker/requirements.in b/docker/requirements.in index e3d187334..7344a00bd 100644 --- a/docker/requirements.in +++ b/docker/requirements.in @@ -1,36 +1,4 @@ -amqp==2.5.1 -atomicwrites==1.3.0 -billiard==3.6.1.0 -celery[redis]==4.3.0 -certifi==2019.9.11 -chardet==3.0.4 -defusedxml==0.6.0 ; python_version >= '3.0' -django-environ==0.4.5 -django-filter==2.4.0 -Django==3.2.13 -djangorestframework==3.11.2 -envdir==1.0.1 -gunicorn==19.9.0 -idna==2.8 -importlib-metadata==0.23 -kombu==4.6.3 -oauthlib==3.1.0 -prometheus-client==0.12.0 -pyjwt==1.7.1 -python-dateutil==2.8.0 -python3-openid==3.1.0 ; python_version >= '3.0' -pytz==2021.3 -pyyaml==5.4 -redis==3.2.1 -requests-oauthlib==1.2.0 -requests==2.25.1 -sentry_sdk==1.5.12 -setuptools>=39.2.0 -six==1.12.0 -social-auth-app-django==3.1.0 -social-auth-core==3.2.0 -sqlparse==0.3.0 -urllib3==1.26.5 -vine==1.3.0 -whitenoise==5.2.0 -zipp==0.6.0 +gunicorn # Need gunicorn for running in docker +# mysqlclient==1.4.1 # Installed manually for dependencies +sentry_sdk<1.20.0 # Still using Sentry 9 +whitenoise # Need whitenoise for serving files diff --git a/docker/requirements.txt b/docker/requirements.txt index 8d5a0a273..769741d45 100644 --- a/docker/requirements.txt +++ b/docker/requirements.txt @@ -1,160 +1,95 @@ # -# This file is autogenerated by pip-compile with python 3.6 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: # # pip-compile --no-emit-index-url --output-file=docker/requirements.txt docker/requirements.in setup.py # amqp==2.5.1 - # via - # -r docker/requirements.in - # kombu + # via kombu asgiref==3.4.1 # via django atomicwrites==1.3.0 - # via - # -r docker/requirements.in - # promgen (setup.py) + # via promgen (setup.py) billiard==3.6.1.0 - # via - # -r docker/requirements.in - # celery -celery[redis]==4.3.0 - # via - # -r docker/requirements.in - # promgen (setup.py) + # via celery +celery==4.3.0 + # via promgen (setup.py) certifi==2019.9.11 # via - # -r docker/requirements.in # requests # sentry-sdk chardet==3.0.4 + # via requests +defusedxml==0.6.0 # via - # -r docker/requirements.in - # requests -defusedxml==0.6.0 ; python_version >= "3.0" - # via - # -r docker/requirements.in # python3-openid # social-auth-core -django==3.2.13 +django==3.2.20 # via - # -r docker/requirements.in # django-filter # djangorestframework # promgen (setup.py) django-environ==0.4.5 - # via - # -r docker/requirements.in - # promgen (setup.py) + # via promgen (setup.py) django-filter==2.4.0 - # via - # -r docker/requirements.in - # promgen (setup.py) + # via promgen (setup.py) djangorestframework==3.11.2 - # via - # -r docker/requirements.in - # promgen (setup.py) + # via promgen (setup.py) envdir==1.0.1 - # via - # -r docker/requirements.in - # promgen (setup.py) + # via promgen (setup.py) gunicorn==19.9.0 # via -r docker/requirements.in idna==2.8 - # via - # -r docker/requirements.in - # requests -importlib-metadata==0.23 - # via -r docker/requirements.in + # via requests kombu==4.6.3 # via - # -r docker/requirements.in # celery # promgen (setup.py) -more-itertools==8.14.0 - # via zipp oauthlib==3.1.0 # via - # -r docker/requirements.in # requests-oauthlib # social-auth-core prometheus-client==0.12.0 - # via - # -r docker/requirements.in - # promgen (setup.py) + # via promgen (setup.py) pyjwt==1.7.1 - # via - # -r docker/requirements.in - # social-auth-core + # via social-auth-core python-dateutil==2.8.0 - # via - # -r docker/requirements.in - # promgen (setup.py) -python3-openid==3.1.0 ; python_version >= "3.0" - # via - # -r docker/requirements.in - # social-auth-core + # via promgen (setup.py) +python3-openid==3.1.0 + # via social-auth-core pytz==2021.3 # via - # -r docker/requirements.in # celery # django -pyyaml==5.4 - # via - # -r docker/requirements.in - # promgen (setup.py) -redis==3.2.1 - # via - # -r docker/requirements.in - # celery +pyyaml==6.0.1 + # via promgen (setup.py) requests==2.25.1 # via - # -r docker/requirements.in # promgen (setup.py) # requests-oauthlib # social-auth-core requests-oauthlib==1.2.0 - # via - # -r docker/requirements.in - # social-auth-core -sentry_sdk==1.5.12 + # via social-auth-core +sentry-sdk==1.9.0 # via -r docker/requirements.in six==1.12.0 # via - # -r docker/requirements.in # python-dateutil # social-auth-app-django # social-auth-core social-auth-app-django==3.1.0 - # via - # -r docker/requirements.in - # promgen (setup.py) + # via promgen (setup.py) social-auth-core==3.2.0 - # via - # -r docker/requirements.in - # social-auth-app-django + # via social-auth-app-django sqlparse==0.3.0 - # via - # -r docker/requirements.in - # django -typing-extensions==4.1.1 - # via asgiref + # via django urllib3==1.26.5 # via - # -r docker/requirements.in # requests # sentry-sdk vine==1.3.0 # via - # -r docker/requirements.in # amqp # celery whitenoise==5.2.0 # via -r docker/requirements.in -zipp==0.6.0 - # via - # -r docker/requirements.in - # importlib-metadata - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/setup.cfg b/setup.cfg index 7995d2682..b65e44b7b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,19 +23,20 @@ project_urls = Documentation = https://line.github.io/promgen/ [options] +python_requires = >=3.9 packages = find: install_requires = atomicwrites==1.3.0 celery==4.3.0 django-environ django-filter - Django>=3.2,<4.0 + Django~=3.2 djangorestframework==3.11.2 envdir kombu==4.6.3 prometheus-client python-dateutil==2.8.0 - pyyaml==5.4 + pyyaml requests==2.25.1 social-auth-app-django >= 2.0.0 include_package_data = True