The Wayback Machine - https://web.archive.org/web/20211005142402/https://github.com/activeloopai/Hub/issues/1180
Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Beautify meta .json files #1180

Open
1 of 2 tasks
kristinagrig06 opened this issue Sep 13, 2021 · 7 comments
Open
1 of 2 tasks

[FEATURE] Beautify meta .json files #1180

kristinagrig06 opened this issue Sep 13, 2021 · 7 comments

Comments

@kristinagrig06
Copy link
Contributor

@kristinagrig06 kristinagrig06 commented Sep 13, 2021

馃毃馃毃 Feature Request

  • Related to an existing Issue
  • A new implementation (Improvement, Extension)

Is your feature request related to a problem?

All of our json files(currently tensor_meta.json and dataset_meta.json) use json.dumps which means the json output is all on a single line. This can make it harder for a user to read them, especially when we start adding more keys and nested structures to these json files.

If your feature will improve HUB

We need to find a way to (without an external dependency if possible) beautify these json files.

Difficulty: Medium-easy

@tatevikh tatevikh added this to Easy tasks in Hacktoberfest Sep 13, 2021
@tatevikh tatevikh moved this from Easy tasks to Medium tasks in Hacktoberfest Sep 13, 2021
@tatevikh tatevikh moved this from Medium tasks to Easy tasks in Hacktoberfest Sep 13, 2021
@muhdhisham
Copy link
Contributor

@muhdhisham muhdhisham commented Sep 14, 2021

I would like to give this a shot. Can you please tell how to get started with solving this issue.

@mccrearyd
Copy link
Contributor

@mccrearyd mccrearyd commented Sep 16, 2021

@muhdhisham

return bytes(json.dumps(self.__getstate__()), "utf-8")

@mccrearyd
Copy link
Contributor

@mccrearyd mccrearyd commented Sep 16, 2021

the follwing meta files can be beautified:

  • tensor_meta.json
  • dataset_meta.json

after implementing beautify code, it would be nice if you could add a test for this.

this test should be in a new file: Hub/hub/core/meta/tests/test_beautify.py

@SatYu26
Copy link

@SatYu26 SatYu26 commented Sep 29, 2021

I was looking into this and found some good solutions. the one I liked was to use indent in json.dumps.

@mccrearyd
Copy link
Contributor

@mccrearyd mccrearyd commented Sep 30, 2021

@SatYu26 sure, indent=4 and sort_keys=True should do the trick.

@dhiganthrao
Copy link
Member

@dhiganthrao dhiganthrao commented Oct 2, 2021

Hey @SatYu26, thanks for the suggestions! Looking forward to a PR 馃槃

@SatYu26
Copy link

@SatYu26 SatYu26 commented Oct 2, 2021

how should I check if the changes I have made are correct or not? And I have never written tests before if anyone can help me, it would be better.

@jakbin jakbin mentioned this issue Oct 4, 2021
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment