Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade python to 3.13 #924

Merged
merged 3 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11' # matches what .pre-commit-config.yaml has
python-version: '3.13' # matches what .pre-commit-config.yaml has
- uses: pre-commit/[email protected]
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Supported hooks: https://pre-commit.com/hooks.html
# Running "make format" fixes most issues for you
default_language_version:
python: python3.11
python: python3.13
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
Expand All @@ -17,20 +17,20 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
rev: v3.19.1
hooks:
- id: pyupgrade
args:
- --py310-plus
- --py313-plus
- --keep-runtime-typing
- repo: https://github.com/adamchainz/django-upgrade
rev: "1.22.1"
rev: "1.22.2"
hooks:
- id: django-upgrade
args:
- --target-version=4.2
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.2
rev: v0.8.6
hooks:
- id: ruff
args:
Expand Down
8 changes: 4 additions & 4 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM python:3.11-slim-bullseye AS builder
MAINTAINER [email protected]
FROM python:3.13-slim-bullseye AS builder
LABEL org.opencontainers.image.authors="[email protected]"

RUN apt update && apt install --no-install-recommends -y \
build-essential \
Expand All @@ -14,7 +14,7 @@ RUN python -m pip install uwsgi
RUN python -m pip install --no-cache-dir --no-deps -r $PIP_REQUIREMENTS

# Start runtime image,
FROM python:3.11-slim-bullseye
FROM python:3.13-slim-bullseye
RUN useradd -U -r dsoapi
RUN apt update && apt install --no-install-recommends -y \
curl \
Expand All @@ -26,7 +26,7 @@ RUN apt update && apt install --no-install-recommends -y \

# Copy python build artifacts from builder image
COPY --from=builder /usr/local/bin/ /usr/local/bin/
COPY --from=builder /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/
COPY --from=builder /usr/local/lib/python3.13/site-packages/ /usr/local/lib/python3.13/site-packages/

WORKDIR /app
COPY . ./
Expand Down
8 changes: 4 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ sync: ## Install packages, remove unmentioned p

.PHONY: requirements
requirements: requirements.in requirements_dev.in ## Re-generate the requirements/base.txt file for pip.
pip-compile -v --generate-hashes --resolver=legacy --output-file requirements.txt requirements.in
pip-compile -v --generate-hashes --resolver=legacy --output-file requirements_dev.txt requirements_dev.in
pip-compile -v --generate-hashes --allow-unsafe --output-file requirements.txt requirements.in
pip-compile -v --generate-hashes --allow-unsafe --output-file requirements_dev.txt requirements_dev.in

.PHONY: upgrade
upgrade: ## Tool to upgrade the backend dependencies.
pur --patch=Django -r requirements.in
pur --no-recursive -r requirements_dev.in
pip-compile -v --generate-hashes --upgrade --output-file requirements.txt requirements.in
pip-compile -v --generate-hashes --upgrade --output-file requirements_dev.txt requirements_dev.in
pip-compile -v --generate-hashes --allow-unsafe --upgrade --output-file requirements.txt requirements.in
pip-compile -v --generate-hashes --allow-unsafe --upgrade --output-file requirements_dev.txt requirements_dev.in

##
## Testing:
Expand Down
10 changes: 5 additions & 5 deletions src/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ Markdown == 3.7
more-ds == 0.0.6
more-itertools == 10.5.0
openapi-spec-validator == 0.7.1
orjson == 3.10.12
pygments == 2.18.0
python-json-logger==2.0.7
orjson == 3.10.13
pygments == 2.19.1
python-json-logger==3.2.1
python-string-utils == 1.0.0
requests == 2.32.3
sentry-sdk == 2.19.2
urllib3 == 2.2.3
urllib3 == 2.3.0
urllib3-mock == 0.3.3
whitenoise == 6.8.2
zipp == 3.21.0
Expand All @@ -43,7 +43,7 @@ uwsgi-readiness-check == 0.2.0

# Testing
bandit == 1.8.0
cryptography >= 43.0.3
cryptography >= 44.0.0
flake8 == 7.1.1
flake8-blind-except == 0.2.1
flake8-colors == 0.1.9
Expand Down
1,211 changes: 604 additions & 607 deletions src/requirements.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/requirements_dev.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-r ./requirements.in

black==24.10.0
ruff==0.8.3
ruff==0.8.6
pytest-sugar==1.0.0
termcolor==2.5.0
pre-commit==4.0.1
Expand Down
1,381 changes: 691 additions & 690 deletions src/requirements_dev.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/rest_framework_dso/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def get_queryset_iterator(self, queryset: models.QuerySet) -> Iterable[models.Mo
else:
return queryset.iterator()

def _as_generator(self, data: models.QuerySet) -> Generator[models.Model, None, None]:
def _as_generator(self, data: models.QuerySet) -> Generator[models.Model]:
"""The list output as a plain generator."""
# When the output format needs a plain list (a non-JSON format), give it just that.
# The generator syntax still tricks DRF into reading the source bit by bit,
Expand Down
Loading