Squash a warning, earn a badge!

Hello fellow Open edX developers! :robot:

We are giving away this badge which can be proudly displayed on these forums as a medal of competence and moral integrity:
warning-squasher
Icon made by Vitaly Gorbachev from www.flaticon.com

But there is a catch :wink: To earn this badge you will have to create and merge a pull request that helps resolve a certain issue: when running any Open edX command, running tests, or running a platform in production, the console is flooded by warning messages. As an example, here is what I get when I run a trivial management command in the LMS container of the devstack:

root@lms:/edx/app/edxapp/edx-platform# ./manage.py lms shell -c "print('hello')"
2020-10-27 18:50:08,031 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/importlib/__init__.py:127: SysPathHackWarning: Importing lms_initialization instead of lms.djangoapps.lms_initialization is deprecated
  return _bootstrap._gcd_import(name[level:], package, level)

2020-10-27 18:50:08,032 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/importlib/__init__.py:127: SysPathHackWarning: Importing lms_initialization.apps instead of lms.djangoapps.lms_initialization.apps is deprecated
  return _bootstrap._gcd_import(name[level:], package, level)

2020-10-27 18:50:08,220 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/newrelic/console.py:84: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  prototype = wrapper.__name__[3:] + ' ' + inspect.formatargspec(

2020-10-27 18:50:08,317 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/course_wiki/plugins/markdownedx/__init__.py:4: SysPathHackWarning: Importing course_wiki.plugins instead of lms.djangoapps.course_wiki.plugins is deprecated
  from course_wiki.plugins.markdownedx.wiki_plugin import ExtendMarkdownPlugin

2020-10-27 18:50:08,318 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/course_wiki/plugins/markdownedx/__init__.py:4: SysPathHackWarning: Importing course_wiki.plugins.markdownedx instead of lms.djangoapps.course_wiki.plugins.markdownedx is deprecated
  from course_wiki.plugins.markdownedx.wiki_plugin import ExtendMarkdownPlugin

2020-10-27 18:50:08,318 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/course_wiki/plugins/markdownedx/__init__.py:4: SysPathHackWarning: Importing course_wiki.plugins.markdownedx.wiki_plugin instead of lms.djangoapps.course_wiki.plugins.markdownedx.wiki_plugin is deprecated
  from course_wiki.plugins.markdownedx.wiki_plugin import ExtendMarkdownPlugin

2020-10-27 18:50:08,332 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/course_wiki/plugins/markdownedx/wiki_plugin.py:7: SysPathHackWarning: Importing course_wiki.plugins.markdownedx.mdx_mathjax instead of lms.djangoapps.course_wiki.plugins.markdownedx.mdx_mathjax is deprecated
  from course_wiki.plugins.markdownedx import mdx_mathjax, mdx_video

2020-10-27 18:50:08,333 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/course_wiki/plugins/markdownedx/wiki_plugin.py:7: SysPathHackWarning: Importing course_wiki.plugins.markdownedx.mdx_video instead of lms.djangoapps.course_wiki.plugins.markdownedx.mdx_video is deprecated
  from course_wiki.plugins.markdownedx import mdx_mathjax, mdx_video

2020-10-27 18:50:09,466 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/importlib/__init__.py:127: SysPathHackWarning: Importing survey instead of lms.djangoapps.survey is deprecated
  return _bootstrap._gcd_import(name[level:], package, level)

2020-10-27 18:50:09,467 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/importlib/__init__.py:127: SysPathHackWarning: Importing survey.apps instead of lms.djangoapps.survey.apps is deprecated
  return _bootstrap._gcd_import(name[level:], package, level)

2020-10-27 18:50:09,669 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/importlib/__init__.py:127: SysPathHackWarning: Importing mailing instead of lms.djangoapps.mailing is deprecated
  return _bootstrap._gcd_import(name[level:], package, level)

2020-10-27 18:50:09,678 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/importlib/__init__.py:127: SysPathHackWarning: Importing gating instead of lms.djangoapps.gating is deprecated
  return _bootstrap._gcd_import(name[level:], package, level)

2020-10-27 18:50:09,679 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/importlib/__init__.py:127: SysPathHackWarning: Importing gating.apps instead of lms.djangoapps.gating.apps is deprecated
  return _bootstrap._gcd_import(name[level:], package, level)

2020-10-27 18:50:09,681 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/importlib/__init__.py:127: SysPathHackWarning: Importing learner_dashboard instead of lms.djangoapps.learner_dashboard is deprecated
  return _bootstrap._gcd_import(name[level:], package, level)

2020-10-27 18:50:09,684 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/importlib/__init__.py:127: SysPathHackWarning: Importing email_marketing instead of lms.djangoapps.email_marketing is deprecated
  return _bootstrap._gcd_import(name[level:], package, level)

2020-10-27 18:50:09,685 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/importlib/__init__.py:127: SysPathHackWarning: Importing email_marketing.apps instead of lms.djangoapps.email_marketing.apps is deprecated
  return _bootstrap._gcd_import(name[level:], package, level)

2020-10-27 18:50:09,695 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/experiments/flags.py:14: SysPathHackWarning: Importing experiments instead of lms.djangoapps.experiments is deprecated
  from experiments.stable_bucketing import stable_bucketing_hash_group

2020-10-27 18:50:09,695 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/experiments/flags.py:14: SysPathHackWarning: Importing experiments.stable_bucketing instead of lms.djangoapps.experiments.stable_bucketing is deprecated
  from experiments.stable_bucketing import stable_bucketing_hash_group

2020-10-27 18:50:10,440 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/certificates/models.py:72: SysPathHackWarning: Importing badges instead of lms.djangoapps.badges is deprecated
  from badges.events.course_complete import course_badge_check

2020-10-27 18:50:10,441 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/certificates/models.py:72: SysPathHackWarning: Importing badges.events instead of lms.djangoapps.badges.events is deprecated
  from badges.events.course_complete import course_badge_check

2020-10-27 18:50:10,442 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/certificates/models.py:72: SysPathHackWarning: Importing badges.events.course_complete instead of lms.djangoapps.badges.events.course_complete is deprecated
  from badges.events.course_complete import course_badge_check

2020-10-27 18:50:10,444 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/badges/events/course_complete.py:15: SysPathHackWarning: Importing badges.models instead of lms.djangoapps.badges.models is deprecated
  from badges.models import BadgeAssertion, BadgeClass, CourseCompleteImageConfiguration

2020-10-27 18:50:10,445 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/badges/models.py:23: SysPathHackWarning: Importing badges.utils instead of lms.djangoapps.badges.utils is deprecated
  from badges.utils import deserialize_count_specs

2020-10-27 18:50:10,454 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/certificates/models.py:73: SysPathHackWarning: Importing badges.events.course_meta instead of lms.djangoapps.badges.events.course_meta is deprecated
  from badges.events.course_meta import completion_check, course_group_check

2020-10-27 18:50:10,668 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/courseware/courses.py:26: SysPathHackWarning: Importing branding instead of lms.djangoapps.branding is deprecated
  import branding

2020-10-27 18:50:10,683 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/courseware/access.py:46: SysPathHackWarning: Importing mobile_api instead of lms.djangoapps.mobile_api is deprecated
  from mobile_api.models import IgnoreMobileAvailableFlagConfig

2020-10-27 18:50:10,684 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/courseware/access.py:46: SysPathHackWarning: Importing mobile_api.models instead of lms.djangoapps.mobile_api.models is deprecated
  from mobile_api.models import IgnoreMobileAvailableFlagConfig

2020-10-27 18:50:10,803 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/certificates/api.py:19: SysPathHackWarning: Importing branding.api instead of lms.djangoapps.branding.api is deprecated
  from branding import api as branding_api

2020-10-27 18:50:10,804 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/branding/api.py:26: SysPathHackWarning: Importing branding.models instead of lms.djangoapps.branding.models is deprecated
  from branding.models import BrandingApiConfig

2020-10-27 18:50:11,128 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/lms_xblock/runtime.py:13: SysPathHackWarning: Importing badges.service instead of lms.djangoapps.badges.service is deprecated
  from badges.service import BadgingService

2020-10-27 18:50:11,345 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/openedx/features/discounts/utils.py:15: SysPathHackWarning: Importing experiments.models instead of lms.djangoapps.experiments.models is deprecated
  from experiments.models import ExperimentData

2020-10-27 18:50:11,400 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/courseware/courses.py:63: SysPathHackWarning: Importing survey.utils instead of lms.djangoapps.survey.utils is deprecated
  from survey.utils import SurveyRequiredAccessError, check_survey_required_and_unanswered

2020-10-27 18:50:11,400 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/survey/utils.py:10: SysPathHackWarning: Importing survey.models instead of lms.djangoapps.survey.models is deprecated
  from survey.models import SurveyAnswer, SurveyForm

2020-10-27 18:50:11,401 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/survey/models.py:18: SysPathHackWarning: Importing survey.exceptions instead of lms.djangoapps.survey.exceptions is deprecated
  from survey.exceptions import SurveyFormNameAlreadyExists, SurveyFormNotFound

2020-10-27 18:50:11,696 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/sorl/thumbnail/conf/__init__.py:16: RemovedInDjango30Warning: The DEFAULT_CONTENT_TYPE setting is deprecated.
  setattr(self, attr, getattr(obj, attr))

2020-10-27 18:50:11,697 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/sorl/thumbnail/conf/__init__.py:16: RemovedInDjango31Warning: The FILE_CHARSET setting is deprecated. Starting with Django 3.1, all files read from disk must be UTF-8 encoded.
  setattr(self, attr, getattr(obj, attr))

2020-10-27 18:50:11,830 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/email_marketing/tasks.py:17: SysPathHackWarning: Importing email_marketing.models instead of lms.djangoapps.email_marketing.models is deprecated
  from email_marketing.models import EmailMarketingConfiguration

2020-10-27 18:50:11,986 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/bulk_email/tasks.py:43: SysPathHackWarning: Importing bulk_email instead of lms.djangoapps.bulk_email is deprecated
  from bulk_email.models import CourseEmail, Optout

2020-10-27 18:50:11,987 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/bulk_email/tasks.py:43: SysPathHackWarning: Importing bulk_email.models instead of lms.djangoapps.bulk_email.models is deprecated
  from bulk_email.models import CourseEmail, Optout

2020-10-27 18:50:11,987 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/bulk_email/tasks.py:44: SysPathHackWarning: Importing bulk_email.api instead of lms.djangoapps.bulk_email.api is deprecated
  from bulk_email.api import get_unsubscribed_link

2020-10-27 18:50:11,988 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/bulk_email/api.py:12: SysPathHackWarning: Importing bulk_email.models_api instead of lms.djangoapps.bulk_email.models_api is deprecated
  from bulk_email.models_api import (

2020-10-27 18:50:11,997 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/instructor_task/tasks_helper/grades.py:13: SysPathHackWarning: Importing course_blocks instead of lms.djangoapps.course_blocks is deprecated
  from course_blocks.api import get_course_blocks

2020-10-27 18:50:11,998 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/instructor_task/tasks_helper/grades.py:13: SysPathHackWarning: Importing course_blocks.api instead of lms.djangoapps.course_blocks.api is deprecated
  from course_blocks.api import get_course_blocks

2020-10-27 18:50:12,050 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/bulk_email/admin.py:9: SysPathHackWarning: Importing bulk_email.forms instead of lms.djangoapps.bulk_email.forms is deprecated
  from bulk_email.forms import CourseAuthorizationAdminForm, CourseEmailTemplateForm

2020-10-27 18:50:12,063 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/importlib/__init__.py:127: SysPathHackWarning: Importing course_wiki.editors instead of lms.djangoapps.course_wiki.editors is deprecated
  return _bootstrap._gcd_import(name[level:], package, level)

2020-10-27 18:50:12,078 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/rss_proxy/admin.py:8: SysPathHackWarning: Importing rss_proxy instead of lms.djangoapps.rss_proxy is deprecated
  from rss_proxy.models import WhitelistedRssUrl

2020-10-27 18:50:12,078 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/rss_proxy/admin.py:8: SysPathHackWarning: Importing rss_proxy.models instead of lms.djangoapps.rss_proxy.models is deprecated
  from rss_proxy.models import WhitelistedRssUrl

2020-10-27 18:50:12,297 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/gating/apps.py:17: SysPathHackWarning: Importing gating.signals instead of lms.djangoapps.gating.signals is deprecated
  from gating import signals  # pylint: disable=unused-import

2020-10-27 18:50:12,298 WARNING 122 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/gating/tasks.py:13: SysPathHackWarning: Importing gating.api instead of lms.djangoapps.gating.api is deprecated
  from gating import api as gating_api

hello

There are about 50 warnings in there, resulting in 150 lines of non-informative output.

Similarly, when running unit tests the console is filled with such warnings, preventing developers from efficiently analyzing test failures:

root@lms:/edx/app/edxapp/edx-platform# pytest openedx/core/djangoapps/credentials/ > pytest-credentials-warnings.txt
root@lms:/edx/app/edxapp/edx-platform# wc -l pytest-credentials-warnings.txt 
373 pytest-credentials-warnings.txt

That’s 373 lines for 85 warnings and just 38 unit tests! And of course the problem becomes even worse when running the full unit test suite: in this particular run the warnings (at the end) take 12800 lines! That’s 1.6 Mb of text!

(To put things in perspective, Windows 3.1 fitted on a 1.4 Mb floppy disk when it was released. And there are are people who create truly extraordinary stuff with less an 1kb of text)

In other words, this is WAY too much.

thenumberofwarningsistoodamnhigh

Which is why I invite you to join me in my quest to get rid of these warnings:

  1. Identify a warning that you would like to get rid of: there should not already be an answer in this topic that mentions this warning.
  2. Fix the warning: not by silencing it, but by resolving the underlying issue.
  3. Create a pull request with your changes: a good title would be something similar to “Squash … warning”.
  4. Post a link to your PR here in the comments. List the warnings that you are squashing such that other developers can see what you are working on.
  5. Get in merged in time for the Koa release: that’s December 9, but you should have your PR ready by Nov 25 to leave us time to backport your change in the release.

Those who achieve these steps will earn “Warning Squasher” badge above. This badge is granted for eternity and will never be deprecated.

So what are you waiting for?

15 Likes

Here is my entry to squash the lms_initialization warnings: https://github.com/edx/edx-platform/pull/25457

3 Likes

Here’s mine: https://github.com/edx/edx-platform/pull/25401

It removes ~200 EdxPlatformDeprecatedImportWarnings. If anyone is going after those, you may want to base your branch off of mine as to not duplicate work (edit: This has since been merged. Any of those warnings you see are fair game for squashing :+1: ).

4 Likes

It’s a real badge: https://discuss.openedx.org/badges/104/warning-squasher

Here’s my entry: https://github.com/edx/edx-platform/pull/25527

It removes waffle_utils.WaffleFlag warnings caused by CourseWaffleFlag, because the parent class was not updated.

It’s a pretty silly warning squash, so I’ll do my best to contribute another warning squash :slightly_smiling_face:

4 Likes

It’s not silly at all! I added this warning :wink: And removing it may have more consequences than you expect… But that’s great, and that’s less work for me :stuck_out_tongue:

1 Like

Yeah I was afraid of that :sweat_smile: hahaha. I’ll try to test this in additional ways, and hopefully the discussion on the PR will be helpful to identify anything I overlook :+1: :smiley:

Here is my entry: https://github.com/edx/edx-platform/pull/25542

This helps us get rid of the following warnings (DeprecatedEdxPlatformImportWarning) emitted while issuing makemigrations command:

2020-11-07 07:44:44,540 WARNING 9560 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/experiments/views.py:19: DeprecatedEdxPlatformImportWarning: Importing experiments instead of lms.djangoapps.experiments is deprecated
  from experiments import filters, serializers
2020-11-07 07:44:44,541 WARNING 9560 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/experiments/views.py:19: DeprecatedEdxPlatformImportWarning: Importing experiments.filters instead of lms.djangoapps.experiments.filters is deprecated
  from experiments import filters, serializers
2020-11-07 07:44:44,543 WARNING 9560 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/experiments/views.py:19: DeprecatedEdxPlatformImportWarning: Importing experiments.serializers instead of lms.djangoapps.experiments.serializers is deprecated
  from experiments import filters, serializers
2020-11-07 07:44:44,544 WARNING 9560 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/experiments/views.py:20: DeprecatedEdxPlatformImportWarning: Importing experiments.models instead of lms.djangoapps.experiments.models is deprecated
  from experiments.models import ExperimentData, ExperimentKeyValue
2020-11-07 07:44:44,545 WARNING 9560 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/experiments/views.py:21: DeprecatedEdxPlatformImportWarning: Importing experiments.permissions instead of lms.djangoapps.experiments.permissions is deprecated
  from experiments.permissions import IsStaffOrOwner, IsStaffOrReadOnly, IsStaffOrReadOnlyForSelf
2020-11-07 07:44:44,545 WARNING 9560 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/lms/djangoapps/experiments/views.py:22: DeprecatedEdxPlatformImportWarning: Importing experiments.utils instead of lms.djangoapps.experiments.utils is deprecated
  from experiments.utils import get_experiment_user_metadata_context
4 Likes

Here is my entry: https://github.com/edx/edx-platform/pull/25595

2020-11-13 20:15:47,100 WARNING 6388 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/video_module/transcripts_utils.py:682: DeprecationWarning: The unescape method is deprecated and will be removed in 3.5, use html.unescape() instead.
  return HTMLParser().unescape("\n".join(text_without_none))
3 Likes

Here is mine: https://github.com/edx/edx-platform/pull/25604

warnings.py:109 - /edx/app/edxapp/edx-platform/common/djangoapps/static_replace/__init__.py:76: DeprecationWarning: Flags not at the start of the expression '\n        (?x)       ' (truncated)
2 Likes

Here is mine: https://github.com/edx/edx-platform/pull/25617

Squashes a massive 19 naive datetime warnings in test files I was playing in last week

in course_duration_limits

openedx/features/course_duration_limits/tests/test_models.py::TestCourseDurationLimitConfig::test_caching_org
openedx/features/course_duration_limits/tests/test_models.py::TestCourseDurationLimitConfig::test_all_current_course_configs
openedx/features/course_duration_limits/tests/test_models.py::TestCourseDurationLimitConfig::test_caching_global
openedx/features/course_duration_limits/tests/test_models.py::TestCourseDurationLimitConfig::test_caching_site
openedx/features/course_duration_limits/tests/test_models.py::TestCourseDurationLimitConfig::test_caching_course
  /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/models/fields/__init__.py:1424: RuntimeWarning: DateTimeField CourseDurationLimitConfig.enabled_as_of received a naive datetime (2018-01-01 00:00:00) while time zone support is active.
    warnings.warn("DateTimeField %s received a naive datetime (%s)"

in course_experience

openedx/features/course_experience/tests/views/test_course_home.py::TestCourseHomePage::test_queries
openedx/features/course_experience/tests/views/test_course_home.py::TestCourseHomePageAccess::test_course_messaging_for_staff
openedx/features/course_experience/tests/views/test_course_home.py::TestCourseHomePageAccess::test_course_expiration_banner_with_unicode
openedx/features/course_experience/tests/views/test_course_home.py::TestCourseHomePageAccess::test_course_messaging
  /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/models/fields/__init__.py:1424: RuntimeWarning: DateTimeField CourseDurationLimitConfig.enabled_as_of received a naive datetime (2018-01-01 00:00:00) while time zone support is active.
    warnings.warn("DateTimeField %s received a naive datetime (%s)"

openedx/features/course_experience/tests/views/test_course_home.py::TestCourseHomePageAccess::test_expired_course
openedx/features/course_experience/tests/views/test_course_home.py::TestCourseHomePageAccess::test_audit_only_not_expired
openedx/features/course_experience/tests/views/test_course_home.py::TestCourseHomePageAccess::test_expiration_banner_with_expired_upgrade_deadline
openedx/features/course_experience/tests/views/test_course_home.py::TestCourseHomePageAccess::test_expired_course_in_holdback
  /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/models/fields/__init__.py:1424: RuntimeWarning: DateTimeField CourseDurationLimitConfig.enabled_as_of received a naive datetime (2010-01-01 00:00:00) while time zone support is active.
    warnings.warn("DateTimeField %s received a naive datetime (%s)"

openedx/features/course_experience/tests/views/test_course_home.py::TestCourseHomePageAccess::test_expiration_banner_with_expired_upgrade_deadline
  /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/models/fields/__init__.py:1424: RuntimeWarning: DateTimeField CourseMode._expiration_datetime received a naive datetime (2010-01-01 00:00:00) while time zone support is active.
    warnings.warn("DateTimeField %s received a naive datetime (%s)"

openedx/features/course_experience/tests/views/test_course_home.py::TestCourseHomePageAccess::test_expiration_banner_with_expired_upgrade_deadline
  /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/models/fields/__init__.py:1424: RuntimeWarning: DateTimeField HistoricalCourseMode._expiration_datetime received a naive datetime (2010-01-01 00:00:00) while time zone support is active.
    warnings.warn("DateTimeField %s received a naive datetime (%s)"

openedx/features/course_experience/tests/views/test_course_updates.py::TestCourseUpdatesPage::test_queries
  /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/models/fields/__init__.py:1424: RuntimeWarning: DateTimeField ContentTypeGatingConfig.enabled_as_of received a naive datetime (2018-01-01 00:00:00) while time zone support is active.
    warnings.warn("DateTimeField %s received a naive datetime (%s)"
3 Likes

Thanks to everyone who submitted a PR, you rock!

To the others: it’s not too late to submit your entry, but hurry up!

Here’s my entry: https://github.com/edx/edx-platform/pull/25645

./manage.py lms shell -c "print('hello')"

2020-11-19 09:36:40,680 WARNING 2788 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/openedx/core/djangoapps/user_authn/cookies.py:25: DeprecatedEdxPlatformImportWarning: Importing student.models instead of common.djangoapps.student.models is deprecated
  from student.models import CourseEnrollment

2020-11-19 09:36:40,680 WARNING 2788 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/openedx/core/djangoapps/user_authn/cookies.py:26: DeprecatedEdxPlatformImportWarning: Importing util.json_request instead of common.djangoapps.util.json_request is deprecated
  from util.json_request import JsonResponse

python manage.py lms migrate

2020-11-19 09:52:25,431 WARNING 2969 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/edx-platform/openedx/core/djangoapps/content/learning_sequences/api/processors/content_gating.py:7: DeprecatedEdxPlatformImportWarning: Importing util.milestones_helpers instead of common.djangoapps.util.milestones_helpers is deprecated
  from util import milestones_helpers

pytest --pdbcls pudb.debugger:Debugger --pdb --capture=no lms/djangoapps/instructor_task:

lms/djangoapps/instructor_task/tests/test_tasks_helper.py: 20 warnings
lms/djangoapps/instructor_task/tests/test_integration.py: 20 warnings
  /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/edx_django_utils/monitoring/code_owner/middleware.py:23: DeprecationWarning: Use 'edx_django_utils.monitoring.CodeOwnerMonitoringMiddleware' in place of 'edx_django_utils.monitoring.code_owner.middleware.CodeOwnerMonitoringMiddleware'.
    warnings.warn(msg, DeprecationWarning)

and

lms/djangoapps/instructor_task/tests/test_tasks_helper.py: 20 warnings
lms/djangoapps/instructor_task/tests/test_integration.py: 20 warnings
  /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/edx_django_utils/monitoring/middleware.py:23: DeprecationWarning: Use 'edx_django_utils.monitoring.CachedCustomMonitoringMiddleware' in place of 'edx_django_utils.monitoring.middleware.CachedCustomMonitoringMiddleware'.
    warnings.warn(msg, DeprecationWarning)

Before:
image

After:
image

2 Likes

And one more: https://github.com/edx/edx-platform/pull/25646

Before:
image
After:
image

5 Likes

Where is the triple :heart: button?

1 Like

BTW, these merged squashes would be good things to cherry-pick onto the Koa branches. Does someone want to take that on? I can help get you set up.

Also, the badge can be awarded multiple times, so if you’ve already squashed a warning, you can still squash more!!1!

3 Likes

There’s still many low-hanging fruits: https://build.testeng.edx.org/job/edx-platform-python-pipeline-master/4641/warning_5freport_5fall_2ehtml/

1 Like

My entry is in two parts:

It removed 18 instances of Django REST Framework deprecation warnings, and clears the way to upgrading DRF in edx-platform most of the way to the latest release.

@nedbat For cherry-picking this one in Koa, we may just want to bump the django-user-tasks version, and not the rest of the upgrades that merged in the same PR (although they should be harmless to include also)

3 Likes

My entries:

Removes the following warnings:

2020-11-23 14:28:08,712 WARNING 240810 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/enterprise/utils.py:63: DeprecatedEdxPlatformImportWarning: Importing student instead of common.djangoapps.student is deprecated
  from student.api import (

2020-11-23 14:28:08,714 WARNING 240810 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/enterprise/utils.py:63: DeprecatedEdxPlatformImportWarning: Importing student.api instead of common.djangoapps.student.api is deprecated
  from student.api import (

2020-11-23 14:28:08,716 WARNING 240810 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/enterprise/utils.py:74: DeprecatedEdxPlatformImportWarning: Importing third_party_auth.provider instead of common.djangoapps.third_party_auth.provider is deprecated
  from third_party_auth.provider import Registry  # pylint: disable=unused-import

2020-11-23 14:28:08,719 WARNING 240810 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/enterprise/utils.py:81: DeprecatedEdxPlatformImportWarning: Importing track instead of common.djangoapps.track is deprecated
  from track import segment

2020-11-23 14:28:09,139 WARNING 240810 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/enterprise/admin/forms.py:35: DeprecatedEdxPlatformImportWarning: Importing third_party_auth.models instead of common.djangoapps.third_party_auth.models is deprecated
  from third_party_auth.models import SAMLProviderConfig as saml_provider_configuration

2020-11-23 14:28:09,589 WARNING 240810 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/enterprise/signals.py:40: DeprecatedEdxPlatformImportWarning: Importing student.models instead of common.djangoapps.student.models is deprecated
  from student.models import CourseEnrollment

2020-11-23 14:28:11,450 WARNING 240810 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/staff_graded/staff_graded.py:27: DeprecatedEdxPlatformImportWarning: Importing course_modes instead of common.djangoapps.course_modes is deprecated
  from course_modes.models import CourseMode

2020-11-23 14:28:11,452 WARNING 240810 [py.warnings] [user None] [ip None] warnings.py:109 - /edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/staff_graded/staff_graded.py:27: DeprecatedEdxPlatformImportWarning: Importing course_modes.models instead of common.djangoapps.course_modes.models is deprecated
  from course_modes.models import CourseMode

When running:

./manage.py lms --settings production createsuperuser

3 Likes