-
Notifications
You must be signed in to change notification settings - Fork 473
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
pint 0.18 does not allow to explicitly override "~" modifier in default_format #1407
Comments
I was thinking that this is a bug until I remembered that #1371 introduced the concept of "magnitude" and "unit" formatters (it was used before, but not clearly separated). This means that the format string of I agree that that's surprising, at least given the current documentation, and I don't think I got any feedback regarding this yet (to be fair, it's pretty well hidden in the code and I forgot to raise it in the PR). |
Thanks @keewis for the quick answer! Just one thing: you mention using In order to use the default format one can use Therefore, I agree that it is not a bug, but IMHO it should be listed in the CHANGES file as a "Breaking Change" of 0.18 |
I think Pint 0.18 is the correct one, but I do agree this was a breaking change. I would agree on releasing a 0.18.1 in the next days rolling back this and deploying this change in 0.19 What I am not clear exactly what exactly you will revert in the code? Is not this very intertwined with the new formatting code? Would reversion cause a very ugly code? |
not at all, we'd need to change three lines: Lines 397 to 398 in 3df6536
ustr = format(obj.units, spec) and Line 83 in 3df6536
would become spec = extract_custom_flags(spec or self.default_format) (plus the code to issue a It would probably also be good to add an explanation to the formatting docs (if it's not there already?) |
Sounds good to me, we can issue a new release soon with #1403 too. +1 on the docs. |
Let me know when the PRs are ready and I can make the release |
pint 0.18 introduced a change that breaks some of our unit tests. See: hgrecco/pint#1407 Adapt the tests to work both with pint <=0.18
Hi, I see a change in the behavior from pint 0.17 to 0.18 which I think it might be a bug.
Consider the following code:
With pint <=0.17 I get:
With pint 0.18 I get:
IMHO, the behaviour of 0.17 is the expected one, since the default_format should not affect at all when a explicit format is used.
The text was updated successfully, but these errors were encountered: