What’s new#

v1.18.0 (2023-08-31)#

This release adjusts the documentation by using language more carefully and precisely in line with dask (#34):

  • A computation is any entry in the Computer.graph: even a simple alias, or a list of other keys with no specific operation to be performed.

  • A task is a specific kind of computation: a tuple that consists of a callable first item (usually a function) and other items—including keys and literal values—that are arguments to that callable.

  • An operator is a function or callable that is used as the first item in a task. The new Operator class is named to align with this meaning.

To complete this shift, in future releases of genno:

  1. The module genno.computations will be renamed to genno.operators. At this point, imports from genno.computations will continue to function, but will trigger a DeprecationWarning.

  2. genno.computations will be removed entirely. This will happen no sooner than 6 months after (1), and with at least 1 minor version in between.

Migration notes#

Code that uses the deprecated Computer convenience methods can be adjusted to use the corresponding add_tasks() helpers—which give equivalent behaviour—via Computer.add(). See the documentation of the deprecated methods and/or warnings at runtime for examples and hints.

For Plot.make_task() similarly change, for instance, c.add("plot", DemoPlot.make_task("x:t", "y:t")) to c.add("plot", DemoPlot, "x:t", "y:t").

All changes#

v1.17.2 (2023-07-11)#

v1.17.1 (2023-05-30)#

  • Adjust for changed exception types in Pint 0.22 (PR #90).

v1.17.0 (2023-05-15)#

v1.16.1 (2023-05-13)#

  • Bug fix: select() raised KeyError if the indexers contained values not appearing in the coords of the Quantity (PR #85). This occurred with pandas 2.x, but not with earlier versions. The documentation now states explicitly that extraneous values are silently ignored.

  • All computations are type hinted for the benefit of downstream code (PR #85).

  • Implement AttrSeries.shape (PR #85).

  • Bug fix: Computer.add() now correctly handles positional-only keyword arguments to computations that specify these (PR #85).

v1.16.0 (2023-04-29)#

  • genno supports and is tested on Python 3.11 (PR #83).

  • Update dependencies (PR #83):

    • General: importlib_resources (the independent backport of importlib.resources) is added for Python 3.9 and earlier.

    • genno[sparse]: new set of optional dependencies, including sparse. Install this set in order to use SparseDataArray for Quantity.

      Note that sparse depends on numba, and thus llvmlite, and both of these package can lag new Python versions by several months. For example, as of this release, they do not yet support Python 3.11, and thus sparse and genno.SparseDataArray can only be used with Python 3.10 and earlier.

    • genno[tests]: ixmp is removed; jupyter and nbclient are added. Testing utilities in genno.testing.jupyter are duplicated from ixmp.testing.jupyter.

  • Adjust AttrSeries.interp() for compatibility with pandas 2.0.0 (released 2023-04-03) (PR #81).

v1.15.0 (2023-04-02)#

v1.14.1 (2022-10-28)#

v1.14.0 (2022-09-27)#

  • Add new computations assign_units() and convert_units(). These have simpler behaviour than apply_units() and should be preferred in most situations (PR #72).

  • Following pandas (v1.4.0, released 2022-01-22) and xarray (v0.21.0, released 2022-01-27), support for Python 3.7 is dropped (PR #72). genno supports and is tested on Python 3.8 and newer.

v1.13.0 (2022-08-17)#

  • 1-dimensional quantities are handled in relabel() and as weights in sum() (PR #68).

  • load_file() will read a header comment like # Units: kg / s and apply the indicated units to the resulting quantity (PR #68).

  • div() and mul() become the canonical names, matching operator and other parts of the Python standard library (PR #68). ratio() and product() are retained as aliases, for compatibility.

  • Ensure data passed to Plot.generate() has a “value” column; use short units format by default (PR #68).

v1.12.0 (2022-07-18)#

  • New computation index_to() (PR #65).

  • general: configuration items are more flexible (PR #65).

    • comp: null or omitted allows to specify a simple collection of other computations.

    • A bare string key: is left as-is; only keys with (a) dimension(s) and/or tag are parsed to Key.

  • repr() of Quantity displays its units (PR #65).

  • Bug fix: Computer.convert_pyam() handles its tag argument correctly, generating keys like foo:x-y-z:iamc or bar::iamc when applied to existing keys like foo:x-y-z or bar (PR #65). Previously the generated keys would be e.g. bar:iamc, which incorrectly treats “iamc” as a (sole) dimension rather than a tag.

  • Computer.require_compat() can handle arbitrary module names as strings, as well as module objects (PR #63).

v1.11.0 (2022-04-20)#

Migration notes#

The index keyword argument to Computer.add_single() / add() is deprecated (PR #60) and will be removed in or after v3.0.0. Indexing behaviour changes slightly: Computer.full_key() always returns the Key which matches its arguments and has the greatest number of dimensions. For instance:

c.add_product("foo", "bar:a-b-c", "baz:x-y-z", sums=True)

…will generate a key <foo:a-b-c-x-y-z> and all partial sums over subsets of its dimensions; c.full_key("foo") will return this key.

Care should be taken to avoid adding 2+ keys with the same name, tag, and number of dimensions:

c.add("foo:a-b-c", ...)
c.add("foo:l-m-n", ...)
c.add("foo:x-y-z", ...)

This situation is ambiguous and the behaviour of Computer.full_key() is undefined. Instead, add a tag to disambiguate.

All changes#

v1.10.0 (2022-03-31)#

v1.9.2 (2022-03-03)#

v1.9.1 (2022-01-27)#

Note that installing genno[pyam] (including via genno[compat]) currently forces the installation of an old version of pint; version 0.17 or earlier. Users wishing to use genno.compat.pyam should first install genno[pyam], then pip install --upgrade pint to restore a recent version of pint (0.18 or newer) that is usable with genno.

v1.9.0 (2021-11-23)#

v1.8.1 (2021-07-27)#

Bug fixes#

v1.8.0 (2021-07-27)#

v1.7.0 (2021-07-22)#

v1.6.0 (2021-07-07)#

  • Add Key.permute_dims() (PR #47).

  • Improve performance of Computer.check_keys() (PR #47).

v1.5.2 (2021-07-06)#

  • Bug fix: order-insensitive Key.dims broke get() in some circumstances (PR #46).

v1.5.1 (2021-07-01)#

v1.5.0 (2021-06-27)#

  • Adjust test_assign_coords() for xarray 0.18.2 (PR #43).

  • Make Key.dims order-insensitive so that Key("foo", "ab") == Key("foo", "ba") (PR #42); make corresponding changes to Computer (PR #44).

  • Fix “AttributeError: ‘COO’ object has no attribute ‘item’” on SparseDataArray.item() (PR #41).

v1.4.0 (2021-04-26)#

v1.3.0 (2021-03-22)#

  • Bump minimum version of sparse from 0.10 to 0.12 and adjust to changes in this version (PR #39)

    • Remove SparseDataArray.equals(), obviated by improvements in sparse.

  • Improve AttrSeries (PR #39)

v1.2.1 (2021-03-08)#

  • Bug fix: Provide abstract Quantity.to_series method for type checking in packages that depend on genno.

v1.2.0 (2021-03-08)#

v1.1.1 (2021-02-22)#

v1.1.0 (2021-02-16)#

v1.0.0 (2021-02-13)#

v0.4.0 and earlier#

v0.4.0 (2021-02-07)#

v0.3.0 (2021-02-05)#

v0.2.0 (2021-01-18)#

v0.1.0 (2021-01-10)#