PokeAPI / ditto

Tool for meta operations over PokéAPI data
Apache License 2.0
49 stars 11 forks source link

Sort output of data #50

Open phalt opened 2 weeks ago

phalt commented 2 weeks ago

Related to this issue is the fact that ditto produces data but when it pushes it up - the ordering isn't maintained and the diff is very large and hard to read - with most of it just being existing content shuffled around.

Ideally we'd like to provide a --sort option to the ditto tool that orders the output of data somehow.

Naramsim commented 2 weeks ago

Yeah, we should use ordered dicts instead of the standard dicts. Ideally implementing an order logic

phalt commented 2 weeks ago

Hmmm now you mention it, what version of python is it running on? Dicts should be ordered by default since like, 3.6 or something?

Naramsim commented 2 weeks ago

We are on the python installed here:

https://github.com/PokeAPI/api-data/blob/master/updater%2FDockerfile#L4

Which I think might be the latest.

But not 100% sure. I'll check when I have time

Naramsim commented 2 weeks ago

We had this discussion already in the past via email or GH issue, but we couldn't determine why they would get shuffled anyways

phalt commented 2 weeks ago

It should definitely be beyond the version we need.

I do remember the discussion, and reviewing a few of the diffs today made me realise it is still a pain point.

I opened the issue with a bit of hope that someone in the community could pick it up.

Naramsim commented 1 week ago

Sometimes the data gets scrambled even if there's no modification to it. This isn't the best also for caching purposes.


We could also look into tools that diff JSON files, such as https://github.com/josephburnett/jd