Latest development release

Version: 2.20
Released: 2024-04-27

2.20 (2024-04-27)

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(), and binary().

  • 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)

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)

2.10 (2020-03-2)

  • Added negligible, tight_units, nan, and inf preferences.

  • Added negligible argument to render.

  • Added infinity_symbol attribute.

  • Changed the return values for Quantity.is_nan() and Quantity.is_infinite().

2.9 (2020-01-28)

2.8 (2020-01-08)

  • Fix nit in installer (

2.7 (2019-12-17)

  • Improve the ability of both Quantity.add() and Quantity.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)

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() and Quantity.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.

2.2 (2017-11-22)

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() and Quantity.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_preferencesset_prefs, get_preferenceget_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.