Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: use full import path to safe_lxml #324

Merged

Conversation

kdmccormick
Copy link

What's this PR do?

Previously, edx-platform's safe_lxml module was imported as:

import safe_lxml

This still works, but will stop working very soon.

This commit updates edx-sga's usage of safe_lxml to the new, correct import path:

import openedx.core.lib.safe_lxml

This change is NOT backwards-compatible with Nutmeg or earlier.
Bumps edx-sga version to 0.19.0.

What are the relevant tickets? / Any background context you want to provide?

How should this be manually tested?

This is probably safe without further manual testing, but anyway here's what I did:

  • I ran unit tests via tox and confirmed they passed. Pylint failed, but it failed on master too.
  • I made sure this worked with the corresponding branch of edx-platform. From within tutor dev run lms bash -m path/to/my/edx-platform:
    • I installed my version of edx-sga:
      • pip install git+https://github.com/kdmccormick/edx-sga@kdmccormick/fix-safe-lxml-import#egg=edx-sga==0.19.0
    • I ran these tests, which had been failing because of the old safe_lxml import in edx-sga:
      • pytest lms/djangoapps/grades/tests/test_scores.py -k possibly_scored

Where should the reviewer start?

Changes should be pretty non-controversial, but let me know if you have concerns.

One thing: If this commit merges as-is, master of this repo will be incompatible with open-release/nutmeg.master of edx-platform (and earlier). Is that OK? Or does master of this repo need to support older versions of edx-platform?

Screenshots (if appropriate)

N/A

What GIF best describes this PR or how it makes you feel?

I'm just going around breaking stuff:

gunter-breaking-everything

(just kidding, hopefully)

@kdmccormick
Copy link
Author

Hey @pdpinch , could one of you folks take a look?

@@ -2,4 +2,4 @@
Module for StaffGradedAssignmentXBlock.
"""

__version__ = "0.18.0"
__version__ = "0.19.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small note: you don't need to bump the version. Our release bot will take care of it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, fixed.

@kdmccormick kdmccormick force-pushed the kdmccormick/fix-safe-lxml-import branch from afd68c4 to 8b8cb51 Compare July 19, 2022 15:29
@kdmccormick kdmccormick changed the title fix: use full import path to safe_lxml (v0.19.0) fix!: use full import path to safe_lxml (v0.19.0) Jul 19, 2022
@kdmccormick kdmccormick changed the title fix!: use full import path to safe_lxml (v0.19.0) fix!: use full import path to safe_lxml Jul 19, 2022
@umarmughal824 umarmughal824 self-assigned this Jul 21, 2022
@umarmughal824
Copy link

umarmughal824 commented Jul 27, 2022

@kdmccormick could you please fix the failing build.

@kdmccormick
Copy link
Author

@umarmughal824 pylint is failing on master -- see #325

@kdmccormick
Copy link
Author

@umarmughal824 would you be able to fix the pylint build on master so that the test suite can pass on this PR?

@arslanashraf7
Copy link

@umarmughal824 would you be able to fix the pylint build on master so that the test suite can pass on this PR?

@kdmccormick Thanks for this PR.

Just wanted to let you know that we have fixed the linting issues in the master branch. A rebase should fix the checks on this PR too.

Previously, edx-platform's safe_lxml module was imported as:

  import safe_lxml

This still works, but will stop working very soon.

This commit updates edx-sga's usage of safe_lxml to the new,
correct import path:

  import openedx.core.lib.safe_lxml

(Details & reasoning behind this import path change:
  * https://discuss.openedx.org/t/breaking-apart-edx-platforms-common-lib-folder/7556
  * https://openedx.atlassian.net/browse/BOM-2579)

This change is NOT backwards-compatible with Nutmeg or earlier.
@kdmccormick kdmccormick force-pushed the kdmccormick/fix-safe-lxml-import branch from 8b8cb51 to 403577a Compare August 31, 2022 15:25
@kdmccormick
Copy link
Author

Thanks @arslanashraf7 ! Rebased & all ready for another round of checks & review.

Copy link

@arslanashraf7 arslanashraf7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me, but since this is a breaking change and incompatible with Nutmeg and earlier releases it would probably be safe to check or do a few things:

  1. It's worth adding some compatibility section in the README mentioning the release (0.20.0 This is going to be the next version Supposedly) is compatible only with edX release after Nutmeg.

  2. One thing: If this commit merges as-is, master of this repo will be incompatible with open-release/nutmeg.master of edx-platform (and earlier). Is that OK? Or does master of this repo need to support older versions of edx-platform?

    I don't think we install this from the master branch, but in the README we ask the user to install from release branch so merging this in the master is okay until we push a new release out through release branch.

  3. Since this breaks Nutmeg and earlier and in edx-platfrom we don't specify the version in base.in and recompiling the requirements might update the version in them and it will start breaking e.g. see this PR that update the versions from base.in.

    • So, If we push a new release we need to think about the possibility of updating the requirement in Nutmeg or older releases to keep them safe from breaking.

Also, Let's hear @pdpinch 's thoughts on this.

@pdpinch
Copy link
Member

pdpinch commented Sep 2, 2022

I don't mind making breaking changes -- we've done it before -- but we should consider the version number more carefully.

It is also a problem that future nutmeg builds would fail. Maybe @kdmccormick has some thoughts on that. Should the nutmeg branch in the version of this xBlock? I think there's some precedence with BTR for that approach.

@kdmccormick
Copy link
Author

@pdpinch @arslanashraf7 Looking at base.txt on edx-platform's open-release/nutmeg.master branch, we pin edx-sga to 0.18.0. In fact, now that I've thought about it more, I remember that we pin every direct edx-platform dependency in base.txt, and only we recompile those pins on edx-platform's master branch. The pins in the open-release/* branches are only ever upgaded manually and on a per-need basis.

So, unless someone manually changes the pin, Nutmeg will always install edx-sga==0.18.0. If they tried to change the pin, edx-platform CI tests would fail and prevent them from doing so. Given that, I believe there should be no risk in releasing a new version of this package that's backwards-incompatible.

in the README we ask the user to install from release branch so merging this in the master is okay until we push a new release out through release branch.

These instructions from the README do tell the user to install from the release branch. However, since edx-platform installs edx-sga as part of its base requirements now, I don't think the "Add SGA to the platform requirements" step is necessary any more. If you remove that step, then the reader will always have edx-sga installed at the appropriate compatible version, as specified in edx-platform's base.txt.

@pdpinch
Copy link
Member

pdpinch commented Sep 8, 2022

Thanks @kdmccormick that makes sense to me.

@arslanashraf7 we already have an issue to update the readme (#118), so I think it's OK to merge this and proceed with the release.

Copy link

@arslanashraf7 arslanashraf7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍 Thanks for creating this PR.

remember that we pin every direct edx-platform dependency in base.txt, and only we recompile those pins on edx-platform's master branch. The pins in the open-release/* branches are only ever upgaded manually and on a per-need basis.

@kdmccormick Thanks for your thoughts which seem very reasonable.

@arslanashraf7 arslanashraf7 merged commit 8897a14 into mitodl:master Sep 8, 2022
@kdmccormick kdmccormick deleted the kdmccormick/fix-safe-lxml-import branch September 8, 2022 13:29
@kdmccormick
Copy link
Author

Thanks all!

@odlbot odlbot mentioned this pull request Sep 8, 2022
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants