diff --git a/docs/conf.py b/docs/conf.py index 7352195cbb11..b755f3986c93 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -55,7 +55,6 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.doctest', 'sphinx.ext.graphviz', @@ -68,8 +67,22 @@ 'sphinx_design', 'code_annotations.contrib.sphinx.extensions.featuretoggles', 'code_annotations.contrib.sphinx.extensions.settings', + # 'autoapi.extension', # Temporarily disabled ] +# Temporarily disabling autoapi_dirs and the AutoAPI extension due to performance issues. +# This will unblock ReadTheDocs builds and will be revisited for optimization. +# autoapi_type = 'python' +# autoapi_dirs = ['../lms/djangoapps', '../openedx/core/djangoapps', "../openedx/features"] +# +# autoapi_ignore = [ +# '*/migrations/*', +# '*/tests/*', +# '*.pyc', +# '__init__.py', +# '**/xblock_serializer/data.py', +# ] + # Rediraffe related settings. rediraffe_redirects = "redirects.txt" rediraffe_branch = 'origin/master' @@ -274,16 +287,9 @@ # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { - 'django': ('https://docs.djangoproject.com/en/1.11/', 'https://docs.djangoproject.com/en/1.11/_objects/'), + 'django': ('https://docs.djangoproject.com/en/4.2/', 'https://docs.djangoproject.com/en/4.2/_objects/'), } -# Mock out these external modules during code import to avoid errors -autodoc_mock_imports = [ - 'MySQLdb', - 'django_mysql', - 'pymongo', -] - # Start building a map of the directories relative to the repository root to # run sphinx-apidoc against and the directories under "docs" in which to store # the generated *.rst files diff --git a/docs/lms-openapi.yaml b/docs/lms-openapi.yaml index 5e9afcc6d370..a3410d2a634d 100644 --- a/docs/lms-openapi.yaml +++ b/docs/lms-openapi.yaml @@ -3975,6 +3975,7 @@ paths: "profile_name": "Jon Doe" "verification_attempt_id": (Optional) "proctored_exam_attempt_id": (Optional) + "platform_verification_attempt_id": (Optional) "status": (Optional) } parameters: @@ -4130,6 +4131,7 @@ paths: "profile_name": "Jon Doe" "verification_attempt_id": (Optional) "proctored_exam_attempt_id": (Optional) + "platform_verification_attempt_id": (Optional) "status": (Optional) } parameters: @@ -5809,7 +5811,7 @@ paths: operationId: grades_v1_submission_history_read description: |- Get submission history details. This submission history is related to only - ProblemBlock and it doesn't support LibraryContentBlock or ContentLibraries + ProblemBlock and it doesn't support LegacyLibraryContentBlock or ContentLibraries as of now. **Usecases**: @@ -6788,6 +6790,59 @@ paths: in: path required: true type: string + /mobile/{api_version}/notifications/create-token/: + post: + operationId: mobile_notifications_create-token_create + summary: |- + **Use Case** + This endpoint allows clients to register a device for push notifications. + description: |- + If the device is already registered, the existing registration will be updated. + If setting PUSH_NOTIFICATIONS_SETTINGS is not configured, the endpoint will return a 501 error. + + **Example Request** + POST /api/mobile/{version}/notifications/create-token/ + **POST Parameters** + The body of the POST request can include the following parameters. + * name (optional) - A name of the device. + * registration_id (required) - The device token of the device. + * device_id (optional) - ANDROID_ID / TelephonyManager.getDeviceId() (always as hex) + * active (optional) - Whether the device is active, default is True. + If False, the device will not receive notifications. + * cloud_message_type (required) - You should choose FCM or GCM. Currently, only FCM is supported. + * application_id (optional) - Opaque application identity, should be filled in for multiple + key/certificate access. Should be equal settings.FCM_APP_NAME. + **Example Response** + ```json + { + "id": 1, + "name": "My Device", + "registration_id": "fj3j4", + "device_id": 1234, + "active": true, + "date_created": "2024-04-18T07:39:37.132787Z", + "cloud_message_type": "FCM", + "application_id": "my_app_id" + } + ``` + parameters: + - name: data + in: body + required: true + schema: + $ref: '#/definitions/GCMDevice' + responses: + '201': + description: '' + schema: + $ref: '#/definitions/GCMDevice' + tags: + - mobile + parameters: + - name: api_version + in: path + required: true + type: string /mobile/{api_version}/users/{username}: get: operationId: mobile_users_read @@ -6956,6 +7011,25 @@ paths: in: path required: true type: string + /mobile/{api_version}/users/{username}/enrollments_status/: + get: + operationId: mobile_users_enrollments_status_list + description: Gets user's enrollments status. + parameters: [] + responses: + '200': + description: '' + tags: + - mobile + parameters: + - name: api_version + in: path + required: true + type: string + - name: username + in: path + required: true + type: string /notifications/: get: operationId: notifications_list @@ -8849,22 +8923,6 @@ paths: tags: - user parameters: [] - /user/v1/accounts/verifications/{attempt_id}/: - get: - operationId: user_v1_accounts_verifications_read - description: Get IDV attempt details by attempt_id. Only accessible by global - staff. - parameters: [] - responses: - '200': - description: '' - tags: - - user - parameters: - - name: attempt_id - in: path - required: true - type: string /user/v1/accounts/{username}: get: operationId: user_v1_accounts_read @@ -9773,7 +9831,7 @@ paths: required: true type: string pattern: ^[a-zA-Z0-9\-_]*$ - /xblock/v2/xblocks/{usage_key_str}/: + /xblock/v2/xblocks/{usage_key}/: get: operationId: xblock_v2_xblocks_read summary: Get metadata about the specified block. @@ -9789,11 +9847,11 @@ paths: tags: - xblock parameters: - - name: usage_key_str + - name: usage_key in: path required: true type: string - /xblock/v2/xblocks/{usage_key_str}/fields/: + /xblock/v2/xblocks/{usage_key}/fields/: get: operationId: xblock_v2_xblocks_fields_list description: retrieves the xblock, returning display_name, data, and metadata @@ -9814,11 +9872,11 @@ paths: tags: - xblock parameters: - - name: usage_key_str + - name: usage_key in: path required: true type: string - /xblock/v2/xblocks/{usage_key_str}/handler_url/{handler_name}/: + /xblock/v2/xblocks/{usage_key}/handler_url/{handler_name}/: get: operationId: xblock_v2_xblocks_handler_url_read summary: |- @@ -9833,7 +9891,7 @@ paths: tags: - xblock parameters: - - name: usage_key_str + - name: usage_key in: path required: true type: string @@ -9841,7 +9899,7 @@ paths: in: path required: true type: string - /xblock/v2/xblocks/{usage_key_str}/view/{view_name}/: + /xblock/v2/xblocks/{usage_key}/view/{view_name}/: get: operationId: xblock_v2_xblocks_view_read description: Get the HTML, JS, and CSS needed to render the given XBlock. @@ -9852,7 +9910,110 @@ paths: tags: - xblock parameters: - - name: usage_key_str + - name: usage_key + in: path + required: true + type: string + - name: view_name + in: path + required: true + type: string + /xblock/v2/xblocks/{usage_key}@{version}/: + get: + operationId: xblock_v2_xblocks_read + summary: Get metadata about the specified block. + description: |- + Accepts the following query parameters: + + * "include": a comma-separated list of keys to include. + Valid keys are "index_dictionary" and "student_view_data". + parameters: [] + responses: + '200': + description: '' + tags: + - xblock + parameters: + - name: usage_key + in: path + required: true + type: string + - name: version + in: path + required: true + type: string + /xblock/v2/xblocks/{usage_key}@{version}/fields/: + get: + operationId: xblock_v2_xblocks_fields_list + description: retrieves the xblock, returning display_name, data, and metadata + parameters: [] + responses: + '200': + description: '' + tags: + - xblock + post: + operationId: xblock_v2_xblocks_fields_create + description: edits the xblock, saving changes to data and metadata only (display_name + included in metadata) + parameters: [] + responses: + '201': + description: '' + tags: + - xblock + parameters: + - name: usage_key + in: path + required: true + type: string + - name: version + in: path + required: true + type: string + /xblock/v2/xblocks/{usage_key}@{version}/handler_url/{handler_name}/: + get: + operationId: xblock_v2_xblocks_handler_url_read + summary: |- + Get an absolute URL which can be used (without any authentication) to call + the given XBlock handler. + description: The URL will expire but is guaranteed to be valid for a minimum + of 2 days. + parameters: [] + responses: + '200': + description: '' + tags: + - xblock + parameters: + - name: usage_key + in: path + required: true + type: string + - name: version + in: path + required: true + type: string + - name: handler_name + in: path + required: true + type: string + /xblock/v2/xblocks/{usage_key}@{version}/view/{view_name}/: + get: + operationId: xblock_v2_xblocks_view_read + description: Get the HTML, JS, and CSS needed to render the given XBlock. + parameters: [] + responses: + '200': + description: '' + tags: + - xblock + parameters: + - name: usage_key + in: path + required: true + type: string + - name: version in: path required: true type: string @@ -10047,6 +10208,7 @@ definitions: required: - celebrations - course_access + - studio_access - course_id - is_enrolled - is_self_paced @@ -10084,6 +10246,9 @@ definitions: additionalProperties: type: string x-nullable: true + studio_access: + title: Studio access + type: boolean course_id: title: Course id type: string @@ -11237,10 +11402,24 @@ definitions: title: Verification attempt id type: integer x-nullable: true + verification_attempt_status: + title: Verification attempt status + type: string + minLength: 1 + x-nullable: true proctored_exam_attempt_id: title: Proctored exam attempt id type: integer x-nullable: true + platform_verification_attempt_id: + title: Platform verification attempt id + type: integer + x-nullable: true + platform_verification_attempt_status: + title: Platform verification attempt status + type: string + minLength: 1 + x-nullable: true status: title: Status type: string @@ -11277,10 +11456,24 @@ definitions: title: Verification attempt id type: integer x-nullable: true + verification_attempt_status: + title: Verification attempt status + type: string + minLength: 1 + x-nullable: true proctored_exam_attempt_id: title: Proctored exam attempt id type: integer x-nullable: true + platform_verification_attempt_id: + title: Platform verification attempt id + type: integer + x-nullable: true + platform_verification_attempt_status: + title: Platform verification attempt status + type: string + minLength: 1 + x-nullable: true status: title: Status type: string @@ -11710,6 +11903,52 @@ definitions: title: Enddatetime type: string format: date-time + GCMDevice: + required: + - registration_id + type: object + properties: + id: + title: ID + type: integer + name: + title: Name + type: string + maxLength: 255 + x-nullable: true + registration_id: + title: Registration ID + type: string + minLength: 1 + device_id: + title: Device id + description: 'ANDROID_ID / TelephonyManager.getDeviceId() (e.g: 0x01)' + type: integer + x-nullable: true + active: + title: Is active + description: Inactive devices will not be sent notifications + type: boolean + date_created: + title: Creation date + type: string + format: date-time + readOnly: true + x-nullable: true + cloud_message_type: + title: Cloud Message Type + description: You should choose FCM, GCM is deprecated + type: string + enum: + - FCM + - GCM + application_id: + title: Application ID + description: Opaque application identity, should be filled in for multiple + key/certificate access + type: string + maxLength: 64 + x-nullable: true mobile_api.User: required: - username diff --git a/openedx/core/djangoapps/user_api/accounts/utils.py b/openedx/core/djangoapps/user_api/accounts/utils.py index 3cc03c02ed5d..826dbd42cd13 100644 --- a/openedx/core/djangoapps/user_api/accounts/utils.py +++ b/openedx/core/djangoapps/user_api/accounts/utils.py @@ -51,11 +51,11 @@ def format_social_link(platform_name, new_social_link): """ Given a user's social link, returns a safe absolute url for the social link. - Returns the following based on the provided new_social_link: - 1) Given an empty string, returns '' - 1) Given a valid username, return 'https://www.[platform_name_base][username]' - 2) Given a valid URL, return 'https://www.[platform_name_base][username]' - 3) Given anything unparseable, returns None + Returns: + - An empty string if `new_social_link` is empty. + - A formatted URL if `new_social_link` is a username. + - Returns `new_social_link` if it is a valid URL. + - None for unparseable inputs. """ # Blank social links should return '' or None as was passed in. if not new_social_link: diff --git a/requirements/constraints.txt b/requirements/constraints.txt index e9f5aac8f215..969c20e114de 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -167,6 +167,7 @@ pycodestyle<2.9.0 # Date: 2021-07-12 # Issue for unpinning: https://github.com/openedx/edx-platform/issues/33560 pylint<2.16.0 # greater version failing quality test. Fix them in seperate ticket. +astroid<2.14.0 # Date: 2021-08-25 # At the time of writing this comment, we do not know whether py2neo>=2022 diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index 6d54d3913eaf..56b4b29a1da2 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -83,9 +83,12 @@ asn1crypto==1.5.1 # snowflake-connector-python astroid==2.13.5 # via + # -c requirements/edx/../constraints.txt + # -r requirements/edx/doc.txt # -r requirements/edx/testing.txt # pylint # pylint-celery + # sphinx-autoapi attrs==24.2.0 # via # -r requirements/edx/doc.txt @@ -1103,6 +1106,7 @@ jinja2==3.1.4 # code-annotations # diff-cover # sphinx + # sphinx-autoapi jmespath==1.0.1 # via # -r requirements/edx/doc.txt @@ -1166,6 +1170,7 @@ lazy==1.6 # xblock lazy-object-proxy==1.10.0 # via + # -r requirements/edx/doc.txt # -r requirements/edx/testing.txt # astroid libsass==0.10.0 @@ -1794,6 +1799,7 @@ pyyaml==6.0.2 # edx-django-release-util # edx-i18n-tools # jsondiff + # sphinx-autoapi # sphinxcontrib-openapi # xblock random2==1.0.2 @@ -1994,6 +2000,7 @@ sphinx==8.1.3 # via # -r requirements/edx/doc.txt # pydata-sphinx-theme + # sphinx-autoapi # sphinx-book-theme # sphinx-design # sphinx-mdinclude @@ -2001,6 +2008,8 @@ sphinx==8.1.3 # sphinxcontrib-httpdomain # sphinxcontrib-openapi # sphinxext-rediraffe +sphinx-autoapi==3.4.0 + # via -r requirements/edx/doc.txt sphinx-book-theme==1.1.3 # via -r requirements/edx/doc.txt sphinx-design==0.6.1 diff --git a/requirements/edx/doc.in b/requirements/edx/doc.in index 013bafc42ec0..78afbf9d6bd0 100644 --- a/requirements/edx/doc.in +++ b/requirements/edx/doc.in @@ -10,3 +10,4 @@ sphinx-design # provides various responsive web-components sphinxcontrib-openapi[markdown] # Be able to render openapi schema in a sphinx project sphinxext-rediraffe # Quickly and easily redirect when we move pages around. sphinx-reredirects # Redirect from a sphinx project out to other places on the web including other sphinx projects +sphinx-autoapi diff --git a/requirements/edx/doc.txt b/requirements/edx/doc.txt index b9525404e046..e651a0a16ec1 100644 --- a/requirements/edx/doc.txt +++ b/requirements/edx/doc.txt @@ -57,6 +57,10 @@ asn1crypto==1.5.1 # via # -r requirements/edx/base.txt # snowflake-connector-python +astroid==2.13.5 + # via + # -c requirements/edx/../constraints.txt + # sphinx-autoapi attrs==24.2.0 # via # -r requirements/edx/base.txt @@ -790,6 +794,7 @@ jinja2==3.1.4 # -r requirements/edx/base.txt # code-annotations # sphinx + # sphinx-autoapi jmespath==1.0.1 # via # -r requirements/edx/base.txt @@ -840,6 +845,8 @@ lazy==1.6 # lti-consumer-xblock # ora2 # xblock +lazy-object-proxy==1.10.0 + # via astroid libsass==0.10.0 # via # -c requirements/edx/../constraints.txt @@ -1243,6 +1250,7 @@ pyyaml==6.0.2 # edx-django-release-util # edx-i18n-tools # jsondiff + # sphinx-autoapi # sphinxcontrib-openapi # xblock random2==1.0.2 @@ -1401,6 +1409,7 @@ sphinx==8.1.3 # via # -r requirements/edx/doc.in # pydata-sphinx-theme + # sphinx-autoapi # sphinx-book-theme # sphinx-design # sphinx-mdinclude @@ -1408,6 +1417,8 @@ sphinx==8.1.3 # sphinxcontrib-httpdomain # sphinxcontrib-openapi # sphinxext-rediraffe +sphinx-autoapi==3.4.0 + # via -r requirements/edx/doc.in sphinx-book-theme==1.1.3 # via -r requirements/edx/doc.in sphinx-design==0.6.1 @@ -1552,7 +1563,9 @@ webob==1.8.8 # -r requirements/edx/base.txt # xblock wrapt==1.16.0 - # via -r requirements/edx/base.txt + # via + # -r requirements/edx/base.txt + # astroid xblock[django]==5.1.0 # via # -r requirements/edx/base.txt diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 4fe93e16dfcf..317237f0c9c0 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -57,6 +57,7 @@ asn1crypto==1.5.1 # snowflake-connector-python astroid==2.13.5 # via + # -c requirements/edx/../constraints.txt # pylint # pylint-celery attrs==24.2.0