Releases: canonical/operator
1.5.5: Backport "error" status fix to 1.5
2.2.0: Harness.add_network, simplified "import ops"
This is version 2.1.0 of ops, which includes the following changes:
Harness.add_network
In #846 we added Harness.add_network, which allows developers who write charm unit tests to easily add simulated data for the bind address and network information. This is a small but long-requested feature that will avoid charmers patching internal ops methods. Fixes #456.
Simplified way to import ops
In #910 we added a simplified way to import ops
: it pulls most of the names in the various ops.foo
sub-modules into the top-level ops
module so that charmers don’t have to remember which sub-module each class comes from. This also makes the various ops classes more discoverable with an IDE’s autocomplete. Fixes #731.
Other minor changes
There are also a few other minor changes, including the addition of Layer.__eq__
to allow you to compare pebble.Layer
objects with the ==
operator. See the full list of commits in this release.
2.1.1 (fixes install issues with 2.1.0)
This patch release fixes issues with the missing requirements.txt
file during pip install
: #914.
2.1.0
This is version 2.1.0 of ops
, which includes the following changes:
Open-port support
We added Pythonic APIs to interface to the open-port
, close-port
, and opened-ports
hook tools in PR #905. This allows charms to ask Juju to open ports in VM charms and in K8s sidecar charms (with some issues in the latter being fixed in juju/juju#15225). See the Unit.open_port()
API reference.
Other minor changes
- Use f-strings (almost) everywhere (#889)
- Un-vendor websocket library (#891) -- thanks @tinvaan
- A few minor tweaks now that we're on Python 3.8 (#890)
- Define all dependences in requirements files (#894) -- thanks @tinvaan
- Make testing pull() raise pebble.PathError and improve docs (#897)
- Don't call secret-info-get with both ID and label (#900)
- Add ops.lib deprecation notice (#901)
- Add debug logging for custom events (#843) -- thanks @PietroPasotti
- Replace "# type: T" comments with proper variable type annotations (#904)
2.0.0 final
This is version 2.0.0 of ops
, which includes the following changes:
Major changes
- APIs to interact with Juju Secrets, along with a testing harness. Read the tutorial or the code (#861).
- Ops 2.0.0 requires Python 3.8+ (ops 1.5.x works down to Python 3.5). Note that Python 3.8 is the version installed by default on Ubuntu 20.04 (Focal), where Python 3.5 was installed on Ubuntu 16.04 (Xenial). As a result, ops 2.0.0 is intended for use with Juju 3.0+, which only supports Ubuntu 20.04 and above. We started using some Python 3.8 features in #871, and plan to use more in future ops 2.x releases.
- Removed
SIMULATE_CAN_CONNECT
from the testing harness (#871). When we introducedcan_connect
it would have been a breaking change to enable it by default, so we added theSIMULATE_CAN_CONNECT
global to enable it, with a warning that we'd enable it by default in a future release. This release removes the global flag and enables simulation by default. - Made
begin_with_initial_hooks()
trigger pebble-ready in the testing harness (#871). The default value ofcontainer.can_connect()
is still False when usingbegin()
("manual mode"), but this release updatesbegin_with_initial_hooks()
to setcan_connect
to True and fire pebble-ready for all containers in the charm's metadata.
Note that the SIMULATE_CAN_CONNECT
and begin_with_initial_hooks()
changes won't change or break your charms, however, they may break charm tests -- for example, tests that aren't expecting pebble-ready
to be fired when calling begin_with_initial_hooks()
.
Other breaking changes
- Deprecate controller storage: #882. This deprecate
use_juju_for_storage=True
(it's intended for pod-spec charms). - Remove Windows support: #872. Juju 3.0 no longer supports Windows deployments, so ops doesn't need to either.
Minor changes
- Fix logging in can_connect, add tests; remove pebble.Error methods: #860. This fixes a couple of logging calls, but also removes the
name()
andmessage()
methods from theops.pebble.Error
exception subclass. This is theoretically a breaking change, but it is very unlikely these methods were used by charms. - Add ErrorStatus #875. This adds a missing unit status value,
error
. - Add Pebble idempotency behavior #876. This makes the testing harness's emulated versions of
start()
andstop()
match Pebble's current behaviour, which makes them idempotent:start()
now does nothing if the service is already started, and similarlystop()
does nothing if the service is already stopped. - Clarifies the warning message when local storage is chosen: "not a Kubernetes podspec charm" instead of "not a kubernetes charm" (the latter is incorrect). This was done in #882.
- Removes the long-deprecated
key
argument to charm's__init__
. This was done in #882. - Removes the deprecated (and private!)
Harness._oci_resources
attribute. This was done in #882.
2.0.0rc2
This is a release candidate for the next major release of ops (2.0.0, which we plan to release late January). To try it in your charms, please update the ops
line in your requirements.txt
file to say:
ops==2.0.0rc2
For details of the changes since 1.x, see the 2.0.0 final release notes.
1.5.4
This is a patch release with only a few minor changes, including:
- Made harness.charm raise before begin (@PietroPasotti in #838)
- Use Storage.index instead of deprecated Storage.id (@benhoyt in #854)
- Add JujuVersion.has_secrets() (@beliaev-maksim in #855)
- Reinstate reversion of add_relation_unit ValueError to warning (@benhoyt in #856)
See the full list of commits here.
The next release will likely be 2.0.0 with Juju secrets support, and switching from minimum Python version 3.5 to 3.8.
1.5.3
What's Changed
This is a bug-fix/patch release for ops 1.5
advancing the Operator Framework in a number of key areas including:
Typing
Typing is now complete for all ops
modules and static checks for all using pyright
.
- Typing framework.py by @PietroPasotti in #772
- Typed ops.pebble.py by @PietroPasotti in #773
- Typing charm.py by @PietroPasotti in #791
- Fix model types by @PietroPasotti in #810
- Typing main by @PietroPasotti in #811
- Typed
ops/testing.py
by @PietroPasotti in #828
Documentation
Various documentation improvements.
- Update docs for unset param in update_config by @swalladge in #768
- cleaned up logging output by @PietroPasotti in #797
- Fix docstring by @zmraul in #802
- Added further documentation to define_event function in framework.py #830 by @nishant-dash in #831
- Documented and checked ActionEvent.set_results with "Stdout" key by @PietroPasotti in #809
- doc fix for config-changed by @PietroPasotti in #804
Testing
The Harness now tries harder to behave like production code would.
- Make Harness more strict in validating relation data contents (on write) by @PietroPasotti in #786
- Address storage testing quirks by @rwcarlsen in #763
- fixed issues with relation data read by @PietroPasotti in #795
- Remove overzealous Harness.add_storage error check. by @rwcarlsen in #781
- added config backend to simulate more closely juju's own by @PietroPasotti in #787
- Include departing unit info for harness-initiated events by @rwcarlsen in #790
Improved error reporting
- Improved error message for invalid storage key usage by @rwcarlsen in #771
- Better error for relation data access in relation-broken events by @rwcarlsen in #765
- downgrade breaking-change exception to just a warning by @rwcarlsen in #822
Bugfixes
- Fix incorrect kwarg handling in testing backend storage_list by @rwcarlsen in #820
- Allow network-get to return hostnames where previously IPaddr were expected by @PietroPasotti in #823
- Use --file for relation-set; avoid shell argument length limits by @rbarry82 in #805
- Fixed bug in ops.Model where non-string keys could be used to write relation data by @PietroPasotti in #788
Misc
- Added a very basic smoke test. Run it with
tox -e smoke
by @pengale in #800 - require tests to pass on a commit before we publish it to pypi by @rwcarlsen in #815
- Remove harcoded value for self.model_uuid by @Abuelodelanada in #782
- Test observe(decorated-method) by @PietroPasotti in #808
New Contributors
- @swalladge made their first contribution in #768
- @zmraul made their first contribution in #802
- @nishant-dash made their first contribution in #831
Full Changelog: 1.5.2...1.5.3
1.5.2
This is a bug-fix/patch release for ops 1.5 addressing a few important issues including:
- Fix harness model uuid to use the correct/current format used by juju (#782).
- Include the missing departing unit attribute on relation-departed events when using the harness (#790).
- Remove restrictive limits on the number and size of relation data items that can be set (#805).
- Fix type annotations that were causing failures in Ubuntu xenial based environments - i.e. python 3.5 (#810).
Notably, this release was carefully crafted to not break your code. If it does - please complain loudly and we will address problems after completing a good, forceful facepalm.