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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export v2: Automatically minify output #1352

Merged
merged 2 commits into from
Dec 28, 2023
Merged

Conversation

victorlin
Copy link
Member

@victorlin victorlin commented Dec 7, 2023

Description of proposed changes

Automatically format the output JSON file based on the number of tips, unless either --minify-json or --no-minify-json (new option) is specified.

Snippet of updated help output:

OPTIONAL SETTINGS:
  --minify-json         export JSONs without indentation or line returns,
                        regardless of how many nodes are in the tree.
                        (default: False)
  --no-minify-json      export JSONs to be human readable, regardless of how
                        many nodes are in the tree. (default: False)

Related issue(s)

Checklist

  • Checks pass
  • If making user-facing changes, add a message in CHANGES.md summarizing the changes in this PR

@victorlin victorlin self-assigned this Dec 7, 2023
Copy link

codecov bot commented Dec 8, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b3dfbec) 66.14% compared to head (ab0f7bf) 66.23%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1352      +/-   ##
==========================================
+ Coverage   66.14%   66.23%   +0.08%     
==========================================
  Files          68       68              
  Lines        7225     7238      +13     
  Branches     1777     1780       +3     
==========================================
+ Hits         4779     4794      +15     
+ Misses       2177     2176       -1     
+ Partials      269      268       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@victorlin victorlin force-pushed the victorlin/export-auto-minify branch from 01e6590 to fb82a79 Compare December 8, 2023 18:58
@victorlin victorlin marked this pull request as ready for review December 8, 2023 19:06
@victorlin victorlin requested a review from a team December 8, 2023 19:06
@victorlin victorlin force-pushed the victorlin/export-auto-minify branch 4 times, most recently from 269dc25 to 0c994d6 Compare December 15, 2023 23:16
augur/export_v2.py Outdated Show resolved Hide resolved
augur/export_v2.py Outdated Show resolved Hide resolved
Copy link
Member

@corneliusroemer corneliusroemer left a comment

Choose a reason for hiding this comment

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

I'm happy with this, where to set the default I don't mind so much, this isn't blocking for me as it can be changed easily.

@victorlin victorlin force-pushed the victorlin/export-auto-minify branch 2 times, most recently from 483ff49 to 332ec39 Compare December 22, 2023 01:13
Copy link
Member

@jameshadfield jameshadfield left a comment

Choose a reason for hiding this comment

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

Looks good by inspection. UTF-8 does not use one byte all the time, it's 1 to 4 bytes, but for this purpose I think using characters and bytes interchangeably is ok.

@victorlin
Copy link
Member Author

victorlin commented Dec 27, 2023

@jameshadfield oh, good point! I'll push a fix to account for that.

EDIT: pushed 50e71a3

Automatically format the output JSON file based on file size, unless
either --minify-json or --no-minify-json (new option) is specified.

Functional tests added to cover all code paths. Code to generate a
Newick file was generated by ChatGPT.¹

¹ <https://chat.openai.com/share/5f54c5fe-ee27-4691-bbb4-f71b63970770>
@victorlin victorlin force-pushed the victorlin/export-auto-minify branch from 50e71a3 to ab0f7bf Compare December 27, 2023 23:49
@victorlin victorlin merged commit fe9605a into master Dec 28, 2023
24 checks passed
@victorlin victorlin deleted the victorlin/export-auto-minify branch December 28, 2023 00:00
augur/utils.py Show resolved Hide resolved
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.

6 participants