From 3008ae0eecbe9661eec01e0343c4d1f956e6cc2b Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Wed, 22 Nov 2023 11:38:19 -0500 Subject: [PATCH 1/3] Upgrade to Python 3.12 --- .github/workflows/ci.yml | 2 +- README.md | 2 +- dev/django.Dockerfile | 2 +- pyproject.toml | 2 +- runtime.txt | 2 +- setup.py | 6 ++++-- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d90eebf..d257e046 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.12" - name: Install tox run: | pip install --upgrade pip diff --git a/README.md b/README.md index 7e94b00f..d330a08f 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ but allows developers to run Python code on their native system. ### Initial Setup 1. Run `docker-compose -f ./docker-compose.yml up -d` -2. Install Python 3.10 +2. Install Python 3.12 3. Install [`psycopg2` build prerequisites](https://www.psycopg.org/docs/install.html#build-prerequisites) 4. Create and activate a new Python virtualenv diff --git a/dev/django.Dockerfile b/dev/django.Dockerfile index c463c09c..e1d7a4cb 100644 --- a/dev/django.Dockerfile +++ b/dev/django.Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10-slim +FROM python:3.12-slim # Install system librarires for Python packages: # * psycopg2 RUN apt-get update && \ diff --git a/pyproject.toml b/pyproject.toml index 0197352d..ce3d64ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.black] line-length = 100 skip-string-normalization = true -target-version = ["py310"] +target-version = ["py312"] exclude='\.eggs|\.git|\.mypy_cache|\.tox|\.venv|_build|buck-out|build|dist' [tool.isort] diff --git a/runtime.txt b/runtime.txt index 119ff102..44f8fbe3 100644 --- a/runtime.txt +++ b/runtime.txt @@ -1 +1 @@ -python-3.10.7 +python-3.12.0 diff --git a/setup.py b/setup.py index 7f41f66c..6bdd2395 100644 --- a/setup.py +++ b/setup.py @@ -29,10 +29,10 @@ 'License :: OSI Approved :: Apache Software License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.12', 'Programming Language :: Python', ], - python_requires='>=3.10', + python_requires='>=3.12', packages=find_packages(), include_package_data=True, install_requires=[ @@ -53,6 +53,8 @@ 'isic-challenge-scoring>=5.6', 'requests', 'rules', + # See https://github.com/axnsan12/drf-yasg/issues/874 + 'setuptools', 'uritemplate', # Production-only 'django-composed-configuration[prod]>=0.20.1', From 347f1dac04e09e0ac0dfdfd45a1c43a7b58046c9 Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Wed, 22 Nov 2023 11:46:07 -0500 Subject: [PATCH 2/3] Upgrade django-s3-file-field --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6bdd2395..60099d37 100644 --- a/setup.py +++ b/setup.py @@ -58,7 +58,7 @@ 'uritemplate', # Production-only 'django-composed-configuration[prod]>=0.20.1', - 'django-s3-file-field[boto3]', + 'django-s3-file-field[s3]>=1', 'gunicorn', ], extras_require={ From 7f1c9b9391b07fcd21fc55ac4add900c893b7b26 Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Thu, 18 Jul 2024 12:59:55 -0400 Subject: [PATCH 3/3] Fix formatter changes --- stade/core/forms.py | 4 ++-- stade/core/tasks.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/stade/core/forms.py b/stade/core/forms.py index a19d434a..b315b660 100644 --- a/stade/core/forms.py +++ b/stade/core/forms.py @@ -147,11 +147,11 @@ def clean(self): def get_invites(self): for field in range(3): - if self.cleaned_data[f'initial_invite_{field+1}']: + if self.cleaned_data[f'initial_invite_{field + 1}']: yield TeamInvitation( sender=self.request.user, team=self.instance, - recipient=self.cleaned_data[f'initial_invite_{field+1}'].lower(), + recipient=self.cleaned_data[f'initial_invite_{field + 1}'].lower(), ) diff --git a/stade/core/tasks.py b/stade/core/tasks.py index 6b2548bb..93162e65 100644 --- a/stade/core/tasks.py +++ b/stade/core/tasks.py @@ -146,9 +146,10 @@ def _score_submission(submission): prediction_file: FieldFile = submission.test_prediction_file if submission.approach.task.type == Task.Type.SEGMENTATION: - with field_file_to_local_path(truth_file) as truth_file_path, field_file_to_local_path( - prediction_file - ) as prediction_file_path: + with ( + field_file_to_local_path(truth_file) as truth_file_path, + field_file_to_local_path(prediction_file) as prediction_file_path, + ): score = SegmentationScore.from_zip_file( truth_file_path, prediction_file_path,