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

Support more units and ignore case in file-size config options #277

Merged
merged 5 commits into from
Nov 8, 2024

Conversation

jameslamb
Copy link
Owner

@jameslamb jameslamb commented Nov 7, 2024

fixes #274

Some configuration options, like --max-allowed-size-compressed, allow you to change file-size-based thresholds that influence check results.

These are currently evaluated in "bibytes", but are not correctly document. e.g. "1M" = "1 mebibyte" = 1024^2 bytes, but pydistcheck docs say that "1M" = "1 megabyte", which is 1,000,000 bytes.

This PR:

  • fixes those docs
  • adds support for using the clearer form like Mi or Gi
  • adds support for really specifying sizes in other units, like "MB" for megabytes
  • ignores case, so that now these would all evaluate to the same number of bytes: 5KB, 5kB, 5Kb, 5kb

Why have the single-letter aliases like M support e.g. mebibytes instead of megabytes

To avoid breaking any existing pydistcheck uses that have been relying on that behavior.

And because I couldn't find any reference suggesting a preferred way to interpret the unit M.

@jameslamb jameslamb added the enhancement New feature or request label Nov 7, 2024
@jameslamb jameslamb merged commit 3e1f74c into main Nov 8, 2024
22 checks passed
@jameslamb jameslamb deleted the bibytes branch November 8, 2024 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request] accept sizes in Mi, Gi
1 participant