What’s new#

v1.26.0 (2024-03-27)#

v1.25.0 (2024-03-26)#

Migration notes#

  1. The Quantity class implementation is simplified in this release. The changes should not be noticeable and should require no action for users who do not:

    1. change the default Quantity implementation (AttrSeries)

    2. use both Quantity implementations within the same code including test suites, for instance via the parametrize_quantity_class() test fixture, or

    3. use Quantity for type annotation.

    Users who do either (a) or (b): see set_class() for hints on how to import Quantity safely so that the correct class is instantiated.

    Users who do (c) should generally change Quantity to AnyQuantity in type hints:

    from typing import TYPE_CHECKING
    
    if TYPE_CHECKING:
        from genno.types import AnyQuantity
    
    def my_operator(qty: "AnyQuantity", arg: int) -> "AnyQuantity":
        ...
    
  2. The global variable genno.config.STORE is deprecated. Instead of:

    import genno.config
    
    genno.config.STORE.add("my_config_key")
    

    …register the built-in store() handler for the target configuration key/section:

    from genno.config import handles, store
    
    handles("my_config_key", False, False)(store)
    

All changes#

v1.24.1 (2024-03-14)#

v1.24.0 (2024-02-09)#

v1.23.1 (2024-02-01)#

v1.23.0 (2024-01-26)#

v1.22.0 (2023-12-13)#

v1.21.0 (2023-11-28)#

  • write_report() and concat() are single-dispatch functions for simpler extension in user code (PR #108).

  • New argument to write_report(): kwargs, including “header_comment” to write a header comment at the start of a .csv file (PR #108).

  • Fix many cross-references in the documentation (PR #108).

v1.20.0 (2023-10-28)#

As indicated in the v1.18.0 (2023-08-31) release notes, genno.computations is renamed genno.operator (PR #105). The former module can still be imported and used to access particular operators, but will trigger a FutureWarning.

Migration notes#

Adjust imports of/from genno.computations to genno.operator.

All changes#

v1.19.0 (2023-09-11)#

v1.18.1 (2023-08-31)#

  • Show the caller’s context in DeprecationWarning from Computer methods that were

  • deprecated in PR #98 (PR #101).

  • Bugfix: restore behaviour of genno ≤ 1.17.2 in config.aggregate() (PR #101). Specifically: when there are multiple _quantities: to be aggregated, a failure to match any one key results in the whole item failing and being re-appended to the queue to be retried after other configuration items. Giving _fail: warning (or anything less than “error”) causes the behaviour to be permissive: missing keys are logged but tolerated. This functionality was broken in 1.18.0.

  • Allow for zero positional/only keyword arguments when formatting a DeprecationWarning from Computer.convert_pyam() (PR #101).

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.operator. At this point, imports from genno.computations will continue to function, but will trigger a FutureWarning.

  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 ~genno.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 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)#

v1.5.2 (2021-07-06)#

v1.5.1 (2021-07-01)#

v1.5.0 (2021-06-27)#

v1.4.0 (2021-04-26)#

v1.3.0 (2021-03-22)#

v1.2.1 (2021-03-08)#

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