diff --git a/.hatch_build.py b/.hatch_build.py index 8bf762e42..9d9babbb5 100644 --- a/.hatch_build.py +++ b/.hatch_build.py @@ -16,5 +16,5 @@ def update(self, metadata: dict[str, t.Any]) -> None: def load_about() -> dict[str, str]: about: dict[str, str] = {} with open(os.path.join(HERE, "tutorindigo", "__about__.py"), "rt", encoding="utf-8") as f: - exec(f.read(), about) # pylint: disable=exec-used + exec(f.read(), about) return about diff --git a/CHANGELOG.md b/CHANGELOG.md index d689e9e02..a522139bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,13 @@ instructions, because git commits are used to generate release notes: + +## v20.0.1 (2025-09-23) + +- [Improvement] Make latex response editor background colours WCAG compliant in dark theme. (by @Danyal-Faheem) + +- [Improvement] Sync footer in both MFE pages and templates (by @zubairshakoorarbisoft) + ## v20.0.0 (2025-06-16) diff --git a/Makefile b/Makefile index 6e9bebb27..8151f0d6b 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,30 @@ .DEFAULT_GOAL := help .PHONY: docs SRC_DIRS = ./tutorindigo -BLACK_OPTS = --exclude templates ${SRC_DIRS} # Warning: These checks are not necessarily run on every PR. -test: test-lint test-types test-format # Run some static checks. +test: test-lint test-types test-format test-pythonpackage # Run some static checks. test-format: ## Run code formatting tests - black --check --diff $(BLACK_OPTS) + ruff format --check --diff $(SRC_DIRS) test-lint: ## Run code linting tests - pylint --errors-only --enable=unused-import,unused-argument --ignore=templates --ignore=docs/_ext ${SRC_DIRS} + ruff check ${SRC_DIRS} test-types: ## Run type checks. mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS} +build-pythonpackage: ## Build the "tutor-indigo" python package for upload to pypi + python -m build --sdist + +test-pythonpackage: build-pythonpackage ## Test that package can be uploaded to pypi + twine check dist/tutor_indigo-$(shell make version).tar.gz + format: ## Format code automatically - black $(BLACK_OPTS) + ruff format ${SRC_DIRS} -isort: ## Sort imports. This target is not mandatory because the output may be incompatible with black formatting. Provided for convenience purposes. - isort --skip=templates ${SRC_DIRS} +fix-lint: ## Fix lint errors automatically + ruff check --fix ${SRC_DIRS} changelog-entry: ## Create a new changelog entry. scriv create @@ -27,6 +32,9 @@ changelog-entry: ## Create a new changelog entry. changelog: ## Collect changelog entries in the CHANGELOG.md file. scriv collect +version: ## Print the current tutor-indigo version + @python -c 'import io, os; about = {}; exec(io.open(os.path.join("tutorindigo", "__about__.py"), "rt", encoding="utf-8").read(), about); print(about["__version__"])' + ESCAPE =  help: ## Print this help @grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \ diff --git a/changelog.d/20250703_181956_danyal.faheem_ora_grading_dark_theme_issue.md b/changelog.d/20250703_181956_danyal.faheem_ora_grading_dark_theme_issue.md deleted file mode 100644 index c4890d2a9..000000000 --- a/changelog.d/20250703_181956_danyal.faheem_ora_grading_dark_theme_issue.md +++ /dev/null @@ -1 +0,0 @@ -- [Improvement] Make latex response editor background colours WCAG compliant in dark theme. (by @Danyal-Faheem) \ No newline at end of file diff --git a/changelog.d/20250819_191723_136305115+HammadYousaf01_tutor_indigo_accessibility_fixes.md b/changelog.d/20250819_191723_136305115+HammadYousaf01_tutor_indigo_accessibility_fixes.md deleted file mode 100644 index eb8aa0494..000000000 --- a/changelog.d/20250819_191723_136305115+HammadYousaf01_tutor_indigo_accessibility_fixes.md +++ /dev/null @@ -1 +0,0 @@ -- [Improvement] Sync footer in both MFE pages and templates (by @zubairshakoorarbisoft) diff --git a/changelog.d/20251028_185649_136305115+HammadYousaf01_ruff_migration.md b/changelog.d/20251028_185649_136305115+HammadYousaf01_ruff_migration.md new file mode 100644 index 000000000..a275be666 --- /dev/null +++ b/changelog.d/20251028_185649_136305115+HammadYousaf01_ruff_migration.md @@ -0,0 +1 @@ +- [Improvement] Migrate from pylint and black to ruff. (by @HammadYousaf01) diff --git a/pyproject.toml b/pyproject.toml index 021ef19fd..d6d5bb5ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,8 +33,7 @@ dynamic = ["version"] [project.optional-dependencies] dev = [ "tutor[dev]>=20.0.0,<21.0.0", - "pylint", - "black" + "ruff", ] [project.entry-points."tutor.plugin.v1"] @@ -66,3 +65,19 @@ packages = ["/tutorindigo"] [tool.hatch.metadata.hooks.custom] path = ".hatch_build.py" + +[tool.ruff] +exclude = ["templates", "docs/_ext"] + +[tool.ruff.lint] +# E: pycodestyle errors +# I: isort +# N: pep8-naming +select = ["E", "I", "N"] + +# F401: unused-import +# F841: unused-variable +# W292: missing-newline-at-end-of-file +extend-select = ["F401", "F841", "W292"] + +[tool.ruff.format] diff --git a/tutorindigo/__about__.py b/tutorindigo/__about__.py index 9c9eb915e..dd71ced3d 100644 --- a/tutorindigo/__about__.py +++ b/tutorindigo/__about__.py @@ -1 +1 @@ -__version__ = "20.0.0" +__version__ = "20.0.1" diff --git a/tutorindigo/patches/mfe-env-config-runtime-definitions b/tutorindigo/patches/mfe-env-config-runtime-definitions new file mode 100644 index 000000000..cff28cb5e --- /dev/null +++ b/tutorindigo/patches/mfe-env-config-runtime-definitions @@ -0,0 +1,81 @@ +if (typeof useIntl === "undefined") { + const intl = await import("@edx/frontend-platform/i18n"); + globalThis.useIntl = intl.useIntl; +} + +const IndigoFooter = () => { + const intl = useIntl(); + const config = getConfig(); + + const indigoFooterNavLinks = config.INDIGO_FOOTER_NAV_LINKS || []; + + const messages = { + "footer.poweredby.text": { + id: "footer.poweredby.text", + defaultMessage: "Powered by", + description: "text for the footer", + }, + "footer.tutorlogo.altText": { + id: "footer.tutorlogo.altText", + defaultMessage: "Runs on Tutor", + description: "alt text for the footer tutor logo", + }, + "footer.logo.altText": { + id: "footer.logo.altText", + defaultMessage: "Powered by Open edX", + description: "alt text for the footer logo.", + }, + "footer.copyright.text": { + id: "footer.copyright.text", + defaultMessage: `Copyrights ©${new Date().getFullYear()}. All Rights Reserved.`, + description: "copyright text for the footer", + }, + }; + + return ( +
+ +
+ ); +}; diff --git a/tutorindigo/plugin.py b/tutorindigo/plugin.py index 476ed9f78..815408d89 100644 --- a/tutorindigo/plugin.py +++ b/tutorindigo/plugin.py @@ -53,7 +53,8 @@ ], ) -# Force the rendering of scss files, even though they are included in a "partials" directory +# Force the rendering of scss files, even though they are included in a +# "partials" directory hooks.Filters.ENV_PATTERNS_INCLUDE.add_items( [ r"indigo/lms/static/sass/partials/lms/theme/", @@ -113,24 +114,16 @@ def _override_openedx_docker_image( "discussions", ] - for mfe in indigo_styled_mfes: hooks.Filters.ENV_PATCHES.add_items( [ ( f"mfe-dockerfile-post-npm-install-{mfe}", """ -RUN npm install @edly-io/indigo-frontend-component-footer@^3.0.0 RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^5.0.0' RUN npm install '@edx/brand@github:@edly-io/brand-openedx#ulmo/indigo' -""", - ), - ( - f"mfe-env-config-runtime-definitions-{mfe}", - """ -const { default: IndigoFooter } = await import('@edly-io/indigo-frontend-component-footer'); -""", +""", # noqa: E501 ), ] ) @@ -200,7 +193,7 @@ def _override_openedx_docker_image( PLUGIN_SLOTS.add_item( ( mfe, - "footer_slot", + "org.openedx.frontend.layout.footer.v1", """ { op: PLUGIN_OPERATIONS.Hide, @@ -209,10 +202,10 @@ def _override_openedx_docker_image( { op: PLUGIN_OPERATIONS.Insert, widget: { - id: 'default_contents', + id: 'custom_footer', type: DIRECT_PLUGIN, priority: 1, - RenderWidget: , + RenderWidget: IndigoFooter, }, }, {