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(chore): typing-extensions, lxml compatibility #639

Conversation

changchiyou
Copy link
Contributor

@changchiyou changchiyou commented May 9, 2024

Related Issues

Proposed Changes:

  1. typing-extensions = ">=4.10.0", typing-extensions==4.10.0 ; python_version >= "3.8" and python_version < "4.0" based on

    newspaper4k/poetry.lock

    Lines 1994 to 2003 in 252bf1d

    [[package]]
    name = "typing-extensions"
    version = "4.10.0"
    description = "Backported and Experimental Type Hints for Python 3.8+"
    optional = false
    python-versions = ">=3.8"
    files = [
    {file = "typing_extensions-4.10.0-py3-none-any.whl", hash = "sha256:69b1a937c3a517342112fb4c6df7e72fc39a38e7891a5730ed4985b5214b5475"},
    {file = "typing_extensions-4.10.0.tar.gz", hash = "sha256:b0abd7c89e8fb96f98db18d86106ff1d90ab692004eb746cf6eda2682f91b3cb"},
    ]

  2. lxml = ">=4.2.0,<5.2.0":

    Initially, there were no restrictions on the version of lxml, so pip would install the latest available version, which is now 5.2.1. However, beginning with version 5.2.0, the lxml.html.clean module transitioned into an independent project named lxml_html_clean, leading to the error encountered when executing newspaper4k immediately post-installation.

    ImportError: lxml.html.clean module is now a separate project lxml_html_clean.
    Install lxml[html_clean] or lxml_html_clean directly.
    

    https://pypi.org/project/lxml/5.2.0/


    LP#1958539: The lxml.html.clean implementation suffered from several (only if used) security issues in the past and was now extracted into a separate library:

    https://github.com/fedora-python/lxml_html_clean
    ...

    Consequently, I have adjusted the dependency description of lxml in pyproject.toml.

    - lxml = ">=4.2.0"
    + lxml = ">=4.2.0,<5.2.0"

How did you test it?

python3.10 -m venv .venv
.venv/bin/pip3.10 install ".[all]"
.venv/bin/python3.10 -c "import newspaper; article=newspaper.article('https://www.ithome.com.tw/news/162774');print(article.text)"

Notes for the reviewer

Checklist

  • I have updated the related issue with new insights and changes
  • I added unit tests and updated the docstrings
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test:.
  • I documented my code
  • I ran pre-commit hooks and fixed any issue

Copy link
Owner

@AndyTheFactory AndyTheFactory left a comment

Choose a reason for hiding this comment

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

thanks, makes sense

@AndyTheFactory AndyTheFactory merged commit c5e4170 into AndyTheFactory:master May 10, 2024
6 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants