From ad0aabb1cd7c689066fe8447e3aaa5a199726610 Mon Sep 17 00:00:00 2001 From: Volodymyr Bergman Date: Tue, 26 Mar 2024 16:55:07 +0200 Subject: [PATCH] feat: [ACI-512] update CCX events payload (#6) * feat: [ACI-512] update CCX events payload * chore(deps): upgrade dependencies * feat(deps): add edx-ccx-keys library --- openedx_events/learning/data.py | 28 +++++++----- requirements/base.in | 1 + requirements/base.txt | 18 ++++---- requirements/ci.txt | 10 ++--- requirements/dev.txt | 64 +++++++++----------------- requirements/doc.txt | 80 ++++++++++++++------------------- requirements/pip-tools.txt | 13 +----- requirements/pip.txt | 2 +- requirements/quality.txt | 54 +++++++++------------- requirements/test.txt | 29 ++++++------ 10 files changed, 122 insertions(+), 177 deletions(-) diff --git a/openedx_events/learning/data.py b/openedx_events/learning/data.py index b8729d72..5394ca73 100644 --- a/openedx_events/learning/data.py +++ b/openedx_events/learning/data.py @@ -8,6 +8,7 @@ from typing import List, Optional import attr +from ccx_keys.locator import CCXLocator from opaque_keys.edx.keys import CourseKey, UsageKey @@ -497,21 +498,24 @@ class BadgeData: @attr.s(frozen=True) -class CcxCourseData(CourseData): +class CcxCourseData: """ - Attributes defined fir the Open edX custom course data object. + Represents data for a CCX (Custom Courses for edX) course. - Arguments: - master_course_key (str): identifier of the master Course object. - max_students_allowed (int): maximum number of students allowed on the custom course - coach (UserData): coach associated with the custom course + Attributes: + ccx_course_key (CCXLocator): The unique identifier for the CCX course. + master_course_key (CourseKey): The unique identifier for the original course from which the CCX is derived. + display_name (str): The name of the CCX course as it should appear to users. + coach_email (str): The email address of the coach (instructor) for the CCX course. + start (str, optional): The start date of the CCX course. Defaults to None, indicating no specific start date. + end (str, optional): The end date of the CCX course. Defaults to None, indicating no specific end date. + max_students_allowed (int, optional): The maximum number of students that can enroll in the CCX course. Defaults to None, indicating no limit. """ + ccx_course_key = attr.ib(type=CCXLocator) master_course_key = attr.ib(type=CourseKey) - max_students_allowed = attr.ib(type=int) - coach = attr.ib(type=UserData) - - # copypasted from CourseData to avoid ValueError display_name = attr.ib(type=str, factory=str) - start = attr.ib(type=datetime, default=None) - end = attr.ib(type=datetime, default=None) + coach_email = attr.ib(type=str, factory=str) + start = attr.ib(type=str, default=None) + end = attr.ib(type=str, default=None) + max_students_allowed = attr.ib(type=int, default=None) diff --git a/requirements/base.in b/requirements/base.in index 5afd59f7..3eb50114 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -6,3 +6,4 @@ django attrs fastavro edx-opaque-keys[django] +edx-ccx-keys \ No newline at end of file diff --git a/requirements/base.txt b/requirements/base.txt index 39de3aa4..d480ab66 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,15 +1,13 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade # -asgiref==3.7.2 +asgiref==3.8.1 # via django attrs==23.2.0 # via -r requirements/base.in -backports-zoneinfo==0.2.1 - # via django cffi==1.16.0 # via pynacl click==8.1.7 @@ -25,10 +23,14 @@ django-crum==0.7.9 # via edx-django-utils django-waffle==4.1.0 # via edx-django-utils +edx-ccx-keys==1.2.1 + # via -r requirements/base.in edx-django-utils==5.11.0 # via -r requirements/base.in edx-opaque-keys[django]==2.5.1 - # via -r requirements/base.in + # via + # -r requirements/base.in + # edx-ccx-keys fastavro==1.9.4 # via -r requirements/base.in newrelic==9.7.1 @@ -43,6 +45,8 @@ pymongo==3.13.0 # via edx-opaque-keys pynacl==1.5.0 # via edx-django-utils +six==1.16.0 + # via edx-ccx-keys sqlparse==0.4.4 # via django stevedore==5.2.0 @@ -50,6 +54,4 @@ stevedore==5.2.0 # edx-django-utils # edx-opaque-keys typing-extensions==4.10.0 - # via - # asgiref - # edx-opaque-keys + # via edx-opaque-keys diff --git a/requirements/ci.txt b/requirements/ci.txt index 9f335db1..d2b6fa68 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade @@ -12,7 +12,7 @@ colorama==0.4.6 # via tox distlib==0.3.8 # via virtualenv -filelock==3.13.1 +filelock==3.13.3 # via # tox # virtualenv @@ -28,11 +28,7 @@ pluggy==1.4.0 # via tox pyproject-api==1.6.1 # via tox -tomli==2.0.1 - # via - # pyproject-api - # tox -tox==4.14.1 +tox==4.14.2 # via -r requirements/ci.in virtualenv==20.25.1 # via tox diff --git a/requirements/dev.txt b/requirements/dev.txt index 2c162fe7..534a47aa 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,10 +1,10 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade # -asgiref==3.7.2 +asgiref==3.8.1 # via # -r requirements/quality.txt # django @@ -16,10 +16,6 @@ astroid==2.15.8 # pylint-celery attrs==23.2.0 # via -r requirements/quality.txt -backports-zoneinfo==0.2.1 - # via - # -r requirements/quality.txt - # django build==1.1.1 # via # -r requirements/pip-tools.txt @@ -66,7 +62,7 @@ colorama==0.4.6 # via # -r requirements/ci.txt # tox -coverage[toml]==7.4.3 +coverage[toml]==7.4.4 # via # -r requirements/quality.txt # pytest-cov @@ -101,19 +97,19 @@ docutils==0.20.1 # via # -r requirements/quality.txt # readme-renderer +edx-ccx-keys==1.2.1 + # via -r requirements/quality.txt edx-django-utils==5.11.0 # via -r requirements/quality.txt edx-lint==5.3.6 # via -r requirements/quality.txt edx-opaque-keys[django]==2.5.1 - # via -r requirements/quality.txt -exceptiongroup==1.2.0 # via # -r requirements/quality.txt - # pytest + # edx-ccx-keys fastavro==1.9.4 # via -r requirements/quality.txt -filelock==3.13.1 +filelock==3.13.3 # via # -r requirements/ci.txt # tox @@ -125,15 +121,8 @@ idna==3.6 importlib-metadata==6.11.0 # via # -c https://raw.githubusercontent.com/openedx/edx-lint/master/edx_lint/files/common_constraints.txt - # -r requirements/pip-tools.txt # -r requirements/quality.txt - # build - # keyring # twine -importlib-resources==6.3.0 - # via - # -r requirements/quality.txt - # keyring iniconfig==2.0.0 # via # -r requirements/quality.txt @@ -146,12 +135,20 @@ jaraco-classes==3.3.1 # via # -r requirements/quality.txt # keyring +jaraco-context==4.3.0 + # via + # -r requirements/quality.txt + # keyring +jaraco-functools==4.0.0 + # via + # -r requirements/quality.txt + # keyring jinja2==3.1.3 # via # -r requirements/quality.txt # code-annotations # diff-cover -keyring==24.3.1 +keyring==25.0.0 # via # -r requirements/quality.txt # twine @@ -179,11 +176,12 @@ more-itertools==10.2.0 # via # -r requirements/quality.txt # jaraco-classes + # jaraco-functools newrelic==9.7.1 # via # -r requirements/quality.txt # edx-django-utils -nh3==0.2.15 +nh3==0.2.17 # via # -r requirements/quality.txt # readme-renderer @@ -280,7 +278,7 @@ pytest==8.1.1 # -r requirements/quality.txt # pytest-cov # pytest-django -pytest-cov==4.1.0 +pytest-cov==5.0.0 # via -r requirements/quality.txt pytest-django==4.8.0 # via -r requirements/quality.txt @@ -316,6 +314,7 @@ rich==13.7.1 six==1.16.0 # via # -r requirements/quality.txt + # edx-ccx-keys # edx-lint snowballstemmer==2.2.0 # via @@ -335,35 +334,18 @@ text-unidecode==1.3 # via # -r requirements/quality.txt # python-slugify -tomli==2.0.1 - # via - # -r requirements/ci.txt - # -r requirements/pip-tools.txt - # -r requirements/quality.txt - # build - # coverage - # pip-tools - # pylint - # pyproject-api - # pyproject-hooks - # pytest - # tox tomlkit==0.12.4 # via # -r requirements/quality.txt # pylint -tox==4.14.1 +tox==4.14.2 # via -r requirements/ci.txt twine==5.0.0 # via -r requirements/quality.txt typing-extensions==4.10.0 # via # -r requirements/quality.txt - # asgiref - # astroid # edx-opaque-keys - # pylint - # rich urllib3==2.2.1 # via # -r requirements/quality.txt @@ -381,12 +363,10 @@ wrapt==1.16.0 # via # -r requirements/quality.txt # astroid -zipp==3.18.0 +zipp==3.18.1 # via - # -r requirements/pip-tools.txt # -r requirements/quality.txt # importlib-metadata - # importlib-resources # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/requirements/doc.txt b/requirements/doc.txt index a174362d..ef49c4b9 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -1,14 +1,14 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade # accessible-pygments==0.0.4 # via pydata-sphinx-theme -alabaster==0.7.13 +alabaster==0.7.16 # via sphinx -asgiref==3.7.2 +asgiref==3.8.1 # via # -r requirements/test.txt # django @@ -18,10 +18,6 @@ babel==2.14.0 # via # pydata-sphinx-theme # sphinx -backports-zoneinfo==0.2.1 - # via - # -r requirements/test.txt - # django beautifulsoup4==4.12.3 # via pydata-sphinx-theme build==1.1.1 @@ -43,7 +39,7 @@ code-annotations==1.7.0 # via -r requirements/test.txt colorama==0.4.6 # via sphinx-autobuild -coverage[toml]==7.4.3 +coverage[toml]==7.4.4 # via # -r requirements/test.txt # pytest-cov @@ -66,21 +62,21 @@ django-waffle==4.1.0 # edx-django-utils doc8==1.1.1 # via -r requirements/doc.in -docutils==0.19 +docutils==0.20.1 # via # doc8 # pydata-sphinx-theme # readme-renderer # restructuredtext-lint # sphinx +edx-ccx-keys==1.2.1 + # via -r requirements/test.txt edx-django-utils==5.11.0 # via -r requirements/test.txt edx-opaque-keys[django]==2.5.1 - # via -r requirements/test.txt -exceptiongroup==1.2.0 # via # -r requirements/test.txt - # pytest + # edx-ccx-keys fastavro==1.9.4 # via -r requirements/test.txt idna==3.6 @@ -90,24 +86,23 @@ imagesize==1.4.1 importlib-metadata==6.11.0 # via # -c https://raw.githubusercontent.com/openedx/edx-lint/master/edx_lint/files/common_constraints.txt - # build - # keyring - # sphinx # twine -importlib-resources==6.3.0 - # via keyring iniconfig==2.0.0 # via # -r requirements/test.txt # pytest jaraco-classes==3.3.1 # via keyring +jaraco-context==4.3.0 + # via keyring +jaraco-functools==4.0.0 + # via keyring jinja2==3.1.3 # via # -r requirements/test.txt # code-annotations # sphinx -keyring==24.3.1 +keyring==25.0.0 # via twine livereload==2.6.3 # via sphinx-autobuild @@ -120,12 +115,14 @@ markupsafe==2.1.5 mdurl==0.1.2 # via markdown-it-py more-itertools==10.2.0 - # via jaraco-classes + # via + # jaraco-classes + # jaraco-functools newrelic==9.7.1 # via # -r requirements/test.txt # edx-django-utils -nh3==0.2.15 +nh3==0.2.17 # via readme-renderer packaging==24.0 # via @@ -152,7 +149,7 @@ pycparser==2.21 # via # -r requirements/test.txt # cffi -pydata-sphinx-theme==0.14.4 +pydata-sphinx-theme==0.15.2 # via sphinx-book-theme pygments==2.17.2 # via @@ -177,7 +174,7 @@ pytest==8.1.1 # -r requirements/test.txt # pytest-cov # pytest-django -pytest-cov==4.1.0 +pytest-cov==5.0.0 # via -r requirements/test.txt pytest-django==4.8.0 # via -r requirements/test.txt @@ -185,8 +182,6 @@ python-slugify==8.0.4 # via # -r requirements/test.txt # code-annotations -pytz==2024.1 - # via babel pyyaml==6.0.1 # via # -r requirements/test.txt @@ -207,12 +202,15 @@ rfc3986==2.0.0 rich==13.7.1 # via twine six==1.16.0 - # via livereload + # via + # -r requirements/test.txt + # edx-ccx-keys + # livereload snowballstemmer==2.2.0 # via sphinx soupsieve==2.5 # via beautifulsoup4 -sphinx==6.2.1 +sphinx==7.2.6 # via # -r requirements/doc.in # pydata-sphinx-theme @@ -220,27 +218,27 @@ sphinx==6.2.1 # sphinx-book-theme # sphinx-copybutton # sphinxcontrib-contentui -sphinx-autobuild==2021.3.14 +sphinx-autobuild==2024.2.4 # via -r requirements/doc.in -sphinx-book-theme==1.0.1 +sphinx-book-theme==1.1.2 # via -r requirements/doc.in sphinx-copybutton==0.5.2 # via -r requirements/doc.in -sphinxcontrib-applehelp==1.0.4 +sphinxcontrib-applehelp==1.0.8 # via sphinx sphinxcontrib-contentui==0.2.5 # via -r requirements/doc.in -sphinxcontrib-devhelp==1.0.2 +sphinxcontrib-devhelp==1.0.6 # via sphinx -sphinxcontrib-htmlhelp==2.0.1 +sphinxcontrib-htmlhelp==2.0.5 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx sphinxcontrib-mermaid==0.9.2 # via -r requirements/doc.in -sphinxcontrib-qthelp==1.0.3 +sphinxcontrib-qthelp==1.0.7 # via sphinx -sphinxcontrib-serializinghtml==1.1.5 +sphinxcontrib-serializinghtml==1.1.10 # via sphinx sqlparse==0.4.4 # via @@ -257,14 +255,6 @@ text-unidecode==1.3 # via # -r requirements/test.txt # python-slugify -tomli==2.0.1 - # via - # -r requirements/test.txt - # build - # coverage - # doc8 - # pyproject-hooks - # pytest tornado==6.4 # via livereload twine==5.0.0 @@ -272,15 +262,11 @@ twine==5.0.0 typing-extensions==4.10.0 # via # -r requirements/test.txt - # asgiref # edx-opaque-keys # pydata-sphinx-theme - # rich urllib3==2.2.1 # via # requests # twine -zipp==3.18.0 - # via - # importlib-metadata - # importlib-resources +zipp==3.18.1 + # via importlib-metadata diff --git a/requirements/pip-tools.txt b/requirements/pip-tools.txt index 2cd7b7be..fcd70eb6 100644 --- a/requirements/pip-tools.txt +++ b/requirements/pip-tools.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade @@ -8,10 +8,6 @@ build==1.1.1 # via pip-tools click==8.1.7 # via pip-tools -importlib-metadata==6.11.0 - # via - # -c https://raw.githubusercontent.com/openedx/edx-lint/master/edx_lint/files/common_constraints.txt - # build packaging==24.0 # via build pip-tools==7.4.1 @@ -20,15 +16,8 @@ pyproject-hooks==1.0.0 # via # build # pip-tools -tomli==2.0.1 - # via - # build - # pip-tools - # pyproject-hooks wheel==0.43.0 # via pip-tools -zipp==3.18.0 - # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/requirements/pip.txt b/requirements/pip.txt index cf449024..8d1b8fef 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade diff --git a/requirements/quality.txt b/requirements/quality.txt index f9bab54f..17f3c6d5 100644 --- a/requirements/quality.txt +++ b/requirements/quality.txt @@ -1,10 +1,10 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade # -asgiref==3.7.2 +asgiref==3.8.1 # via # -r requirements/test.txt # django @@ -15,10 +15,6 @@ astroid==2.15.8 # pylint-celery attrs==23.2.0 # via -r requirements/test.txt -backports-zoneinfo==0.2.1 - # via - # -r requirements/test.txt - # django certifi==2024.2.2 # via requests cffi==1.16.0 @@ -40,7 +36,7 @@ code-annotations==1.7.0 # via # -r requirements/test.txt # edx-lint -coverage[toml]==7.4.3 +coverage[toml]==7.4.4 # via # -r requirements/test.txt # pytest-cov @@ -65,16 +61,16 @@ django-waffle==4.1.0 # edx-django-utils docutils==0.20.1 # via readme-renderer +edx-ccx-keys==1.2.1 + # via -r requirements/test.txt edx-django-utils==5.11.0 # via -r requirements/test.txt edx-lint==5.3.6 # via -r requirements/quality.in edx-opaque-keys[django]==2.5.1 - # via -r requirements/test.txt -exceptiongroup==1.2.0 # via # -r requirements/test.txt - # pytest + # edx-ccx-keys fastavro==1.9.4 # via -r requirements/test.txt idna==3.6 @@ -82,10 +78,7 @@ idna==3.6 importlib-metadata==6.11.0 # via # -c https://raw.githubusercontent.com/openedx/edx-lint/master/edx_lint/files/common_constraints.txt - # keyring # twine -importlib-resources==6.3.0 - # via keyring iniconfig==2.0.0 # via # -r requirements/test.txt @@ -96,11 +89,15 @@ isort==5.13.2 # pylint jaraco-classes==3.3.1 # via keyring +jaraco-context==4.3.0 + # via keyring +jaraco-functools==4.0.0 + # via keyring jinja2==3.1.3 # via # -r requirements/test.txt # code-annotations -keyring==24.3.1 +keyring==25.0.0 # via twine lazy-object-proxy==1.10.0 # via astroid @@ -115,12 +112,14 @@ mccabe==0.7.0 mdurl==0.1.2 # via markdown-it-py more-itertools==10.2.0 - # via jaraco-classes + # via + # jaraco-classes + # jaraco-functools newrelic==9.7.1 # via # -r requirements/test.txt # edx-django-utils -nh3==0.2.15 +nh3==0.2.17 # via readme-renderer packaging==24.0 # via @@ -181,7 +180,7 @@ pytest==8.1.1 # -r requirements/test.txt # pytest-cov # pytest-django -pytest-cov==4.1.0 +pytest-cov==5.0.0 # via -r requirements/test.txt pytest-django==4.8.0 # via -r requirements/test.txt @@ -206,7 +205,10 @@ rfc3986==2.0.0 rich==13.7.1 # via twine six==1.16.0 - # via edx-lint + # via + # -r requirements/test.txt + # edx-ccx-keys + # edx-lint snowballstemmer==2.2.0 # via pydocstyle sqlparse==0.4.4 @@ -223,12 +225,6 @@ text-unidecode==1.3 # via # -r requirements/test.txt # python-slugify -tomli==2.0.1 - # via - # -r requirements/test.txt - # coverage - # pylint - # pytest tomlkit==0.12.4 # via pylint twine==5.0.0 @@ -236,18 +232,12 @@ twine==5.0.0 typing-extensions==4.10.0 # via # -r requirements/test.txt - # asgiref - # astroid # edx-opaque-keys - # pylint - # rich urllib3==2.2.1 # via # requests # twine wrapt==1.16.0 # via astroid -zipp==3.18.0 - # via - # importlib-metadata - # importlib-resources +zipp==3.18.1 + # via importlib-metadata diff --git a/requirements/test.txt b/requirements/test.txt index ab8132cd..a48d3a9f 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,19 +1,15 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade # -asgiref==3.7.2 +asgiref==3.8.1 # via # -r requirements/base.txt # django attrs==23.2.0 # via -r requirements/base.txt -backports-zoneinfo==0.2.1 - # via - # -r requirements/base.txt - # django cffi==1.16.0 # via # -r requirements/base.txt @@ -25,7 +21,7 @@ click==8.1.7 # edx-django-utils code-annotations==1.7.0 # via -r requirements/test.in -coverage[toml]==7.4.3 +coverage[toml]==7.4.4 # via pytest-cov ddt==1.7.2 # via -r requirements/test.in @@ -43,12 +39,14 @@ django-waffle==4.1.0 # via # -r requirements/base.txt # edx-django-utils +edx-ccx-keys==1.2.1 + # via -r requirements/base.txt edx-django-utils==5.11.0 # via -r requirements/base.txt edx-opaque-keys[django]==2.5.1 - # via -r requirements/base.txt -exceptiongroup==1.2.0 - # via pytest + # via + # -r requirements/base.txt + # edx-ccx-keys fastavro==1.9.4 # via -r requirements/base.txt iniconfig==2.0.0 @@ -89,7 +87,7 @@ pytest==8.1.1 # via # pytest-cov # pytest-django -pytest-cov==4.1.0 +pytest-cov==5.0.0 # via -r requirements/test.in pytest-django==4.8.0 # via -r requirements/test.in @@ -97,6 +95,10 @@ python-slugify==8.0.4 # via code-annotations pyyaml==6.0.1 # via code-annotations +six==1.16.0 + # via + # -r requirements/base.txt + # edx-ccx-keys sqlparse==0.4.4 # via # -r requirements/base.txt @@ -109,12 +111,7 @@ stevedore==5.2.0 # edx-opaque-keys text-unidecode==1.3 # via python-slugify -tomli==2.0.1 - # via - # coverage - # pytest typing-extensions==4.10.0 # via # -r requirements/base.txt - # asgiref # edx-opaque-keys