-
Notifications
You must be signed in to change notification settings - Fork 501
Moving formatting into a delegate #1913
Description
The purpose of this issue is to have a central place to discuss everything related to formatting in 0.24
In the next version of Pint, all formatting operations are going to be moved into a Delegate. As expressed in #1895"
string formatting is becoming more and more complex as users request different (reasonable) means to represent quantities (both magnitude and units). Right now, formatting is intertwined with the registry. Adding more configuration settings increases the registry API surface and makes it harder to maintain and upgrade. The plan is to create a Formatter Delegate. All formatting settings will work directly on the delegate (for a yet unspecified number of versions, we will map this to existing registry functions for backward compatibility.). Also, users will be able to build their own formatter and replace the existing one.
Part of this work has been merged into master, and the rest is being tested in develop.
A few important things:
- Pint version 0.24 will be backwards compatible in relation to formatting.
- Old expected behavior should not change.
- New behavior might be introduced. e.g. Implement sorting units by dimension order #1864
- Clear bugs can be fixed. e.g. format_babel doesn't use comma seperator from babel locale #1849, Format doesn't respect width #1798
- Existing functions/properties have been rewriting to point to the new API (and marked deprecated).
Please add other issues, or PRs
As of 9e0789c
- All test are passing (except doc building).
- Docs are not building. (maybe due to 3)
- The
separate_format_defaultsis not implemented.
Please provide your insights or comments about the API and overall organization.