-
Notifications
You must be signed in to change notification settings - Fork 300
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
Generate JSON instead of YAML #304
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files@@ Coverage Diff @@
## master #304 +/- ##
===========================================
- Coverage 95.87% 44.48% -51.39%
===========================================
Files 10 10
Lines 752 744 -8
===========================================
- Hits 721 331 -390
- Misses 31 413 +382 ☔ View full report in Codecov by Sentry. |
Just keeping my thoughts here @aswaterman regarding the above mentioned points in the PR description
@Timmmm Even though this is machine-generated, YAML’s indentation-based structure makes large, deeply nested data easier to read at a glance than JSON’s curly-brace heavy syntax. It is easier to review and debug faster comparable to JSON structure. For an example, YAML
and JSON,
Absolutely correct, YAML files are a superset of JSON. If a consumer prefers JSON, they can parse the YAML as JSON directly, without needing PyYAML. Here I could say that: Keeping YAML does not limit interoperability—it just offers more flexibility. |
Well, I could debate the "improved" readability of YAML. Would you have guessed from the YAML that But in any case I don't think you can argue that the difference in readability is significant, whereas the benefit of not relying on PyYAML and not requiring consumers to deal with YAML are undeniably large. |
b56d23a
to
0a4d5e7
Compare
I fixed the two grammar mistakes in the README you noticed. |
Previously this generate a `instr_dict.yaml` file, however there is no need to use YAML here. The only advantages of YAML over JSON are that it is (debatably) easier for humans to write, making it suitable as human-edited input files. This is a machine-generated output file so JSON is better. The main advantages are: 1. It removes the dependency on PyYAML, which is the only external dependency of this project. Python external dependencies are quite a pain - PyYAML is a particularly troublesome one - and having no dependencies is very convenient (no need for venv etc.). 2. It means consumers of the file don't need to depend on PyYAML. Note this could have been done in an 100% backwards compatible way by keeping the file name unchanged (since JSON is valid YAML), however I figured there probably aren't that many users of this file, and since the only thing they need to change is the filename it's probably better to minimise confusion by renaming it. It also makes it clear that it is guaranteed to be JSON.
Previously this generate a
instr_dict.yaml
file, however there is no need to use YAML here. The only advantages of YAML over JSON are that it is (debatably) easier for humans to write, making it suitable as human-edited input files. This is a machine-generated output file so JSON is better.The main advantages are:
Note this could have been done in an 100% backwards compatible way by keeping the file name unchanged (since JSON is valid YAML), however I figured there probably aren't that many users of this file, and since the only thing they need to change is the filename it's probably better to minimise confusion by renaming it. It also makes it clear that it is guaranteed to be JSON.