Skip to content

fix: expose __version__ for LXML. #36627

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

Closed

Conversation

farhaanbukhsh
Copy link
Member

@farhaanbukhsh farhaanbukhsh commented Apr 29, 2025

These changes expose the LXML version since it is used by libraries to check LXML version. We faced a problem in image-explored XBlock. Parsel needs to know the lxml version
https://github.com/scrapy/parsel/blob/master/parsel/selector.py#L35. Since this information was not being passed and etree flavor of opened.

Testing instructions:

  1. Use Tutor to set up master
  2. Clone [email protected]:openedx/xblock-image-explorer.git repo under (tutor config printroot)/env/build/openedx/requirements/
  3. Add private.txt and add -e ./xblock-image-explorer in that file.
  4. Mount this repository tutor mounts add ./xblock-image-explorer
  5. Build the image tutor images build openedx-dev
  6. Now start the dev environment with tutor dev start -d
  7. Exec in the container tutor dev exec cms bash
  8. Then run ./manage.py lms shell
In [1]: from xblock.core import XBlock
In [2]: XBlock.load_class('image-explorer')
  1. This should throw errors.
  2. Once you change the branch in the PR you need to exec in the container
  3. pip install -e /mnt/xblock-image-explorer
  4. Repeat 9 again, this time it will load without error.

Private Ref: Jira Ticket

This changes exposes the LXML version since it is used by libraries to
check LXML version.

Signed-off-by: Farhaan Bukhsh <[email protected]>
@openedx-webhooks
Copy link

Thanks for the pull request, @farhaanbukhsh!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Apr 29, 2025
@farhaanbukhsh farhaanbukhsh requested a review from Copilot April 29, 2025 14:45
@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Apr 29, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that the LXML version is exposed for libraries that rely on it, addressing compatibility issues in downstream projects such as Parsel.

  • Exposes version by updating the lxml.etree import in the safe_lxml helper module
  • Resolves version checking errors in dependencies that expect the attribute
Comments suppressed due to low confidence (1)

openedx/core/lib/safe_lxml/etree.py:21

  • [nitpick] Consider adding an inline comment above this import statement to explain that version is re-exported to support version checking by dependent libraries.
from lxml.etree import _Comment, _Element, _ElementTree, _Entity, _ProcessingInstruction, __version__

@mphilbrick211 mphilbrick211 added the needs reviewer assigned PR needs to be (re-)assigned a new reviewer label May 1, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions May 1, 2025
@farhaanbukhsh
Copy link
Member Author

farhaanbukhsh commented May 9, 2025

closing in favour of openedx/xblock-image-explorer#195

@github-project-automation github-project-automation bot moved this from Ready for Review to Done in Contributions May 9, 2025
@openedx-webhooks openedx-webhooks removed the needs reviewer assigned PR needs to be (re-)assigned a new reviewer label May 9, 2025
@Agrendalath Agrendalath deleted the farhaan/fix-lxml-version branch May 12, 2025 15:22
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
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants