Repository navigation
fix(python): a node's strip_tags and unwrap_tags skipped the node - #132
Merged
Merged
Conversation
maturin's --find-interpreter goes by the names on PATH, and on macOS the free-threaded installer's python3.14 and python3.15 shadow the ordinary ones, so 0.1.0 built 3.14t and 3.15t twice and the GIL builds never; Windows lost the same two. The job still passed. scripts/find-pythons.py now asks each installed CPython what version it is and whether the GIL is off, and maturin is given those paths. After the build, the job fails unless dist/ holds exactly one wheel for each version it should, the abi3t one included.
selectolax counts the node itself among the matches, and css() on a node here does too; strip_tags and unwrap_tags looked only inside it. The wheels and the sdist carried no LICENSE or NOTICE. Copies now sit beside pyproject.toml, named in license-files, and CI checks they match the repository's. PyPI also gets a classifier per Python version. The docs said decompose() refuses the root as selectolax does. It refuses the document node; root, the <html> element, can be decomposed, which selectolax refuses. The docs now say so, and say that line_col() counts UTF-8 bytes when neither positions nor errors is on, and how XPath numbers become strings differently from lxml. HTMLParser and Node have docstrings.
foothillsdigital
approved these changes
Nov 20, 2026
foothillsdigital
left a comment
Collaborator
There was a problem hiding this comment.
Checked d70d894:
strip_tagsandunwrap_tags:matches_ofpassingtruetakes in the scope when it's an element that matches. They still gather every match before changing any, so decomposing the node itself mid-loop can't happen. The new test covers the node matching, the node unwrapped, and the node only a scope.- Licence files:
bindings/python/LICENSEandNOTICEare byte-identical to the root's (cmp),python.ymlnow checks that, andtest_wheel_carries_the_licence_and_noticechecks the built wheel. find-pythons.py: asking each interpreter forversion_infoandPy_GIL_DISABLEDis the right fix for the shadowedpython3.14. A missing version exits 1 with what it found, so a release job fails rather than going out short. The new "Every wheel is there" step also checks eachcpXY-cpXYandcpXYttag and the exact count, withabi3tas one more.- The docstrings and README now say where
decompose,line_coland XPath number formatting differ from selectolax and lxml. - CI: the Python tests pass on 3.9 to 3.15t, free-threaded included, on Linux, macOS and Windows. All 33 checks pass.
One thing CI here can't show: release-python.yml's new interpreter discovery only runs on a tag or by hand. Its workflow_dispatch builds without publishing, so one dispatch on main after this merges would show the macOS and Windows jobs finding all nine interpreters (seven on Windows ARM) before 0.1.1 is tagged. That matters most on Windows, where I'm not sure every free-threaded tool-cache folder has a python.exe rather than only python3.14t.exe. If one doesn't, the script will say so.
Approving.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
--find-interpretergoes by the names onPATH, and the free-threaded installer'spython3.14andpython3.15shadow the ordinary ones, so the free-threaded wheels were built twice and the GIL ones never. Windows lost the same two. The job passed anyway.LICENSEorNOTICE.strip_tagsandunwrap_tagson a node looked only inside it. selectolax counts the node itself among the matches, andcss()on a node here does too.decompose()refuses the root as selectolax does. In fact Parsec refuses only the document node, while selectolax also refusesroot, the<html>element.line_col()counts UTF-8 bytes when neitherpositionsnorerrorsis on, which wasn't said. XPath numbers become strings differently from lxml, also unsaid.HTMLParserandNodehad no docstrings, and the README's list of missing selectolax names was short.Change
scripts/find-pythons.pyasks each CPython that setup-python installed what version it is and whether the GIL is off, and maturin gets those paths on macOS and Windows. Linux keeps the manylinux images' names. A new step fails the job unlessdist/holds exactly one wheel per expected version, plus theabi3tone.LICENSEandNOTICEcopies sit besidepyproject.toml, which names them inlicense-files, and the python lint job checks they match the repository's.pyproject.tomlalso gains a classifier for each Python version and one for CPython.strip_tagsandunwrap_tagsinclude the node when it's an element that matches.decompose()refuses and howline_col()counts. The README says how XPath numbers become strings next to lxml's: Parsec keeps XPath 1.0's rule and doesn't copy libxml2's 15-digit rounding. The missing-names list is complete.Tests
pytest: a node's
strip_tagsandunwrap_tagstake the node when it matches, and only the inside when it doesn't;root.decompose()works and the document node raises; XPath numbers as strings; the installed wheel listsLICENSEandNOTICE. 42 passed, 1 skipped (the free-threaded-only test) on CPython 3.14, built with maturin into a fresh venv.maturin sdistholds both files at the top and inbindings/python.A
workflow_dispatchrun ofrelease-python.ymlon this branch, run 44786280589, succeeded. Its artifacts:cp39tocp315,cp314t,cp315tandcp315-abi3.abi3t.cp311tocp315,cp314t,cp315tandabi3t.On macOS arm64 the step picked
hostedtoolcache/Python/3.14.10/arm64/bin/python3for 3.14 and…/arm64-freethreaded/bin/python3for 3.14t, and the same for 3.15. The Windows wheels carryLICENSEandNOTICEunder.dist-info/licenses/.cargo clippy -- -D warningsandcargo fmt --checkon the binding, andactionlinton both workflows.