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

Release 0.159.0 #3128

Merged
merged 18 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c0ea374
Python upgrade from 3.9.x to 3.12.x (#3089)
mudassir-hafeez Aug 28, 2024
d11b051
fix(deps): update dependency webpack to v5.94.0 [security]
renovate[bot] Aug 28, 2024
3a9130d
fix(deps): update dependency pygsheets to v2.0.6 (#2736)
renovate[bot] Aug 28, 2024
a4f6bb3
fix(deps): update dependency zeep to v4 (#3062)
renovate[bot] Aug 28, 2024
96113f5
feat: display tax details for countries where taxes are enabled (#3109)
asadali145 Aug 28, 2024
7181c58
chore(deps): lock file maintenance (#3113)
renovate[bot] Aug 29, 2024
4ae0542
fix(deps): update python to v3.12.5 (#3003)
renovate[bot] Aug 29, 2024
ebc37f9
chore(deps): update nginx docker tag to v1.27.1 (#3114)
renovate[bot] Aug 29, 2024
c9bd325
chore(deps): update node.js to v20.17.0 (#3116)
renovate[bot] Aug 29, 2024
637c891
chore(deps): update postgres docker tag to v15.8 (#3117)
renovate[bot] Aug 29, 2024
24ca245
fix(deps): update dependency boto3 to v1.35.8
renovate[bot] Aug 29, 2024
974ef2e
Merge branch 'release'
odlbot Aug 29, 2024
331266f
fix(deps): update dependency django-hijack to v3.6.0
renovate[bot] Aug 29, 2024
7a4af2f
fix(deps): update dependency django-robots to v6.1
renovate[bot] Aug 29, 2024
972b8bd
fix(deps): update dependency google-api-python-client to v2.143.0
renovate[bot] Aug 29, 2024
01f623d
fix(deps): update dependency google-auth to v2.34.0
renovate[bot] Aug 29, 2024
ee7e289
fix(deps): update dependency css-loader to v7 (#3086)
renovate[bot] Sep 3, 2024
767e1f7
Release 0.159.0
odlbot Sep 4, 2024
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
23 changes: 18 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:

services:
db:
image: postgres:15.7
image: postgres:15.8
# Health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
Expand Down Expand Up @@ -45,20 +45,32 @@ jobs:
- name: Apt install
run: cat Aptfile | sudo xargs apt-get install

- name: Set up Python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.12.5"

- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.8.2
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv

- name: Set up Python
uses: actions/setup-python@v4
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
python-version: "3.9.15"
cache: "poetry"
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Install project
run: poetry install --no-interaction

# Configurations required for elasticsearch.
Expand Down Expand Up @@ -93,6 +105,7 @@ jobs:

- name: Tests
run: |
source .venv/bin/activate
export MEDIA_ROOT="$(mktemp -d)"
poetry run ./scripts/test/python_tests.sh
env:
Expand Down
6 changes: 3 additions & 3 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,16 @@
"filename": "users/api.py",
"hashed_secret": "f205fad2d580e981bb53020ed8f77c0cb7c35014",
"is_verified": false,
"line_number": 165
"line_number": 163
},
{
"type": "Base64 High Entropy String",
"filename": "users/api.py",
"hashed_secret": "915109282e07e7e73fb6939dd221f675e60d118f",
"is_verified": false,
"line_number": 168
"line_number": 166
}
]
},
"generated_at": "2024-05-22T09:32:37Z"
"generated_at": "2024-08-06T16:53:29Z"
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9.15
FROM python:3.12.5
LABEL maintainer "ODL DevOps <[email protected]>"

# Add package files, install updated node and pip
Expand Down
20 changes: 20 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
Release Notes
=============

Version 0.159.0
---------------

- fix(deps): update dependency css-loader to v7 (#3086)
- fix(deps): update dependency google-auth to v2.34.0
- fix(deps): update dependency google-api-python-client to v2.143.0
- fix(deps): update dependency django-robots to v6.1
- fix(deps): update dependency django-hijack to v3.6.0
- fix(deps): update dependency boto3 to v1.35.8
- chore(deps): update postgres docker tag to v15.8 (#3117)
- chore(deps): update node.js to v20.17.0 (#3116)
- chore(deps): update nginx docker tag to v1.27.1 (#3114)
- fix(deps): update python to v3.12.5 (#3003)
- chore(deps): lock file maintenance (#3113)
- feat: display tax details for countries where taxes are enabled (#3109)
- fix(deps): update dependency zeep to v4 (#3062)
- fix(deps): update dependency pygsheets to v2.0.6 (#2736)
- fix(deps): update dependency webpack to v5.94.0 [security]
- Python upgrade from 3.9.x to 3.12.x (#3089)

Version 0.158.0 (Released August 29, 2024)
---------------

Expand Down
2 changes: 1 addition & 1 deletion affiliate/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class AffiliateFactory(DjangoModelFactory):
"""Factory for Affiliate"""

code = factory.Sequence("affiliate-code-{0}".format)
code = factory.Sequence("affiliate-code-{}".format)
name = fuzzy.FuzzyText(prefix="Affiliate ", length=30)

class Meta:
Expand Down
2 changes: 1 addition & 1 deletion authentication/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def create_user_with_generated_username(serializer, initial_username):
while created_user is None and attempts < USERNAME_COLLISION_ATTEMPTS:
try:
created_user = serializer.save(username=username)
except IntegrityError as exc: # noqa: PERF203
except IntegrityError as exc:
if not is_duplicate_username_error(exc):
raise
username = find_available_username(initial_username)
Expand Down
2 changes: 1 addition & 1 deletion authentication/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def process_exception(self, request, exception):
url = self.get_redirect_uri(request, exception)

if url: # noqa: RET503
url += ("?" in url and "&" or "?") + "message={0}&backend={1}".format( # noqa: UP030, UP032
url += ("?" in url and "&" or "?") + "message={}&backend={}".format( # noqa: UP032
quote(message), backend_name
)
return redirect(url)
2 changes: 1 addition & 1 deletion authentication/pipeline/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def create_user_via_email(
created_user = create_user_with_generated_username(serializer, username)
if created_user is None:
raise IntegrityError( # noqa: TRY301
"Failed to create User with generated username ({})".format(username) # noqa: EM103, UP032
f"Failed to create User with generated username ({username})" # noqa: EM102
)
except Exception as exc:
raise UserCreationFailedException(backend, current_partial) from exc
Expand Down
6 changes: 3 additions & 3 deletions b2b_ecommerce/factories.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Factories for b2b_ecommerce"""

from datetime import timezone
from datetime import UTC

import factory
from factory import fuzzy
Expand Down Expand Up @@ -46,10 +46,10 @@ class B2BCouponFactory(DjangoModelFactory):
name = fuzzy.FuzzyText()
coupon_code = fuzzy.FuzzyText()
activation_date = factory.Faker(
"date_time_this_year", before_now=True, after_now=False, tzinfo=timezone.utc
"date_time_this_year", before_now=True, after_now=False, tzinfo=UTC
)
expiration_date = factory.Faker(
"date_time_this_year", before_now=False, after_now=True, tzinfo=timezone.utc
"date_time_this_year", before_now=False, after_now=True, tzinfo=UTC
)
enabled = True
reusable = False
Expand Down
4 changes: 2 additions & 2 deletions cms/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import itertools
import logging
from datetime import MAXYEAR, datetime, timezone
from datetime import MAXYEAR, UTC, datetime

from django.contrib.contenttypes.models import ContentType
from wagtail.models import Page, Site
Expand Down Expand Up @@ -44,7 +44,7 @@ def filter_and_sort_catalog_pages(

page_run_dates = {
page: page.product.next_run_date
or datetime(year=MAXYEAR, month=1, day=1, tzinfo=timezone.utc)
or datetime(year=MAXYEAR, month=1, day=1, tzinfo=UTC)
for page in itertools.chain(
valid_program_pages,
valid_course_pages,
Expand Down
8 changes: 4 additions & 4 deletions cms/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Meta:
class ProgramPageFactory(wagtail_factories.PageFactory):
"""ProgramPage factory class"""

title = factory.Sequence("Test page - Program {0}".format)
title = factory.Sequence("Test page - Program {}".format)
program = factory.SubFactory(ProgramFactory, page=None)
subhead = factory.fuzzy.FuzzyText(prefix="Subhead ")
thumbnail_image = factory.SubFactory(wagtail_factories.ImageFactory)
Expand Down Expand Up @@ -99,7 +99,7 @@ def post_gen(obj, create, extracted, **kwargs): # noqa: ARG002, N805
class CoursePageFactory(wagtail_factories.PageFactory):
"""CoursePage factory class"""

title = factory.Sequence("Test page - Course {0}".format)
title = factory.Sequence("Test page - Course {}".format)
course = factory.SubFactory(CourseFactory, page=None)
subhead = factory.fuzzy.FuzzyText(prefix="Subhead ")
thumbnail_image = factory.SubFactory(wagtail_factories.ImageFactory)
Expand Down Expand Up @@ -131,7 +131,7 @@ class ExternalCoursePageFactory(wagtail_factories.PageFactory):

course = factory.SubFactory(CourseFactory, page=None)

title = factory.Sequence("Test page - External Course {0}".format)
title = factory.Sequence("Test page - External Course {}".format)
external_marketing_url = factory.Faker("uri")
marketing_hubspot_form_id = factory.Faker("bothify", text="??????????")
subhead = factory.fuzzy.FuzzyText(prefix="Subhead ")
Expand Down Expand Up @@ -160,7 +160,7 @@ class ExternalProgramPageFactory(wagtail_factories.PageFactory):

program = factory.SubFactory(ProgramFactory, page=None)

title = factory.Sequence("Test page - External Program {0}".format)
title = factory.Sequence("Test page - External Program {}".format)
external_marketing_url = factory.Faker("uri")
marketing_hubspot_form_id = factory.Faker("bothify", text="??????????")
subhead = factory.fuzzy.FuzzyText(prefix="Subhead ")
Expand Down
2 changes: 1 addition & 1 deletion cms/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def clean(self):

cleaned_data = super().clean()
parent_page = self.parent_page.specific
if (isinstance(parent_page, (CoursePage, ProgramPage))) and not cleaned_data[
if (isinstance(parent_page, (CoursePage, ProgramPage))) and not cleaned_data[ # noqa: UP038
"signatories"
]:
self.add_error("signatories", "Signatories is a required field.")
Expand Down
4 changes: 2 additions & 2 deletions cms/migrations/0054_create_external_courseware_asociations.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 3.2.18 on 2023-03-16 12:26


from datetime import datetime, timezone
from datetime import UTC, datetime

import django.db.models.deletion
from django.db import migrations, models
Expand All @@ -13,7 +13,7 @@

def get_zone_aware_datetime(date):
"""Takes a date object and returns a zone aware datetime"""
return datetime.combine(date, datetime.max.time(), timezone.utc) if date else None
return datetime.combine(date, datetime.max.time(), UTC) if date else None


def check_and_generate_associated_product(
Expand Down
10 changes: 5 additions & 5 deletions cms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def get_context(self, request, *args, **kwargs):
.exclude(Q(category=UPCOMING_WEBINAR) & Q(date__lt=now_in_utc().date()))
.order_by("-category", "date")
)
webinars_dict = defaultdict(lambda: []) # noqa: PIE807
webinars_dict = defaultdict(list)
for webinar in webinars:
webinar.detail_page_url = webinar.detail_page_url(request)
webinars_dict[webinar.category].append(webinar)
Expand Down Expand Up @@ -1028,7 +1028,7 @@ def get_url_parts(self, request=None):
# of the Course/Program instead (e.g.: "/courses/course-v1:edX+DemoX+Demo_Course")
re.sub(
self.slugged_page_path_pattern,
r"\1{}\3".format(self.product.readable_id), # noqa: UP032
rf"\1{self.product.readable_id}\3",
url_parts[2],
),
)
Expand Down Expand Up @@ -1123,7 +1123,7 @@ def is_course_page(self):
@property
def is_internal_or_external_course_page(self):
"""Gets the product page type, this is used for sorting product pages."""
return isinstance(self, (CoursePage, ExternalCoursePage))
return isinstance(self, (CoursePage, ExternalCoursePage)) # noqa: UP038

@property
def external_courseware_url(self):
Expand All @@ -1148,7 +1148,7 @@ def is_program_page(self):
@property
def is_internal_or_external_program_page(self):
"""Check whether the page is an internal or external program page."""
return isinstance(self, (ProgramPage, ExternalProgramPage))
return isinstance(self, (ProgramPage, ExternalProgramPage)) # noqa: UP038

@property
def is_external_page(self):
Expand Down Expand Up @@ -1508,7 +1508,7 @@ class Meta:
def can_create_at(cls, parent):
# You can only create one of these page under course / program.
return (
super(CourseProgramChildPage, cls).can_create_at(parent) # noqa: UP008
super().can_create_at(parent)
and parent.get_children().type(cls).count() == 0
)

Expand Down
5 changes: 3 additions & 2 deletions compliance/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ def mock_cybersource_wsdl(mocked_responses, settings, service_version=SERVICE_VE
Mocks the responses to achieve a functional WSDL
"""
# in order for zeep to load the wsdl, it will load the wsdl and the accompanying xsd definitions
with open(f"{DATA_DIR}/CyberSourceTransaction_{service_version}.wsdl", "r") as wsdl: # noqa: PTH123, UP015
# Note: open() defaults to read mode ("r")
with open(f"{DATA_DIR}/CyberSourceTransaction_{service_version}.wsdl") as wsdl: # noqa: PTH123
mocked_responses.add(
mocked_responses.GET,
settings.CYBERSOURCE_WSDL_URL,
body=wsdl.read(),
status=status.HTTP_200_OK,
)
with open(f"{DATA_DIR}/CyberSourceTransaction_{SERVICE_VERSION}.xsd", "r") as xsd: # noqa: PTH123, UP015
with open(f"{DATA_DIR}/CyberSourceTransaction_{SERVICE_VERSION}.xsd") as xsd: # noqa: PTH123
mocked_responses.add(
mocked_responses.GET,
f"http://localhost/service/CyberSourceTransaction_{service_version}.xsd",
Expand Down
8 changes: 4 additions & 4 deletions courses/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get_user_enrollments(user):
for program_enrollment in program_enrollments
)
)
program_course_ids = set(course.id for course in program_courses) # noqa: C401
program_course_ids = {course.id for course in program_courses}
course_run_enrollments = (
CourseRunEnrollment.objects.select_related("run__course__coursepage", "company")
.filter(user=user)
Expand Down Expand Up @@ -143,7 +143,7 @@ def create_run_enrollments(
if not created and not enrollment.active:
enrollment.edx_enrolled = edx_request_success
enrollment.reactivate_and_save()
except: # noqa: E722, PERF203
except: # noqa: E722
mail_api.send_enrollment_failure_message(order, run, details=format_exc())
log.exception(
"Failed to create/update enrollment record (user: %s, run: %s, order: %s)",
Expand Down Expand Up @@ -184,7 +184,7 @@ def create_program_enrollments(user, programs, order=None, company=None):
)
if not created and not enrollment.active:
enrollment.reactivate_and_save()
except: # noqa: E722, PERF203
except: # noqa: E722
mail_api.send_enrollment_failure_message(
order, program, details=format_exc()
)
Expand Down Expand Up @@ -316,7 +316,7 @@ def defer_enrollment(
to_run = CourseRun.objects.get(courseware_id=to_courseware_id)
if from_enrollment.run == to_run:
raise ValidationError(
"Cannot defer to the same course run (run: {})".format(to_run.courseware_id) # noqa: EM103, UP032
f"Cannot defer to the same course run (run: {to_run.courseware_id})" # noqa: EM102
)
if not force and not to_run.is_not_beyond_enrollment:
raise ValidationError(
Expand Down
3 changes: 1 addition & 2 deletions courses/credentials.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Digital courseware credentials"""

import logging
from typing import Union
from urllib.parse import urljoin

from django.conf import settings
Expand Down Expand Up @@ -81,7 +80,7 @@ def build_course_run_credential(certificate: CourseRunCertificate) -> dict:


def build_digital_credential(
certificate: Union[ProgramCertificate, CourseRunCertificate], # noqa: FA100
certificate: ProgramCertificate | CourseRunCertificate,
learner_did: LearnerDID,
) -> dict:
"""Function for building certificate digital credentials"""
Expand Down
Loading
Loading