Closed james-garner-canonical closed 1 month ago
The bits of the release notes that aren't in this PR should also be proofread, so I'll post them here.
EDIT: Tony suggested changes below, which have been applied here for the convenience of other reviewers (and me, copy pasting this into the release notes).
The "Release Title" will be "2.17.0: new unit testing API, and Secret fixes".
This release adds a state-transition testing API for unit tests, formerly known as Scenario (many thanks to @PietroPasotti 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
. For example:
from ops import testing
ctx = testing.Context(MyCharm)
state = ctx.run(ctx.on.start(), testing.State(leader=True))
assert state.unit_status == testing.ActiveStatus()
There are also two improvements to Juju Secrets: firstly, the .id
of a Secret
will always include the model UUID, so it can be reliably used for cross-model relations. A more significant change is that, previously, if a charm called set_contents()
and set_info()
in the same hook (even if not the same event handler, or in a deferred event handler) only the last call would have any effect. This is now changed so that the calls accumulate - you can set both content and metadata in the same hook, and also if you set_contents()
twice the contents will be combined. The Juju team intend to make this the secret-set
behaviour in the future as well.
Additionally, ops.main
is now type hinted correctly and will no longer require a type: ignore
directive from users.!
I was intending to just use
2.17.0
as the "Release Title" unless someone has a suggestion for a summary to follow that.
Hmm, we have had "names" except for 2.1.0 and 2.16.0. I think we should be consistent either way. I'm pretty sure that the names don't show up anywhere other than in the GitHub releases page (they don't show in the PyPI release history, for example), although we do use them for the title of the Discourse post as well. I'd be +0 on removing them.
If we keep them then I think you could use "2.17.0: new unit testing API, and Secret fixes" or something like that. The ops[testing]
optional install and Scenario classes in ops.testing
is a pretty big deal.
What's Changed
This release features the ability to install Scenario with
ops[testing]
, improvements in the use of secrets (expanding the ID to the full URI and fixing the inability to callset_info
andset_content
in the same hook), and JujuVersion property for Pebble log forwarding to Loki.
The first two of these are pretty significant, so I would suggest a bigger blurb (but then I worked on them, so if this is just bias, call that out!).
Maybe:
This release adds a state-transition testing API for unit tests, formerly known as Scenario (many thanks to @PietroPasotti 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`. For example:
` ``python
from ops import testing
ctx = testing.Context(MyCharm)
state = ctx.run(ctx.on.start(), testing.State(leader=True))
assert state.unit_status == testing.ActiveStatus()
` ``
There are also two improvements to Juju Secrets: firstly, the `.id` of a `Secret` will always include the model UUID, so it can be reliably used for cross-model relations. A more significant change is that, previously, if a charm called `set_contents()` and `set_info()` in the same hook (even if not the same event handler, or in a deferred event handler) only the last call would have any effect. This is now changed so that the calls accumulate - you can set both content and metadata in the same hook, and also if you `set_contents()` twice the contents will be combined. The Juju team intend to make this the `secret-set` behaviour in the future as well.
Maybe then also the JujuVersion change, but I would probably leave it out from the release notes (it's in the bulleted list) and just call it out in the Discourse post.
Additionally,
ops.main
is now type hinted correctly and will no longer require atype: ignore
directive from users.StatusBase
subclasses will have the correct inferred type now.InvalidStatusError
s will now be raised pre-emptively in some cases that would result in aModelError
after a round-trip to Juju.
I think I would skip this for the release notes (the list of changes is there if they want to see it), but use it for the Discourse post (where the changes are not all listed).
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 published charms with the
main
branch ofops
.
Similarly, I would definitely skip this bit for the release notes but use it in the Discourse post. But for the last phrase, "running the unit tests of all charms publicly listed on CharmHub and source-hosted on GitHub against the main
branch of `ops".
Also add 2.16.1 to CHANGES.md and fix links in 2.16.0 changelog