-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
v1.0.0: ImportError: cannot import name 'parse_xml' from 'docx.oxml' #1256
Comments
Hmm, interesting, thanks for taking a look at this and reporting :) Let me have a look here ... Ah, right. So this actually moved to Those are not part of the API per se, so we reserve the right to move those around as needed for the implementation. What is the problem that it causes? btw, |
i guess the problem is we have a lot of legacy code using the old import And yes, your right. The new equivalent is |
same goes for
It's now available as: from docx.oxml.parser import OxmlElement |
k, I think I can "re-export" those from |
Hi, this broke a number of packages indeed as far as I can tell. Broke my CI this morning, as a dependency of https://github.com/elapouya/python-docx-template/blob/master/requirements.txt and https://github.com/4teamwork/docxcompose/blob/master/setup.py, which installed 1.0.0 instead of previously 0.8.11 and broke after that.
Because of the way their requirements are defined, I guess both of these packages are broken by the release. It's unclear to me how or if these are maintained though, and I don't think it's your job to check on each of your users. Just putting this here as info in case it could help. From my side, I'm probably just going to pin to the older release because of my environment (32 bits), which will eventually not be supported anymore and will just bring me back here to look for somebody who had the same issue :) . (Thanks for the work!) |
Okay, I can live with these two being "de facto published API". It doesn't appear to cause me any real problems to republish them in their original location. I'll include these changes in In the meantime, pinning to |
With the latest updates to python-docx, older APIs that are relied upon by htmldocx have broken. This pins the version so htmldocx can utilize the old APIs. For more info on this breakage see [here](python-openxml/python-docx#1256 (comment)).
is the version, install: pip install python-docx==0.8.11 that worked for me |
Multiple downstream "extension" packages expect to find `OxmlElement` and `parse_xml()` at `docx.oxml`. Refactoring in v1.0.0 moved those to `docx.oxml.parser`, but republishing them at `docx.oxml` does not cause any immediate breakage. Republish those two callables at `docx.oxml` for v1.0.1.
Okay, v1.0.1 is live on PyPI and should remedy this. Please confirm that fixes this for you, meantime I'll close this issue :) |
i cant see any code changes on this repo relating to 1.0.1? Also, should these be considered deprecated? Is it advised to change imports? |
The last four commits on master are these, or you can look at tag "v1.0.1". I looked into adding a deprecation warning, but that looked like more trouble that it's worth. In my own code I would import them from where they're defined rather than somewhere they're republished, but I don't see an immediate reason to remove them from |
With the latest updates to python-docx, older APIs that are relied upon by htmldocx have broken. This pins the version so htmldocx can utilize the old APIs. For more info on this breakage see [here](python-openxml/python-docx#1256 (comment)).
With the latest updates to python-docx, older APIs that are relied upon by htmldocx have broken. This pins the version so htmldocx can utilize the old APIs. For more info on this breakage see [here](python-openxml/python-docx#1256 (comment)).
between v0.8.11 and v1.0.0.0 this seems to have been moved to: from docx.oxml.parser import parse_xml
I cant recall seeing any warning about this and cant see any migration notes for the 1.0.0 release.
Maybe this was a mistake?
Would it be possible to add the above to docx.oxml.init to allow backwards compatibility with existing imports?
The text was updated successfully, but these errors were encountered: