Skip to content

Add metadata saving support to SVG. #17221

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

Merged
merged 3 commits into from
Jun 10, 2020
Merged

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Apr 23, 2020

PR Summary

Reading RDF specifications is a pain, so this is somewhat reverse-engineered from what Inkscape does, and confirmed that the Matplotlib svg loads metadata in Inkscape.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • [N/A] Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@QuLogic QuLogic force-pushed the svg-metadata branch 2 times, most recently from dba191e to df57609 Compare April 23, 2020 21:07
@QuLogic QuLogic added this to the v3.3.0 milestone Apr 23, 2020
@efiring
Copy link
Member

efiring commented May 8, 2020

Scanning, it looks reasonable, but I know zip about svg. Do we have an svg expert we can call on for a review?

@anntzer
Copy link
Contributor

anntzer commented May 29, 2020

Do you want to add a test-only dependency on something like https://en.wikipedia.org/wiki/RDFLib to check that the metadata is correct? Otherwise it feels a bit hard to actually check that the implementation is correct, as I don't really want to read the RDF/Dublin Core specs either :)

PS: Looks like rdflib (which I just found from a quick goole search) may be one of the few python libs that is both older than matplotlib (it dates back to 2002) and still actively developed :) (I guess the winner there maybe PIL(low), which dates back to 1995, dunno if there's anything else?)

@QuLogic
Copy link
Member Author

QuLogic commented Jun 3, 2020

I tried this, but rdflib won't even read the RDF from Inkscape.

@anntzer
Copy link
Contributor

anntzer commented Jun 7, 2020

Let's perhaps consider another approach to testing to move this forward: if you write xpath queries (https://docs.python.org/3.8/library/xml.etree.elementtree.html#elementtree-xpath) testing that you can retrieve the correct metadata entries, I guess that I could be willing to believe you that the xpath queries themselves correspond to what the specs say.

@tacaswell tacaswell merged commit 5a01c86 into matplotlib:master Jun 10, 2020
@QuLogic QuLogic deleted the svg-metadata branch June 10, 2020 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants