Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
mozilla/sumo#1181
Summary
This PR provides an almost complete update of everything in the project with the exception of our
node
packages, which will be done in a separate PR:Dockerfile
(3.10-bullseye
-->3.11-bullseye
).circleci/config.yml
.pre-commit-config.yaml
that matchpyproject.toml
.readthedocs.yml
poetry
dependencies, includingdev
group dependencies, to their latest versions, with the following exceptions and notes:pip
was updated inDockerfile
to its latest version, but removed as apoetry
dependency, since it's already installed via theDockerfile
.elasticsearch
was updated to the latest version7
(7.17.8
). The upgrade to version8
remains as a separate task that requires a matching upgrade to our ES server as well.black
was updated to22.12.0
, but not to its latest version23.1.0
, because version23.1.0
introduces some formatting changes that will modify a significant number of our Python files. I thought it best to updateblack
to version23.1.0
as a separate PR after this PR is merged.black
was updated to the newly-supportedpy311
.Sphinx
was updated to5.3.0
, not to the latest version6.1.3
, only because thesphinx-rtd-theme
package does not yet support version6
or above.django-ratelimit
included a change to its import name fromratelimit
todjango_ratelimit
.django-timezone-field
package no longer usespytz.timezone
for itsTimeZoneField
, but instead uses the built-inzoneinfo.ZoneInfo
timezone. This meant a few minor changes, but fortunately does not require a database data migration for theProfile.timezone
field, since the supported time zone strings are exactly the same.pytz
was completely removed. With packages likedjango-timezone-field
andDjango
moving away frompytz
, as well as the fact thatDjango
version5
will no longer supportpytz
time zones at all, I decided it was time to remove it altogether. After lots of reading and confusion, it was pretty easy in the end. I followed the migration guide provided by the creator of Python's built-inzoneinfo
module, which boiled down to two things:pytz.timezone
instances withzoneinfo.ZoneInfo
instancespytz.timezone(...).localize(datetime_instance)
calls withdatetime_instance.replace(tzinfo=ZoneInfo(...))
calls. The newreplace
method ondatetime.datetime
instances includes a newfold
keyword parameter which handles the possible "ambiguous" and "imaginary" times within time zones likeUS/Pacific
that include daylight-savings-time (DST) changes (fold
defaults to0
, so it makes that choice of how to interpret "ambiguous" and "imaginary" times for you by default).django.utils.timezone.make_aware
function no longer supportsis_dst
, so I removed it from the one place it was used. It's no longer needed due to the fact that "under the hood",Django
uses thedatetime.datetime.replace
method which includes the newfold
parameter mentioned above.bleach
package includes two breaking changes:ALLOWED_TAGS
is now afrozenset
instead of alist
. In fact, thebleach.clean
function prefers aset
now instead of alist
for itstags
keyword argument, but you can still pass-in alist
andbleach.clean
will convert it to aset
for you, so no worries there.bleach.clean
function no longer accepts astyles
keyword argument, which has been replaced by thecss_sanitizer
argument instead. In the end, for our purposes, it boils down to replacingstyles=styles
withcss_sanitizer=CSSSanitizer(allowed_css_properties=styles)
in the keyword arguments when callingbleach.clean
.TODO in Separate PR's
black
to version23.1.0
(and reformat all of our Python files) in a separate PR.node
packages.