-
-
Couldn't load subscription status.
- Fork 5.5k
chore: update lxml version #1547
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughChange lxml version constraint in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
pyproject.toml (1)
20-20: Use a compatible version constraint for lxmlPinning to
6.0prevents patch-level bugfix/security updates; loosen the constraint:- "lxml==6.0", + "lxml~=6.0",(lxml 6.x requires Python ≥ 3.8, covering 3.9–3.13)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (1)
pyproject.toml(2 hunks)
🔇 Additional comments (1)
pyproject.toml (1)
48-48: Formatting-only touch on shapely entry looks fineNo semantic change detected; OK to keep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (1)
pyproject.toml(2 hunks)
🔇 Additional comments (1)
pyproject.toml (1)
48-48: LGTM: trailing comma is fineTrailing commas in TOML arrays are valid; no action needed.
| "aiosqlite~=0.20", | ||
| "anyio>=4.0.0", | ||
| "lxml~=5.3", | ||
| "lxml~=6.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Confirm lxml 6.0 compat (Py3.9 and API removals); consider conditional spec if needed
Major-version bumps can break Python 3.9 and remove deprecated APIs. This may silently break users on 3.9 (classifiers list 3.9–3.13).
If lxml 6 drops 3.9 or you use removed APIs, use conditional markers to keep 5.x for older Pythons:
- "lxml~=6.0",
+ "lxml~=6.0; python_version >= '3.10'",
+ "lxml>=5.3,<6; python_version < '3.10'",Run these checks:
Also confirm lxml 6.0 Python support and breaking changes:
🏁 Script executed:
#!/bin/bash
# 1) Find lxml imports
ast-grep --pattern $'from lxml import $$$'
ast-grep --pattern $'import lxml'
# 2) Look for commonly removed/deprecated APIs
rg -nP --type=py -C2 '\b(getchildren|getiterator)\s*\('
# 3) Show declared Python support in this repo (for cross-check)
rg -nP -C2 'requires-python|Programming Language :: Python ::'Length of output: 3071
🌐 Web query:
What Python versions are supported by lxml 6.0, and what breaking changes were introduced in lxml 6.0 release notes?
💡 Result:
Short answer
- Supported Python: lxml 6.0 requires Python 3.8 or newer (binary wheels published for CPython 3.8–3.13 at release). [1][2]
Breaking / potentially breaking changes from the 6.0.0 release notes
- Support for Python < 3.8 removed (upgrade your Python if still on 3.7 or older). [1][2]
- Parsing directly from zlib/lzma-compressed data is no longer guaranteed (treated as optional and may be removed later). Code relying on automatic compressed-input parsing may break. [1]
- New parser option decompress=False (changes default behavior for automatic input decompression once libxml2 ≥ 2.15 is used); code depending on automatic decompression must opt-in. [1]
- Binary wheels use newer libxml2/libxslt versions that disable direct HTTP/FTP URL parsing — code that parsed URLs via libxml2 should switch to Python URL tools. [1]
- Schematron class deprecated (will become non-functional in a future version). [1]
- MemDebug.dump() and MemDebug.show() removed (libxml2 removed those). [1]
Sources
[1] lxml changelog / 6.0.0 (release notes).
[2] lxml PyPI release page for 6.0.0 (wheel interpreter tags and summary).
Update deprecated lxml APIs for 6.0
lxml 6.0 drops getchildren()/getiterator(); replace all el.getchildren() calls (e.g. use list(el) or el.iterchildren()) to prevent runtime errors. No Python version markers needed—lxml 6.0 supports Python 3.9+.
🤖 Prompt for AI Agents
In pyproject.toml around line 20, the project pins lxml~=6.0 which removes
deprecated Element.getchildren()/getiterator() APIs; search the codebase for any
.getchildren() and .getiterator() usages and replace them with supported
equivalents (use list(el) or el.iterchildren() instead of el.getchildren(), and
el.iter() or el.iterchildren() instead of el.getiterator()), update any call
sites that rely on mutation semantics accordingly, run tests/lint to ensure no
regressions.
Summary
Updates lxml dependency to 6.0.
List of files changed and why
To upgrade the lxml constraint and regenerate the lock file, these files were touched:
pyproject.toml
uv.lock
How Has This Been Tested?
Tested parsing markdown of websites locally.
Checklist:
Summary by CodeRabbit