From 21f1e5209d71922a94d58dba44a1661199e1a046 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Mon, 24 Aug 2026 09:51:01 -0400 Subject: [PATCH 1/2] refactor: remove dead settings.FEATURES grabs in xmodule xmodule/capa_block.py and xmodule/partitions/partitions_service.py each grabbed the FEATURES dict at import time into a module-level variable that nothing reads: FEATURES = getattr(settings, "FEATURES", {}) In capa_block this was orphaned when the flags it once gated were deprecated (the extracted xblocks_contrib copy already omits it); in partitions_service it has been unused for a long time. Neither module-level name is imported anywhere in the openedx GitHub org (confirmed by org-wide code search) and AST analysis shows no reader. Remove both assignments and the imports they leave unused: ImproperlyConfigured in capa_block (settings is still used elsewhere and stays) and django.conf.settings in partitions_service. Co-Authored-By: Claude Opus 4.8 --- xmodule/capa_block.py | 7 ------- xmodule/partitions/partitions_service.py | 3 --- 2 files changed, 10 deletions(-) diff --git a/xmodule/capa_block.py b/xmodule/capa_block.py index 958ca1354142..0b59257a53fd 100644 --- a/xmodule/capa_block.py +++ b/xmodule/capa_block.py @@ -19,7 +19,6 @@ import nh3 from django.conf import settings -from django.core.exceptions import ImproperlyConfigured from django.template.loader import render_to_string from django.utils.encoding import smart_str from django.utils.functional import cached_property @@ -73,12 +72,6 @@ MAX_RANDOMIZATION_BINS = 1000 -try: - FEATURES = getattr(settings, "FEATURES", {}) -except ImproperlyConfigured: - FEATURES = {} - - class SHOWANSWER: # pylint: disable=too-few-public-methods """ Constants for when to show answer diff --git a/xmodule/partitions/partitions_service.py b/xmodule/partitions/partitions_service.py index 3a0cf9d9c61d..b9a060d15219 100644 --- a/xmodule/partitions/partitions_service.py +++ b/xmodule/partitions/partitions_service.py @@ -6,7 +6,6 @@ import logging from typing import Dict # noqa: UP035 -from django.conf import settings from django.contrib.auth import get_user_model from opaque_keys.edx.keys import CourseKey @@ -21,8 +20,6 @@ log = logging.getLogger(__name__) -FEATURES = getattr(settings, 'FEATURES', {}) - @request_cached() def get_all_partitions_for_course(course, active_only=False): From e83a86db44f669fc386922130d15df3345b7c578 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Tue, 25 Aug 2026 09:19:17 -0400 Subject: [PATCH 2/2] refactor: remove unused ENV_FEATURES from production settings lms/envs/production.py and cms/envs/production.py defined ENV_FEATURES = _YAML_TOKENS.get("FEATURES", {}) alongside the legacy ENV_TOKENS / AUTH_TOKENS compat exports, but nothing reads ENV_FEATURES -- not in this repo, and not anywhere in the openedx GitHub org (org-wide code search: 0 importers, in contrast to ENV_TOKENS, which many plugins/IDAs still import). Remove it. ENV_TOKENS and AUTH_TOKENS (the actually-used exports) are unchanged, so ENV_TOKENS["FEATURES"] still works for any external consumer. Co-Authored-By: Claude Opus 4.8 --- cms/envs/production.py | 1 - lms/envs/production.py | 1 - 2 files changed, 2 deletions(-) diff --git a/cms/envs/production.py b/cms/envs/production.py index 604d2753bccd..7c0efc213395 100644 --- a/cms/envs/production.py +++ b/cms/envs/production.py @@ -325,7 +325,6 @@ def get_env_setting(setting): # value rathering than diving into these dicts. ENV_TOKENS = _YAML_TOKENS AUTH_TOKENS = _YAML_TOKENS -ENV_FEATURES = _YAML_TOKENS.get("FEATURES", {}) ENV_CELERY_QUEUES = _YAML_CELERY_QUEUES ALTERNATE_QUEUE_ENVS = _YAML_ALTERNATE_WORKER_QUEUES diff --git a/lms/envs/production.py b/lms/envs/production.py index b13f232f5bb7..ad42e72eef19 100644 --- a/lms/envs/production.py +++ b/lms/envs/production.py @@ -422,7 +422,6 @@ def get_env_setting(setting): # value rathering than diving into these dicts. ENV_TOKENS = _YAML_TOKENS AUTH_TOKENS = _YAML_TOKENS -ENV_FEATURES = _YAML_TOKENS.get("FEATURES", {}) ENV_CELERY_QUEUES = _YAML_CELERY_QUEUES ALTERNATE_QUEUE_ENVS = _YAML_ALTERNATE_WORKER_QUEUES