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

chore: remove warnings from defusedxml package #32652

Merged

Conversation

diegovr
Copy link
Contributor

@diegovr diegovr commented Jul 5, 2023

Description

Issue: openedx/public-engineering#146

  • Refactor the deprecated defusedxml package which will no longer be supported.
    • The current python version used(python3.8) supports the xml.etree.ElementTree package which replace the old package (defusedxml).
  • Remove the Deprecation Warnings by making this change.
  • To avoid refactoring the unit tests, we can keep using the exceptions from the defusedxml package.

Supporting information

The best references to why it was deprecated I could find are here:

Also according to this documentation, since Python 3.7.1, xml modules: are no longer processes general external entities by default to increase security by default.

Testing instructions

To check and find from where I get the same warning, I run the unit tests inside the lms container (by running make dev.shell.lms) and I could found that the tests which use the deprecated package are from openedx/core/lib/tests/ path so I used pytest to confirm that.

Then after the changes I re-run the tests and the warning no longer appeared.

Other information

  • This change can also be the first step to deprecate/remove the defusedxml package since is used only in this section.

@openedx-webhooks
Copy link

openedx-webhooks commented Jul 5, 2023

Thanks for the pull request, @diegovr! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 5, 2023
@diegovr diegovr force-pushed the diegovr/DeprecatedWarningsRemoved branch 2 times, most recently from 2e9b66b to 9e93737 Compare July 5, 2023 15:28
@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jul 5, 2023
@eLRuLL
Copy link
Contributor

eLRuLL commented Jul 6, 2023

@e0d could you please enable the tests to run 🙂

@diegovr diegovr force-pushed the diegovr/DeprecatedWarningsRemoved branch 2 times, most recently from 1db8c97 to adb8f49 Compare July 6, 2023 21:57
@e0d
Copy link
Contributor

e0d commented Jul 7, 2023

@diegovr looks like there are some test and linting issues, can you have a look?

@e0d e0d removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jul 7, 2023
@diegovr diegovr changed the title chore: remove warnings from defusedxml package [WIP]chore: remove warnings from defusedxml package Jul 7, 2023
@diegovr diegovr force-pushed the diegovr/DeprecatedWarningsRemoved branch 3 times, most recently from 7838ebc to 2f1b31c Compare July 14, 2023 00:38
@diegovr diegovr changed the title [WIP]chore: remove warnings from defusedxml package chore: remove warnings from defusedxml package Jul 14, 2023
@diegovr
Copy link
Contributor Author

diegovr commented Jul 14, 2023

@diegovr looks like there are some test and linting issues, can you have a look?

Hi @e0d I have successfully reviewed the accurate unit tests. However, the most time-consuming aspect was dealing with the linting issues. Strangely, they seem to take a considerable amount of time to execute when running locally.
Could you please enable again the tests to run?

By the way, I wanted to inquire if there is an ongoing issue with the tests again, do I need to inform you each time in order to initiate the testing process? I don't want to bother you.

@diegovr diegovr force-pushed the diegovr/DeprecatedWarningsRemoved branch 3 times, most recently from e99fd85 to f9909c0 Compare July 14, 2023 19:30
@diegovr diegovr force-pushed the diegovr/DeprecatedWarningsRemoved branch from f9909c0 to d7709f5 Compare July 14, 2023 19:31
@diegovr
Copy link
Contributor Author

diegovr commented Jul 15, 2023

@e0d In the last checks I found just one lintin issue. I solved it. Could you please enable again the tests to run?

@diegovr
Copy link
Contributor Author

diegovr commented Jul 17, 2023

@e0d - All checks passed as expected, the pipeline is 🟢 :)

@e0d
Copy link
Contributor

e0d commented Jul 17, 2023

@ormsbee any thoughts on best reviewers?

@ormsbee
Copy link
Contributor

ormsbee commented Jul 19, 2023

@dianakhuang: Is this in your wheelhouse? (I have this vague recollection that you worked on this, but I might be totally off base.)

@dianakhuang
Copy link
Contributor

I don't think I worked on this originally, but I do think that I am, unfortunately, the last person to have touched this code on the 2U side.

@eLRuLL
Copy link
Contributor

eLRuLL commented Jul 26, 2023

@dianakhuang just a friendly reminder for reviewing this PR please 👍

@dianakhuang
Copy link
Contributor

Thanks for the ping! I think it looks reasonable, and I'm happy to give it an approval. I'm curious about the follow up work to remove defusedxml from unit tests and from being an installed package. Is that something you're planning on doing after this merges @diegovr ?

@diegovr
Copy link
Contributor Author

diegovr commented Jul 26, 2023

Thanks for the ping! I think it looks reasonable, and I'm happy to give it an approval. I'm curious about the follow up work to remove defusedxml from unit tests and from being an installed package. Is that something you're planning on doing after this merges @diegovr ?

@dianakhuang , thanks for taking some time to review the PR. As far as I know the issue is related to remove the DeprecationWarnings that belong to the defusedxml package. So, yes basically the idea is to create/open the possibility to remove the package after this PR would be merged since the defusedxml package will not be used anymore in this repo.

@diegovr
Copy link
Contributor Author

diegovr commented Jul 26, 2023

Thank you @dianakhuang to approve it. So, I think the PR is ready to be merged.

@dianakhuang dianakhuang merged commit 547e5b1 into openedx:master Jul 26, 2023
42 checks passed
@openedx-webhooks
Copy link

@diegovr 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@diegovr diegovr deleted the diegovr/DeprecatedWarningsRemoved branch July 26, 2023 16:51
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

8 participants