-
Notifications
You must be signed in to change notification settings - Fork 12
Bump bytesize
from major version 1 to 2
#33
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
Conversation
This upgrades the `bytesize` dependency in `Cargo.toml` from version 1.0.1 (which was usually selecting 1.3.3) to 2.0.1 (which is the latest version). There were some nontrivial API changes from major version 1 to 2. Accordingly, this adapts `Bytes::format_bytes()` to the API change. The old `bytesize::to_string()` function was confusing in its second parameter `si_prefix: bool`, which is why it was removed. But it looks like a value of `false`, as we were passing, actually caused decimal SI units (rather than binary IEC units) to be used. It's not obvious which units `prodash` intended to use `bytesize` to convert to and display in. But this seems to be a minimal change to adapt to the new major version. In spite of the name `si_prefix` for the old parameter, experiments show that setting it to `true` caused values to be converted to and presented in binary IEC units. Although this attempts not to change which actual units are used, it does produce observable differences for some of them, in how they are presented. In particular, a decimal SI kilobyte is least ambiguously abbreviated "kB" (because "k" is an SI unit symbol prefix for "kilo" in its meaning of 1000), but it was previously written as "KB". It is now expected to be writen as "kB". Tests catch this distinction, and are updated here accordingly to assert that the generally preferable "kB" symbol for decimal SI kilobyte is used. See also: GitoxideLabs/gitoxide#1947 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, much appreciated.
I don't think I ever much cared about subtleties in how byte-counts are presented, so let's go with this and remove bytesize
from the dependency tree of gitoxide
.
Can you elaborate? Since all versions of It occurs to me that you may mean that Alternatively, do you mean simply that we should remove the old, major-version-1 of |
Sorry, I meant |
No problem, and thanks for clarifying! |
I'll open a PR in |
I've upgraded |
`gix-features` republishes `bytesize`, which has been bumped from major version 1 to major version 2. Because the interface of `bytesize` is effectively part of that of `gix-features` due to the explicitly republication of the `bytesize` module in full with no caveats, this is effectively a breaking change in `gix-features` as well, though many callers may not be substantially affected. Major changes that may affect some callers that use `bytesize` through `gix-features` include the removal of the top-level `bytesize::to_string()` function, the change in default behavior from displaying decimal SI units to displaying binary IEC units (though all or most gitoxide-related creates, in adapting to the changes, have thus far opted to continue using decimal SI units), and the small but UI-facing change that decimal SI kilobytes (units of 1000 bytes) are given with the symbol "kB" rather than the more ambiguous (and arguably less accurate) symbol "KB". In addition to republishing `bytesize`, `gix-features` also republishes `prodash`. Futhermore, some uses of `bytesize` are transitively through `prodash`, which itself has recently received an update to use `bytesize` major version 2. (Since `prodash` does not republish `bytesize`, that is not considered to be a breaking change in `prodash` itself.) To get the benefits of the newer version of `bytesize` while avoiding new inconsistencies, and also to avoid depending on multiple versions of `bytesize`, the `prodash` dependency version has also been upgraded. For more information, see: - GitoxideLabs#1952 - https://github.com/bytesize-rs/bytesize/releases/tag/bytesize-v2.0.0 - GitoxideLabs#1949 - GitoxideLabs/prodash#33 - GitoxideLabs#1953
`gix-features` republishes `bytesize`, which has been bumped from major version 1 to major version 2. Because the interface of `bytesize` is effectively part of that of `gix-features` due to the explicitly republication of the `bytesize` module in full with no caveats, this is effectively a breaking change in `gix-features` as well, though many callers may not be substantially affected. Major changes that may affect some callers that use `bytesize` through `gix-features` include the removal of the top-level `bytesize::to_string()` function, the change in default behavior from displaying decimal SI units to displaying binary IEC units (though all or most gitoxide-related creates, in adapting to the changes, have thus far opted to continue using decimal SI units), and the small but UI-facing change that decimal SI kilobytes (units of 1000 bytes) are given with the symbol "kB" rather than the more ambiguous (and arguably less accurate) symbol "KB". In addition to republishing `bytesize`, `gix-features` also republishes `prodash`. Futhermore, some uses of `bytesize` are transitively through `prodash`, which itself has recently received an update to use `bytesize` major version 2. (Since `prodash` does not republish `bytesize`, that is not considered to be a breaking change in `prodash` itself.) To get the benefits of the newer version of `bytesize` while avoiding new inconsistencies, and also to avoid depending on multiple versions of `bytesize`, the `prodash` dependency version has also been upgraded. For more information, see: - GitoxideLabs#1952 - https://github.com/bytesize-rs/bytesize/releases/tag/bytesize-v2.0.0 - GitoxideLabs#1949 - GitoxideLabs/prodash#33 - GitoxideLabs#1953
`gix-features` republishes `bytesize`, which has been bumped from major version 1 to major version 2. Because the interface of `bytesize` is effectively part of that of `gix-features` due to the explicit republication of the `bytesize` module in full (with no documented extra limitations related to interface stability), this is effectively a breaking change in `gix-features` as well, though many callers may not be substantially affected. Major changes that may affect some callers that use `bytesize` through `gix-features` include the removal of the top-level `bytesize::to_string()` function, the change in default behavior from displaying decimal SI units to displaying binary IEC units (though all or most gitoxide-related creates, in adapting to the changes, have thus far opted to continue using decimal SI units), and the small but UI-facing change that decimal SI kilobytes (units of 1000 bytes) are given with the symbol "kB" rather than the more ambiguous (and arguably less accurate) symbol "KB". In addition to republishing `bytesize`, `gix-features` also republishes `prodash`. Futhermore, some uses of `bytesize` are transitively through `prodash`, which itself has recently received an update to use `bytesize` major version 2. (Since `prodash` does not republish `bytesize`, that is not considered to be a breaking change in `prodash` itself.) To get the benefits of the newer version of `bytesize` while avoiding new inconsistencies, and also to avoid depending on multiple versions of `bytesize`, the `prodash` dependency version has also been upgraded. For more information, see: - GitoxideLabs#1952 - https://github.com/bytesize-rs/bytesize/releases/tag/bytesize-v2.0.0 - GitoxideLabs#1949 - GitoxideLabs/prodash#33 - GitoxideLabs#1953
This upgrades the
bytesize
dependency inCargo.toml
from version 1.0.1 (which was usually selecting 1.3.3) to 2.0.1 (which is the latest version).There were some nontrivial API changes from major version 1 to 2. Accordingly, this adapts
Bytes::format_bytes()
to the API change.The old
bytesize::to_string()
function was confusing in its second parametersi_prefix: bool
, which is why it was removed. But it looks like a value offalse
, as we were passing, actually caused decimal SI units (rather than binary IEC units) to be used. It's not obvious which unitsprodash
intended to usebytesize
to convert to and display in. But this seems to be a minimal change to adapt to the new major version.In spite of the name
si_prefix
for the old parameter, experiments show that setting it totrue
caused values to be converted to and presented in binary IEC units.Although this attempts not to change which actual units are used, it does produce observable differences for some of them, in how they are presented. In particular, a decimal SI kilobyte is least ambiguously abbreviated "kB" (because "k" is an SI unit symbol prefix for "kilo" in its meaning of 1000), but it was previously written as "KB". It is now expected to be writen as "kB". Tests catch this distinction, and are updated here accordingly to assert that the generally preferable "kB" symbol for decimal SI kilobyte is used.
See also: GitoxideLabs/gitoxide#1947 (comment)
A few ways this might not be ready:
gitoxide
againstprodash
with these changes and observing whatgix clone
on a medium-to-large repository looks like.