Skip to content

Commit

Permalink
Merge pull request #123 from openedx/bmtcril/drop_py_38
Browse files Browse the repository at this point in the history
chore: Remove remaining Python 3.8 compatibility
  • Loading branch information
bmtcril authored Jan 28, 2025
2 parents 066404c + 8ad6093 commit bb8d7b5
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 252 deletions.
5 changes: 2 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

**Merge checklist:**
Check off if complete *or* not applicable:
Check off if complete _or_ not applicable:

- [ ] Version bumped
- [ ] Changelog record added
- [ ] Documentation updated (not only docstrings)
- [ ] Fixup commits are squashed away
- [ ] Unit tests added/updated
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sphinx:
build:
os: "ubuntu-22.04"
tools:
python: "3.8"
python: "3.11"

python:
install:
Expand Down
222 changes: 0 additions & 222 deletions CHANGELOG.rst

This file was deleted.

1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include CHANGELOG.rst
include LICENSE.txt
include README.rst
include requirements/base.in
Expand Down
13 changes: 11 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ Platform Plugin Aspects
Purpose
*******

This repository holds various Aspects plugins for the Open edX platform.
This repository holds various Aspects plugins for the Open edX platform including the
event sinks that move data from the LMS to ClickHouse and the embbedding of Superset
dashboards back into the platform.

Version Compatibility
*********************

`platform-plugin-aspects` version 1.x: Nutmeg to Sumac
`platform-plugin-aspects` version 2.x: Redwood and above

Sinks
*****
Expand Down Expand Up @@ -32,7 +40,7 @@ Commands
In addition to being an event listener, this package provides the following commands:

- `dump_data_to_clickhouse` - This command allows bulk export of the data from the Sinks.
Allows bootstrapping a new data platform or backfilling lost or missing data.
Allows bootstrapping a new data platform or backfilling lost or missing data. More information can be found in the `Aspects backfill documentation`_.

``python manage.py cms dump_data_to_clickhouse``

Expand Down Expand Up @@ -225,3 +233,4 @@ Please do not report security issues in public. Please email [email protected]
.. _Aspects: https://docs.openedx.org/projects/openedx-aspects/en/latest/index.html
.. _Superset Embedded SDK: https://www.npmjs.com/package/@superset-ui/embedded-sdk
.. _Open edX Filters: https://docs.openedx.org/projects/openedx-filters/en/latest/
.. _Aspects backfill documentation: https://docs.openedx.org/projects/openedx-aspects/en/latest/technical_documentation/how-tos/backfill.html
1 change: 0 additions & 1 deletion docs/changelog.rst

This file was deleted.

6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,10 +526,10 @@ def get_version(*file_paths):

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
"python": ("https://docs.python.org/3.8", None),
"python": ("https://docs.python.org/3.11", None),
"django": (
"https://docs.djangoproject.com/en/3.2/",
"https://docs.djangoproject.com/en/3.2/_objects/",
"https://docs.djangoproject.com/en/4.2/",
"https://docs.djangoproject.com/en/4.2/_objects/",
),
"model_utils": ("https://django-model-utils.readthedocs.io/en/latest/", None),
}
Expand Down
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Contents:
testing
internationalization
modules
changelog
decisions
references/index

Expand Down
2 changes: 1 addition & 1 deletion platform_plugin_aspects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import os
from pathlib import Path

__version__ = "0.11.7"
__version__ = "1.0.0"

ROOT_DIRECTORY = Path(os.path.dirname(os.path.abspath(__file__)))
12 changes: 9 additions & 3 deletions platform_plugin_aspects/extensions/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
Open edX Filters needed for Aspects integration.
"""

import pkg_resources
import importlib.resources

from crum import get_current_user
from django.conf import settings
from django.template import Context, Template
Expand Down Expand Up @@ -78,5 +79,10 @@ def run_filter(

def resource_string(self, path):
"""Handy helper for getting resources from our kit."""
data = pkg_resources.resource_string("platform_plugin_aspects", path)
return data.decode("utf8")
data = (
importlib.resources.files("platform_plugin_aspects")
.joinpath(path)
.read_text(encoding="utf-8")
)

return data
5 changes: 1 addition & 4 deletions platform_plugin_aspects/tests/test_xblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,12 @@ def test_render_student(self):
self.assertNotIn("superset-embedded-container", html)
self.assertIn("Superset is only visible to course staff and instructors", html)

@patch("platform_plugin_aspects.xblock.pkg_resources.resource_exists")
@patch("platform_plugin_aspects.xblock.translation.get_language")
def test_render_translations(self, mock_get_language, mock_resource_exists):
def test_render_translations(self, mock_get_language):
"""
Ensure translated javascript is served.
"""
mock_get_language.return_value = "eo"
mock_resource_exists.return_value = True
xblock = make_an_xblock("instructor")
student_view = xblock.student_view()
url_resource = None
Expand All @@ -108,7 +106,6 @@ def test_render_translations(self, mock_get_language, mock_resource_exists):
)
self.assertIn("eo/text.js", url_resource.data)
mock_get_language.assert_called_once()
mock_resource_exists.assert_called_once()

@patch("platform_plugin_aspects.xblock.translation.get_language")
def test_render_no_translations(
Expand Down
8 changes: 4 additions & 4 deletions platform_plugin_aspects/xblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

from __future__ import annotations

import importlib.resources
import json
import logging
import os

import pkg_resources
from django.core.exceptions import ImproperlyConfigured
from django.utils import translation
from web_fragments.fragment import Fragment
Expand Down Expand Up @@ -192,9 +193,8 @@ def _get_statici18n_js_url():
text_js = "public/js/translations/{locale_code}/text.js"
lang_code = locale_code.split("-")[0]
for code in (locale_code, lang_code, "en"):
if pkg_resources.resource_exists(
loader.module_name, text_js.format(locale_code=code)
):
path_names = os.path.split(text_js.format(locale_code=code))
if importlib.resources.files(__package__).joinpath(*path_names).is_file():
return text_js.format(locale_code=code)
return None

Expand Down
Loading

0 comments on commit bb8d7b5

Please sign in to comment.