bjones1 / CodeChat

The CodeChat Sphinx extension
4 stars 10 forks source link

Future Warning #22

Closed oscarlevin closed 1 month ago

oscarlevin commented 1 month ago

I've started to see this message whenever I build the the PreTeXt-CLI:

/home/oscar/.local/lib/python3.12/site-packages/pretext/codechat.py:94: FutureWarning: This search incorrectly ignores the root element, and will be fixed in a future version.  If you rely on the current behaviour, change it to './/*[@{http://www.w3.org/XML/1998/namespace}id]'
  for elem in src_tree.iterfind(f"//*[@{xml_id_attrib}]"):  # type: ignore

I'd prefer this not show up an worry users. Any suggestions?

bjones1 commented 1 month ago

This refers to:

https://github.com/PreTeXtBook/pretext-cli/blob/39dd5ab403874a112c502dea59ca4acd897808fe/pretext/codechat.py#L93-L94

Per the comment, the goal of this line is to walk through all XML IDs. Decoding the code a bit, the difference is: \ Old: //*[@{http://www.w3.org/XML/1998/namespace}id] \ New: .//*[@{http://www.w3.org/XML/1998/namespace}id]

What does the leading period mean?

oscarlevin commented 1 month ago

Gotcha. I don't know why I read this as coming from codechat and not the codechat.py module of pretext. Thanks for the tip.