Skip to content

Commit

Permalink
refactor: Split base.in into kernel.in (required) and bundled.in (opt…
Browse files Browse the repository at this point in the history
…ional) (#32552)

Plus remove a few unused and indirect dependencies
  • Loading branch information
bradenmacdonald authored Jun 30, 2023
1 parent d6b76c8 commit 83f54ae
Show file tree
Hide file tree
Showing 11 changed files with 395 additions and 405 deletions.
7 changes: 6 additions & 1 deletion lms/djangoapps/learner_recommendations/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import logging
import requests

from algoliasearch.search_client import SearchClient
try:
from algoliasearch.search_client import SearchClient
except ImportError:
SearchClient = None
from django.conf import settings

from common.djangoapps.student.models import CourseEnrollment
Expand All @@ -31,6 +34,8 @@ class AlgoliaClient:
@classmethod
def get_algolia_client(cls):
""" Get Algolia client instance. """
if not SearchClient:
return None
if not cls.algolia_client:
if not (cls.algolia_app_id and cls.algolia_search_api_key):
return None
Expand Down
18 changes: 15 additions & 3 deletions lms/djangoapps/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@
Helper Methods
"""

from braze.client import BrazeClient
try:
from braze.client import BrazeClient
except ImportError:
BrazeClient = None
from django.conf import settings
from optimizely import optimizely
from optimizely.config_manager import PollingConfigManager
try:
from optimizely import optimizely
from optimizely.config_manager import PollingConfigManager
except ImportError:
optimizely = None
PollingConfigManager = None


def _get_key(key_or_id, key_cls):
Expand All @@ -22,6 +29,9 @@ def _get_key(key_or_id, key_cls):

def get_braze_client():
""" Returns a Braze client. """
if not BrazeClient:
return None

braze_api_key = settings.EDX_BRAZE_API_KEY
braze_api_url = settings.EDX_BRAZE_API_SERVER

Expand All @@ -41,6 +51,8 @@ class OptimizelyClient:

@classmethod
def get_optimizely_client(cls):
if not optimizely:
return None
if not cls.optimizely_client:
optimizely_sdk_key = settings.OPTIMIZELY_FULLSTACK_SDK_KEY
if not optimizely_sdk_key:
Expand Down
193 changes: 2 additions & 191 deletions requirements/edx/base.in
Original file line number Diff line number Diff line change
@@ -1,191 +1,2 @@
# Core dependencies for running edx-platform (LMS or Studio)
#
# DON'T JUST ADD NEW DEPENDENCIES!!!
#
# If you open a pull request that adds a new dependency, you should:
# * verify that the dependency has a license compatible with AGPLv3
# * confirm that it has no system requirements beyond what we already install
# * run "make upgrade" to update the detailed requirements files
#

-c ../constraints.txt

-r github.in # Forks and other dependencies not yet on PyPI
-r paver.txt # Requirements for running paver commands

# Please follow these guidelines whenever you change this file:
#
# 1. When adding a new dependency, add a comment to the end of the line
# explaining why it is needed.
# 2. Do not pin exact versions unless absolutely necessary. When upgrading
# an already-pinned package to its latest release, remove the version pin.
# 3. Do not add indirect dependencies unless a version constraint is needed to
# avoid versions which have known problems.
# 4. If the package is not needed in production, add it to another file such
# as development.in or testing.in instead.

acid-xblock
algoliasearch # Algolia’s API client for indexed searching
analytics-python # Used for Segment analytics
attrs # Reduces boilerplate code involving class attributes
Babel # Internationalization utilities, used for date formatting in a few places
bleach[css] # Allowed-list-based HTML sanitizing library that escapes or strips markup and attributes; used for capa and LTI
boto # Deprecated version of the AWS SDK; we should stop using this
boto3 # Amazon Web Services SDK for Python
botocore # via boto3, s3transfer
bridgekeeper # Used for determining permissions for courseware.
celery # Asynchronous task execution library
chem # A helper library for chemistry calculations
codejail-includes # CodeJail manages execution of untrusted code in secure sandboxes.
contextlib2 # We need contextlib2.ExitStack so we can stop using contextlib.nested which doesn't exist in python 3
crowdsourcehinter-xblock
cryptography # Implementations of assorted cryptography algorithms
defusedxml
Django # Web application framework
django-appconf
django-celery-results # Only used for the CacheBackend for celery results
django-config-models # Configuration models for Django allowing config management with auditing
django-cors-headers # Used to allow to configure CORS headers for cross-domain requests
django-countries # Country data for Django forms and model fields
django-crum # Middleware that stores the current request and user in thread local storage
django-fernet-fields # via edx-enterprise (should be added to its setup.py)
django-filter # Allows users to filter Django querysets dynamically
django-ipware # Get the client's real IP address
django-method-override # Allow use of HTTP methods normally not supported by browsers via the X-HTTP-Method-Override header
django-model-utils
django-mptt
django-mysql
django-oauth-toolkit # Provides oAuth2 capabilities for Django
django-pipeline
django-ratelimit
django-sekizai
django-ses
django-simple-history
django-splash
django-statici18n
django-storages
django-user-tasks
django-waffle
django-webpack-loader # Used to wire webpack bundles into the django asset pipeline
djangorestframework
docopt
done-xblock
edx-ace
edx-api-doc-tools
edx-auth-backends # Allow Studio to use LMS SSO
edx-braze-client
edx-bulk-grades # LMS REST API for managing bulk grading operations
edx-ccx-keys
edx-celeryutils
edx-completion
edx-django-release-util # Release utils for the edx release pipeline
edx-django-sites-extensions
edx-codejail
# edx-django-utils 5.4.0 adds CSP middleware
edx-django-utils>=5.4.0 # Utilities for cache, monitoring, and plugins
edx-drf-extensions
edx-enterprise
# edx-event-bus-kafka 4.0.0 adds support for configurable consumer API
edx-event-bus-kafka>=4.0.1 # Kafka implementation of event bus
edx-event-bus-redis
edx-milestones
edx-name-affirmation
edx-opaque-keys
edx-organizations
edx-proctoring>=2.0.1
edx-proctoring-proctortrack==1.0.5 # Intentionally and permanently pinned to ensure code changes are reviewed
edx-rest-api-client
edx-search
edx-sga
edx-submissions
edx-toggles # Feature toggles management
edx-token-utils # Validate exam access tokens
edx-user-state-client
edx-when
edxval
event-tracking
enmerkar-underscore # Implements a underscore extractor for django-babel.
fs
fs-s3fs==0.1.8
geoip2 # Python API for the GeoIP web services and databases
glob2 # Enhanced glob module, used in openedx.core.lib.rooted_paths
gunicorn
help-tokens
html5lib # HTML parser, used for capa problems
icalendar # .ics generator, used by calendar_sync
ipaddress # Ip network support for Embargo feature
jsonfield # Django model field for validated JSON; used in several apps
laboratory # Library for testing that code refactors/infrastructure changes produce identical results
lxml # XML parser
learner-pathway-progress # A plugin for lms to track learners progress in pathays
lti-consumer-xblock>=7.3.0
mailsnake # Needed for mailchimp (mailing djangoapp)
mako # Primary template language used for server-side page rendering
Markdown # Convert text markup to HTML; used in capa problems, forums, and course wikis
mongoengine # Object-document mapper for MongoDB, used in the LMS dashboard
mysqlclient # Driver for the default production relational database
newrelic # New Relic agent for performance monitoring
nltk # Natural language processing; used by the chem package
nodeenv # Utility for managing Node.js environments; we use this for deployments and testing
oauthlib # OAuth specification support for authenticating via LTI or other Open edX services
olxcleaner
openedx-calc # Library supporting mathematical calculations for Open edX
openedx-django-require
# openedx-events 3.1.0 introduces producer API
openedx-events>=3.1.0 # Open edX Events from Hooks Extension Framework (OEP-50)
openedx-filters # Open edX Filters from Hooks Extension Framework (OEP-50)
openedx-mongodbproxy
optimizely-sdk # Optimizely full stack SDK for Python
ora2>=4.5.0
outcome-surveys # edx-platform plugin to send and track segment events needed for surveys
openedx-django-wiki
openedx-blockstore
path
piexif # Exif image metadata manipulation, used in the profile_images app
Pillow # Image manipulation library; used for course assets, profile images, invoice PDFs, etc.
py2neo # Driver for converting Python modulestore structures to Neo4j's schema (for Coursegraph).
pycountry
pycryptodomex
pygments # Used to support colors in paver command output
pyjwkest
# TODO Replace PyJWT usage with pyjwkest
# PyJWT 1.6.3 contains PyJWTError, which is required by Apple auth in social-auth-core
PyJWT>=1.6.3
pylti1p3 # Required by content_libraries core library to support LTI 1.3 launches
pymongo # MongoDB driver
pynliner # Inlines CSS styles into HTML for email notifications
python-dateutil
python-Levenshtein
python3-openid ; python_version>='3'
python3-saml
pyuca # For more accurate sorting of translated country names in django-countries
pysrt # Support for SubRip subtitle files, used in the video XModule
pytz # Time zone information database
PyYAML # Used to parse XModule resource templates
recommender-xblock # https://github.com/edx/RecommenderXBlock
redis # celery task broker
requests-oauthlib # Simplifies use of OAuth via the requests library, used for CCX and LTI
random2
rules # Django extension for rules-based authorization checks
social-auth-core
simplejson
Shapely # Geometry library, used for image click regions in capa
six # Utilities for supporting Python 2 & 3 in the same codebase
skill-tagging # Library needed to support tagging of skills in unit/video xblocks via forms
social-auth-app-django
sorl-thumbnail
sortedcontainers # Provides SortedKeyList, used for lists of XBlock assets
sqlparse # Required by Django to run migrations.RunSQL
stevedore # Support for runtime plugins, used for XBlocks and edx-platform Django app plugins
staff-graded-xblock # An XBlock that allows for off-site bulk scoring of problems
super-csv # Generic CSV processor
unicodecsv # Easier support for CSV files with unicode text
user-util # Functionality for retiring users (GDPR compliance)
webob
web-fragments # Provides the ability to render fragments of web pages
XBlock[django] # Courseware component architecture
xblock-utils # Provides utilities used by the Discussion XBlock
xss-utils # https://github.com/edx/edx-platform/pull/20633 Fix XSS via Translations
xblock-poll # Xblock for polling users
xblock-drag-and-drop-v2 # Drag and Drop XBlock
xblock-google-drive # XBlock for google docs and calendar
-r kernel.in # Core dependencies required for the platform to run.
-r bundled.in # Additional packages usually bundled with the platform
Loading

0 comments on commit 83f54ae

Please sign in to comment.