-
Notifications
You must be signed in to change notification settings - Fork 5
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
Use lxml
instead of standard library xml
to improve namespace identification
#18
Conversation
Note that I did not yet change the version number as part of this PR. I wasn't sure about the policy for that. |
Hi @cgobat, thanks for submitting some of the first PRs for this project! Can you briefly explain why the namespace reading benefit is worth adding a new dependency to the project? Is there a reason you would ever expect the namespace to be anything other than |
Hi! I totally get the desire to keep external dependencies to a minimum. However, The namespace key will (probably) always be I will also add that in my experience, That's my 2¢, but if you are truly averse to adding a dependency (and I do understand the hesitation, generally speaking), maybe we can try to find another way to identify the document namespace. |
Nice. Thank you for writing that up! It sounds reasonable to me and your point about the mapping for the namespace is a good one. On your question about bumping the version, don't worry about it. I actually need to write up documentation for that. Until we actually tag a commit with a release version and build it for PyPI, it doesn't really matter. |
There are some tests that need to be updated to use the new xml library though. I also would like to see a new test (there should have been one already but it looks like I missed it) that verifies that the namespace parsed by lxml is correct for a few different versions of XTCE. |
Note that lxml>=4.8 is needed because that is when support for `Path` objects was added to `parse()`: https://lxml.de/4.8/changes-4.8.0.html
72278fb
to
15336ec
Compare
Changes in this PR:
XtcePacketDefinition._default_namespace
, read the namespace from the XTCE document.lxml
module instead of the built-inxml
, since the latter'sElement
does not have annsmap
attribute.lxml
dependency to the list of requirements.XtcePacketDefinition.__init__
'sxtce_document
argument might be aPath
, we need a version ≥4.8, since that's when support was added forPath
objects.lxml
in tests as well, for consistency.