Skip to content

MRG: New schema generator #364

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 35 commits into from
Aug 10, 2017
Merged

MRG: New schema generator #364

merged 35 commits into from
Aug 10, 2017

Conversation

jakevdp
Copy link
Collaborator

@jakevdp jakevdp commented Aug 1, 2017

This is a rewrite of the core of the altair library, targeting Vega-Lite 1.2, based on the more complete schema parser at http://github.com/altair-viz/schemapi

The reason for this rewrite is that it will make it easier to transition to Vega-Lite 2.0 and other future Vega-Lite versions.

Still TODO

  • decide on final name for altair_parser package & update references here (now schemapi)
  • fix non-ASCII characters for Python 2.7
  • re-organize utilities used in altair.schema
  • make traitlet shorthand types more meaningful (currently all instances just say "object")
  • check for required traits in ToPython() visitor
  • fix references to deprecated names in docs (e.g. BaseObject, to_altair)
  • use required_traits rather than allow_undefined=False in order to not error on intermediate steps
  • specialize ToCode() generator to configure charts using methods like mark_point().

Summary of Changes

  • The bulk of the code used to generate the Altair API code has been removed from this package, and put in schemapi. Note that everything in altair/schema/_interface is automatically generated by schemapi and its extensions in tools/generate_schema_interface.py

  • User-facing API should be identical to current master. This is confirmed by the fact that all existing tests pass

  • all traitlets objects are now based on the JSONTraitlets extensions provided by schemapi. One big reason for this is that the default value is now undefined, and a value of None will be interpreted as an explicit null in the JSON output.

  • deprecated to_altair() in favor of to_python()

  • put all schema API classes in a single file _interface/schema.py, rather than separating them out into individual files

  • skip changed to _skip_on_export

  • Addition of _required_traits; an error will be raised if these traits are undefined at export.

  • change Travis doc build to use Python 3.x, as there was a unicode error somewhere in sphinx for 2.x (tried debugging for an hour or so, but didn't make any progress)

@jakevdp jakevdp changed the title New schema generator WIP: New schema generator Aug 1, 2017
@jakevdp
Copy link
Collaborator Author

jakevdp commented Aug 7, 2017

Chose to go with schemapi for the jsonschema API generator. The package is renamed; I still need to change references in this PR

@jakevdp jakevdp changed the title WIP: New schema generator MRG: New schema generator Aug 7, 2017
@jakevdp jakevdp requested a review from ellisonbg August 7, 2017 23:14
@jakevdp
Copy link
Collaborator Author

jakevdp commented Aug 7, 2017

OK, this is ready to merge! It's a relatively large change to the code-base, but all previous API tests are passing so I think it's pretty safe. The executive summary of changes is in the description above. @ellisonbg, would you mind taking a look?

@ellisonbg
Copy link
Collaborator

Sure, will have a look!

Copy link
Collaborator

@ellisonbg ellisonbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is very nice. Overall, the changes to the code base are very minimal, which is a good sign. I think we should merge and iterate. What version do you think we should release this as?

@jakevdp
Copy link
Collaborator Author

jakevdp commented Aug 9, 2017

Let's plan to release as 1.3.0, once #370 is merged as well. I think the addition of mimetype rendering support from master warrants a minor release.

Then we can push for a 2.0 release built on vega-lite 2.0

@ellisonbg
Copy link
Collaborator

ellisonbg commented Aug 9, 2017 via email

@jakevdp jakevdp mentioned this pull request Aug 9, 2017
@jakevdp
Copy link
Collaborator Author

jakevdp commented Aug 10, 2017

I'll merge and we can go from there

@jakevdp jakevdp merged commit a951a95 into vega:master Aug 10, 2017
@jakevdp jakevdp deleted the new-schema-generator branch August 10, 2017 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants