diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 3f82aaa0dc3..ae0f0db498f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -26,7 +26,7 @@ This checklist is for your information. - [ ] Bugfixes should be submitted against the `bugfix` branch. - [ ] Give a meaningful name to your PR, as it may end up being used in the release notes. - [ ] Your code is flake8 compliant. -- [ ] Your code is python 3.11 compliant. +- [ ] Your code is python 3.12 compliant. - [ ] If this is a new feature and not a bug fix, you've included the proper documentation in the docs at https://github.com/DefectDojo/django-DefectDojo/tree/dev/docs as part of this PR. - [ ] Model changes must include the necessary migrations in the dojo/db_migrations folder. - [ ] Add applicable tests to the unit tests. diff --git a/Dockerfile.django-alpine b/Dockerfile.django-alpine index 643492d6b55..68f6026cfea 100644 --- a/Dockerfile.django-alpine +++ b/Dockerfile.django-alpine @@ -5,7 +5,7 @@ # Dockerfile.nginx to use the caching mechanism of Docker. # Ref: https://devguide.python.org/#branchstatus -FROM python:3.11.13-alpine3.22@sha256:8d8c6d3808243160605925c2a7ab2dc5c72d0e75651699b0639143613e0855b8 AS base +FROM python:3.12.11-alpine3.22@sha256:02a73ead8397e904cea6d17e18516f1df3590e05dc8823bd5b1c7f849227d272 AS base FROM base AS build WORKDIR /app RUN \ diff --git a/Dockerfile.django-debian b/Dockerfile.django-debian index 6b1c4a21f1e..16a92d4223f 100644 --- a/Dockerfile.django-debian +++ b/Dockerfile.django-debian @@ -5,7 +5,7 @@ # Dockerfile.nginx to use the caching mechanism of Docker. # Ref: https://devguide.python.org/#branchstatus -FROM python:3.11.13-slim-trixie@sha256:1d6131b5d479888b43200645e03a78443c7157efbdb730e6b48129740727c312 AS base +FROM python:3.12.11-slim-trixie@sha256:d67a7b66b989ad6b6d6b10d428dcc5e0bfc3e5f88906e67d490c4d3daac57047 AS base FROM base AS build WORKDIR /app RUN \ diff --git a/Dockerfile.integration-tests-debian b/Dockerfile.integration-tests-debian index 4db20eb53e4..a9b7f9d9034 100644 --- a/Dockerfile.integration-tests-debian +++ b/Dockerfile.integration-tests-debian @@ -3,7 +3,7 @@ FROM openapitools/openapi-generator-cli:v7.15.0@sha256:509f01c3c7eee9d1ad286506a7b6aa4624a95b410be9a238a306d209e900621f AS openapitools # currently only supports x64, no arm yet due to chrome and selenium dependencies -FROM python:3.11.13-slim-trixie@sha256:1d6131b5d479888b43200645e03a78443c7157efbdb730e6b48129740727c312 AS build +FROM python:3.12.11-slim-trixie@sha256:d67a7b66b989ad6b6d6b10d428dcc5e0bfc3e5f88906e67d490c4d3daac57047 AS build WORKDIR /app RUN \ apt-get -y update && \ diff --git a/Dockerfile.nginx-alpine b/Dockerfile.nginx-alpine index 54eefe0d2ba..93bfdfd1f19 100644 --- a/Dockerfile.nginx-alpine +++ b/Dockerfile.nginx-alpine @@ -5,8 +5,7 @@ # Dockerfile.django-alpine to use the caching mechanism of Docker. # Ref: https://devguide.python.org/#branchstatus -FROM python:3.11.13-alpine3.22@sha256:8d8c6d3808243160605925c2a7ab2dc5c72d0e75651699b0639143613e0855b8 AS base - +FROM python:3.12.11-alpine3.22@sha256:02a73ead8397e904cea6d17e18516f1df3590e05dc8823bd5b1c7f849227d272 AS base FROM base AS build WORKDIR /app RUN \ diff --git a/dojo/jira_link/views.py b/dojo/jira_link/views.py index 24161edf7d6..75949aec7bf 100644 --- a/dojo/jira_link/views.py +++ b/dojo/jira_link/views.py @@ -387,7 +387,7 @@ def post(self, request): create_notification( event="jira_config_added", title=f"New addition of JIRA: {jform.cleaned_data.get('configuration_name')}", - description=f"JIRA \"{jform.cleaned_data.get('configuration_name')}\" was added by {request.user}", + description=f'JIRA "{jform.cleaned_data.get('configuration_name')}" was added by {request.user}', url=request.build_absolute_uri(reverse("jira"))) return HttpResponseRedirect(reverse("jira")) @@ -432,7 +432,7 @@ def post(self, request): create_notification( event="jira_config_added", title=f"New addition of JIRA: {jform.cleaned_data.get('configuration_name')}", - description=f"JIRA \"{jform.cleaned_data.get('configuration_name')}\" was added by {request.user}", + description=f'JIRA "{jform.cleaned_data.get('configuration_name')}" was added by {request.user}', url=request.build_absolute_uri(reverse("jira"))) return HttpResponseRedirect(reverse("jira")) @@ -486,7 +486,7 @@ def post(self, request, jid=None): create_notification( event="jira_config_edited", title=f"Edit of JIRA: {jform.cleaned_data.get('configuration_name')}", - description=f"JIRA \"{jform.cleaned_data.get('configuration_name')}\" was edited by {request.user}", + description=f'JIRA "{jform.cleaned_data.get('configuration_name')}" was edited by {request.user}', url=request.build_absolute_uri(reverse("jira"))) return HttpResponseRedirect(reverse("jira")) diff --git a/dojo/metrics/utils.py b/dojo/metrics/utils.py index cf3e2813e13..eac3a4adba5 100644 --- a/dojo/metrics/utils.py +++ b/dojo/metrics/utils.py @@ -343,7 +343,7 @@ def get_date_range( return start_date, end_date -def severity_count( +def severity_count[MetricsQuerySet: (QuerySet[Finding], QuerySet[Endpoint_Status])]( queryset: MetricsQuerySet, method: str, expression: str, @@ -407,7 +407,7 @@ def js_epoch( return int(d.timestamp()) * 1000 -def get_charting_data( +def get_charting_data[MetricsQuerySet: (QuerySet[Finding], QuerySet[Endpoint_Status])]( qs: MetricsQuerySet, start_date: date, period: MetricsPeriod, @@ -470,7 +470,7 @@ def period_deltas(start_date, end_date): return weeks_between, months_between -def aggregate_counts_by_period( +def aggregate_counts_by_period[MetricsQuerySet: (QuerySet[Finding], QuerySet[Endpoint_Status])]( qs: MetricsQuerySet, period: MetricsPeriod, metrics_type: MetricsType, @@ -580,7 +580,7 @@ def get_closed_in_period_details( ) -def findings_queryset( +def findings_queryset[MetricsQuerySet: (QuerySet[Finding], QuerySet[Endpoint_Status])]( qs: MetricsQuerySet, ) -> QuerySet[Finding]: """ diff --git a/readme-docs/CONTRIBUTING.md b/readme-docs/CONTRIBUTING.md index 18385affb85..e440f498c07 100644 --- a/readme-docs/CONTRIBUTING.md +++ b/readme-docs/CONTRIBUTING.md @@ -56,7 +56,7 @@ Please use [these test scripts](../tests) to test your changes. These are the sc For changes that require additional settings, you can now use local_settings.py file. See the logging section below for more information. ## Python3 Version -For compatibility reasons, the code in dev branch should be python3.11 compliant. +For compatibility reasons, the code in dev branch should be python3.12 compliant. ## Database migrations When changes are made to the database model, a database migration is needed. This migration can be generated using something like @@ -82,7 +82,7 @@ DefectDojo. 0. Pull requests should be submitted to the `dev` or `bugfix` branch. -0. In dev branch, the code should be python 3.11 compliant. +0. In dev branch, the code should be python 3.12 compliant. [dojo_settings]: /dojo/settings/settings.dist.py "DefectDojo settings file" [pep8]: https://www.python.org/dev/peps/pep-0008/ "PEP8" diff --git a/requirements.txt b/requirements.txt index af282864d6f..0e9f5824f72 100644 --- a/requirements.txt +++ b/requirements.txt @@ -70,3 +70,4 @@ fontawesomefree==6.6.0 PyYAML==6.0.2 pyopenssl==25.1.0 parameterized==0.9.0 +setuptools==80.9.0 diff --git a/ruff.toml b/ruff.toml index 9398b76e7e2..273ff180496 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,5 +1,5 @@ -# Always generate Python 3.11-compatible code. -target-version = "py311" +# Always generate Python 3.12-compatible code. +target-version = "py312" # Same as Black. line-length = 120