ops library 2.17.0 released: new unit testing API, Secret fixes, and more

Hi! Ops version 2.17.0 is just released! It’s now available from PyPI by using pip install ops, which will pick up the latest version. Upgrade by running pip install --upgrade ops.

This release adds a state-transition testing API for unit tests, formerly known as Scenario (many thanks to @ppasotti for his work developing and maintaining the library). Harness is still available, but we encourage all charmers to use the new API for unit tests going forward. The API is an optional install, for example: pip install ops[testing], so that the test API code does not get bundled into the charms. All of the classes that you would previously find when using ops-scenario in the scenario namespace can then be found in ops.testing.

A JujuVersion property for Pebble log forwarding to Loki has been added.

Additionally, ops.main is now type hinted correctly and will no longer require a type: ignore directive from users. StatusBase subclasses will also have the correct inferred type now.

InvalidStatusErrors will now be raised pre-emptively in some cases that would result in a ModelError after a round-trip to Juju.

Among other changes, documentation has seen various improvements including a new top-level intro, while CI improvements include new scheduled smoke and unit tests, running the unit tests of all charms publicly listed on CharmHub and source-hosted on GitHub against the main branch of ops.

Read more in the full release notes on GitHub. Happy charming!

4 Likes