feat: adds Resource.hash
in datapackage.json
#665
Merged
+141
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related
Description
This PR adds a hash for each dataset, piggybacking directly from the GitHub trees API.
More info
vega-datasets/scripts/build_datapackage.py
Lines 520 to 547 in 062ee8a
Mostly just upstreaming existing code from https://github.com/vega/altair/blob/fdffed0a15be3967c6b9513787fd40feb59c9cdc/tools/datasets/github.py#L145-L159 with some tweaks.
I think this is a broadly useful inclusion to
datapackage.json
, since we have 74 datasets that have very few revisions.I've been using this in vega/altair#3631 for caching datasets across versions - and found that as of vega-datasets@v2.11.0 there have only been 115 unique hash values.
Moving this logic here will greatly simplify (vega/altair#3631), as the hash is the last bit of metadata I'm currently not able to get from
datapackage.json
.I've been planning out some revisions to get that PR over the line, this will let me remove most of (https://github.com/vega/altair/tree/fdffed0a15be3967c6b9513787fd40feb59c9cdc/tools/datasets) since I no longer need to collect any metadata from multiple endpoints