Releases
Latest development release
Remove % from tight_units list.
Add spacer keyword argument to
Quantity.render()
,Quantity.fixed()
andQuantity.binary()
.
2.20 (2024-04-27)
Include full quantities if available in
IncompatibleUnits
errors
2.19 (2023-01-05)
Added new standard SI scale factors (Q, R, r, q).
Subclasses of
Quantity
with units now convert values to the desired units rather than allowing the units of the class to be overridden by those of the value.Added scale factor conversion.
Added quantity functions:
as_real()
,as_tuple()
,render()
,fixed()
, andbinary()
.Fixed rendering of full precision numbers in
Quantity.fixed()
.Added preferred_units
Quantity
preference.Added “cover” option to strip_radix
Quantity
preference.Added type hints.
2.18 (2022-08-31)
Support parametrized unit conversions (such as molarity).
Allow % to act as a scale factor.
First argument of scaling functions are now guaranteed to be quantities.
Added
UnitConversion.fixture()
decorator function.Added
UnitConversion.activate()
method (allows overridden converters to be re-activated).
2.17 (2022-04-04)
Refine the list of currency symbols.
Allows currency symbols to be given before or after the underlying number.
Allow
Quantity
subclasses to be used in scaling if they have units.
2.16 (2021-12-14)
Add support for — as comment character and make it the default.
2.15 (2021-08-03)
Updated predefined physical constants to CODATA 2018 values.
Switched to more permissive MIT license.
Add feet to the available length/distance unit conversions.
2.14 (2021-06-18)
Allow primary argument of
Quantity.is_close()
andQuantity.add()
to be a string.
2.13 (2020-10-13)
Allow currency symbols in compound units (ex: $/oz or lbs/$).
2.12 (2020-07-25)
Bug fix release.
2.11 (2020-07-19)
Dropping support for all versions of Python older than 3.5.
Added sia form (ASCII only SI scale factors).
Added only_e_notation argument to
Quantity.all_from_conv_fmt()
.Added
Quantity.reset_prefs()
method.
2.10 (2020-03-2)
Added negligible, tight_units, nan, and inf preferences.
Added negligible argument to render.
Added
Quantity.infinity_symbol
attribute.Changed the return values for
Quantity.is_nan()
andQuantity.is_infinite()
.
2.9 (2020-01-28)
Made
Quantity.extract()
more forgiving.Support radix and comma processing when converting strings to
Quantity
.
2.8 (2020-01-08)
Fix nit in installer (setup.py).
2.7 (2019-12-17)
Improve the ability of both
Quantity.add()
andQuantity.scale()
to retain attributes.Added accept_binary preference.
Support all preferences as class attributes.
Allow radix and comma to be replaced by adding radix and comma preferences.
2.6 (2019-09-24)
Now support Quantity arguments with
Quantity.extract()
.Allow plus and minus signs to be replaced with Unicode equivalents.
2.5 (2019-01-16)
Added RKM codes example.
Added check_value = ‘strict’ to
Quantity.add()
.Added backward compatibility for form argument of
Quantity.render()
if it is passed as unnamed argument.Made
Quantity.extract()
a bit more general.Reformulated exceptions.
Added support for binary scale factors and
Quantity.binary()
.
2.4 (2018-09-12)
Fixed bug in format that resulted in several format codes ignoring width
Follow Python convention of right-justifying numbers by default.
Add Quantity.add() (adds a number to a quantity returning a new quantity)
Added # alternate form of string formatting.
Change show_si to form (argument on
Quantity.set_prefs()
andQuantity.render()
(show_si is now obsolete, use form=’si’ instead).Added concept of equivalent units for unit conversion to documentation.
Enhance UnitConversion so that it supports nonlinear conversions.
2.3 (2018-03-11)
Enhanced
Quantity.extract()
non-conforming lines are now ignored
values may be expressions
values need not be quantities
can specify a quantity name distinct from dictionary name
Enhanced the formatting capabilities.
added center alignment
added p format
added show_commas preference.
added strip_zeros, strip_radix to
Quantity.render()
added
Quantity.fixed()
methodadded
Quantity.format()
methodsupport any format specifier supported by Python for floats
2.2 (2017-11-22)
Added
Quantity.scale()
Added
UnitConversion.convert()
Added strip_zeros
Added no-op conversions (units change but value stays the same, ex: $ → USD)
2.1 (2017-07-30)
The primary focus of this release was on improving the documentation, though there are a few small feature enhancements.
Added support for SI standard composite units
Added support for non-breaking space as spacer
Removed constraint in
Quantity.extract()
that names must be identifiers
2.0 (2017-07-15)
This is a ‘coming of age’ release where the emphasis shifts from finding the right interface to providing an interface that is stable over time. This release includes the first formal documentation and a number of new features and refinements to the API.
Created formal documentation
Enhanced label_fmt to accept {V}
Allow quantity to be passed as value to
Quantity
Replaced Quantity.add_to_namespace with
Quantity.extract()
Raise NameError rather than AssertionError for unknown preferences
Added
Quantity.all_from_conv_fmt()
andQuantity.all_from_si_fmt()
Change assign_rec to support more formats
Changed Constant() to
add_constant()
Changed the way preferences are implemented
Changed name of preference methods: set_preferences → set_prefs, get_preference → get_pref
Added
Quantity.prefs()
(preferences context manager)Split label_fmt preference into two: label_fmt and label_fmt_full
Added show_desc preference
Allow show_label to be either ‘a’ or ‘f’ as well True or False
Renamed strip_dp option to strip_radix
Added number_fmt option
1.3 (2017-03-19)
Reworked constants
Added unit systems for physical constants
1.2 (2017-02-24)
Allow digits after decimal point to be optional
Support underscores in numbers
Allow options to be monkey-patched on to Quantity objects
Add strip_dp option
Fix some issues in full precision mode
Ranamed some options, arguments and methods
1.1 (2016-11-27)
Added known_units preference.
Added get_preference class method.
1.0 (2016-11-26)
Initial production release.