Releases: canonical/operator
ops 2.19.1 and ops-scenario 7.19.1 Synchronise ops and ops-scenario versions
The only change in this release is that ops[testing] is set to install exactly ops-scenario 7.19.1, and ops-scenario requires exactly ops 2.19.1.
There are no ops-scenario releases 7.3 through 7.18. These version numbers were skipped to have ops and ops-scenario in sync for minor and bugfix numbers.
Full Changelog: 2.19.0...2.19.1
ops 2.19.2 and ops-scenario 7.19.2 Synchronise ops and ops-scenario versions
There are no changes since 2.19.1 and 7.19.1 -- the previous release failed CI so didn't reach PyPI, this just bumps the numbers to redo that.
Note that the assets attached to this release are incorrectly from main, rather than the 2.19.1 branch, and should not be used.
Full Changelog: 2.19.1...2.19.2
ops 2.19.0 and ops-scenario 7.2.0 Enhanced Pebble checks, Juju version exposure, and improved documentation
What's Changed
This release of the Operator Framework introduces new features for managing Juju environments, including exposing the Juju version as Model.juju_version and enhanced control over Pebble checks. Several fixes address environment variables and improve the mocking capabilities. Extensive documentation updates provide clearer guidance on various topics, such as setting open ports and using Charmcraft. A special thanks to @medubelko for their first contribution to the project!
Features
- Expose the Juju version via Model objects in #1563
- Support starting and stopping Pebble checks, and the checks enabled field in #1560
Documentation
- Update logo and readme by @tmihoc in #1571
- Fill out remaining external link placeholders in #1564
- Use noun relation and verb integrate in #1574
- Update ref to charmcraft.yaml reference by @medubelko in #1580
- Add a how-to for setting open ports in #1579
- Fix links that pointed to earlier Juju docs in #1575
- Update links to Charmcraft docs in #1582
- Small updates to machine charm tutorial in #1583
CI
- Update list of charms and handle increasing uv usage in #1588
- Handle presence/absence of "static" and "static-charm" envs in #1590
New Contributors
- @medubelko made their first contribution in #1580
Full Changelog: 2.18.1...2.19.0
ops-scenario 7.1.3 Put the mocked Juju environment into os.environ
What's Changed
In ops-scenario 7.1, the mocked Juju environment variables were placed directly in the _JujuContext object, rather than in os.environ as previously. We didn't announce this well, and agree that it's too significant a change to make in a minor release, so have reverted that change.
Fixes
- Expose the mocked Juju environment variables via os.environ again in #1573
Documentation
- Update logo and readme by @tmihoc in #1571
- Fill out remaining external link placeholders in #1564
- Consistently use relation as the noun and integrate as the verb in #1574
Full Changelog: 2.18.1...scenario-7.1.3
ops 2.18.1 and ops-scenario 7.1.2 fixes for deferring and getting the Juju version in tests
What's Changed
Fixes an issue where deferring an event handler could cause another handler of the same event to fail, and one where reading the Juju version in unit tests would incorrectly result in 0.0.0 rather than the version set.
Fixes
- Ensure that the event snapshot is available when one observer defers and another does not in #1562
- Put the Juju version in the environment as well as the JujuContext in #1559
- Maintain transaction integrity on first run in #1558
Documentation
Full Changelog: 2.18.0...2.18.1
ops 2.18.0 and ops-scenario 7.1.0
What's Changed
The Ops documentation has been dramatically revamped, with tutorials and how-to guides moved from Juju documentation to Ops where they belong, among with a myriad of other improvements.
The deferred event queue is now deduplicated, which should make charms feel more responsive.
Unit testing has been made faster by using an in-memory state database and a few other tricks.
Features
- Use :memory: as the unit state storage location for ops.testing in #1494
- Don't store duplicate events in the notice queue in #1372
- Make Context and Manager variadic types in testing by @Batalex in #1445
Fixes
- Remove ops.main.main deprecation warning, and avoid warnings in action output in #1496
- Require the same object to be in the testing state as in the event in #1468
- Raise ModelError on unknown/error status set in Scenario in #1417
Documentation
- Use the right ops-scenario for building the docs in #1470
- Go full Diátaxis, ingesting the relevant juju.is/docs/sdk documentation by @tmihoc in #1481
- Update how-to guides to use the new unit testing framework in #1507
- Clearly deprecate Harness in the testing how-tos in #1508
- Update boilerplate links in #1515
- Fix Markdown syntax in ops.testing readme in #1502
- Fix broken links and use cross references instead of absolute links in #1519
- Use explicit framework param instead of *args in #1523
- Add doc style tips to HACKING.md in #1528
- Fix link to Juju docs in Kubernetes charm tutorial in #1529
- Remove the publish badge from the README in #1505
- Add how-to for storing state in #1534
- Improve info about contributing to docs in #1533
- Fix formatting errors in HACKING.md in #1539
Continuous Integration
- All the ops-scenario publish actions need to be done in testing/ in #1479
- Add support for injecting the latest ops when uv is used in #1477
- Don't cancel other unit tests when one fails in #1471
- Correctly point PyPI publishing to the ops-scenario packages in #1514
- Use Concierge to set up the smoke test environments in #1541
- Bump poetry to 2.0 to match downstream in #1542
- Enable the prometheus-k8s revision updates again in #1544
- Include Juju 2.9 in the smoke tests in #1545
Testing
- Handle warnings generated by our own tests in #1469
- Allow check to fail an additional time when running the test in #1531
- Add a small set of ops.testing benchmark tests in #1504
Refactoring
- Use ops._main._Manager in Scenario in #1491
- Don't use the max-positional-args parent class for JujuLogLine in #1495
- Cache signature structure in ops.testing state classes in #1499
- Use _JujuContext in Scenario in #1459
- Fix the testing src-layout structure and use relative imports in #1431
Chores
- Bump version number for next ops release in #1476
- Update and clarify release process in #1478
- Temporarily disable TIOBE reporting in #1510
- Remove file that seems to be accidentally committed in #1509
- Update charm pins in #1517
- Bump CI dependencies in #1535
- Update documentation dependencies in #1526
- Fix compatibility with ops-scenario 7.0.5 in #1543
- Enable the scheduled TIOBE reporting again in #1537
- Update charm pins in #1540
- Bump actions/attest-build-provenance from 1.4.3 to 2.1.0 in #1518
- Minor linting improvements to testing/src/scenario #1456
- Remove compatibility code with older ops in testing in #1418
- Use annotations from the
__future__in testing in #1433
New Contributor
- Thank you, @Batalex for your first contribution!
- Thank you, Prints Charming (bot) for your contributions, and welcome to the team!
Full Changelog: 2.17.1...2.18.0
2.17.1 Container.push_path() supports non-text files
What's Changed
This release fixes a bug with Container.push_path(). Previously, Container.push_path() required local files to be valid UTF-8 files. Container.push_path() now works on non-text files too.
Fixes
- Make
push_pathopen in binary mode so it works on non-text files (#1458)
Documentation
- Use
MaintenanceStatusfor local issues (#1397) - Explicitly document that
collect-statusis is run on every hook (#1399) - Use our docs URL for the
ogp:urlproperties Sphinx generates (#1411) - Set the
READTHEDOCScontext variable (#1410) - Fix Read the Docs ad placement (#1414)
- Clarify where
StoredStateis stored, and the upgrade behaviour (#1416) - Fix copy 'n' paste error in
stop_servicesdocstring (#1457)
Continuous Integration
- Configure the labels for dependabot PRs (#1407)
- Disable the automatic ops[testing] releasing (#1415)
- Use the actual poetry command, rather than manually tweaking the file (#1443)
- Fix broken GitHub variable expansion (#1446)
- Coverage report generation should also include testing/src/scenario (#1453)
- Fix PR title CI job concurrency (#1451)
- Adjust the release process to handle publishing ops and ops[testing] (#1432)
- A better way than commenting out external repos (#1463)
- Use more descriptive names for the publish workflows (#1464)
- Move the XML coverage report to .report (#1465)
Refactoring
Full Changelog: 2.17.0...2.17.1
2.17.0: new unit testing API, and Secret fixes
What's Changed
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!
Features
- Optionally install Scenario with
ops[testing]and expose the names in ops.testing in #1381 - Change ops.main() so that you don't need to
type: ignoreit in #1345 - Expand the secret ID out to the full URI when only given the ID in #1358
- Add a JujuVersion property for Pebble log forwarding to Loki in #1370
- Pre-emptively raise
InvalidStatusErrorinstead of waiting for Juju:
Fixes
- Fix type of
StatusBasesubclasses by callingStatusBase.registerin__init_subclass__in #1383 Secret.set_infoandSecret.set_contentcan be called in the same hook in #1373
Documentation
- Add top-level intro and module-level intros in #1320
- Update the links to the Pebble docs in #1362
- Note about repeatedly setting secret value in Juju 3.6 in #1366
config-changedis triggered by Juju trust in #1357- Typo on
CharmBaseinheritance example by @theofpa in #1349 - Docs: move Pebble to a separate page in #1392
Continuous Integration
- Periodically run the unit tests of all GitHub-hosted published charms in #1365
- Update the TIOBE reporting for the changes in coverage calculation in #1367
- Spell-check the code as part of linting in #1388
- Run the smoke tests on a schedule in #1387
Testing
- Fix tests that leaked environment variables in #1385
Refactoring
- Move the content of
ops.testingtoops._private.harnessin #1369 - Keep the
unittest.mocknames in the 'mock' namespace in #1379 - Deprecate
StatusBase.registerdecorator in #1384
Chores
- Note Juju version on legacy workaround in #1355
- Re-enable test now that Pebble directory permissions are fixed in #1363
- Generate warnings for events that will be removed in Juju 4.0 in #1374
New Contributors
Full Changelog: 2.16.1...2.17.0
2.16.1 Don't have Harness alter os.environ
This is a small bug-fix release to address a regression in ops 2.16.0 where creating a Harness object would add a JUJU_VERSION to os.environ.
Fixes
- Don't alter os.environ in Harness in #1359
Full Changelog: 2.16.0...2.16.1
2.16.0
This release adds a private _JujuContext dataclass used to parse all `JUJU_*`` environment variables in one place; besides, a significant amount of work has been done on tests, continuous integration and documentation.
Features
- Add the description field to SecretInfo in #1338
Refactor
- Parse JUJU_* env in one place in #1313
Fixes
- Juju passes the expiry in a field 'expiry', not 'expires' in #1317
- Correct the signature of .events() in #1342
Documentation
- Security policy change to only support each active major release in #1297
- Add example Juju version markers in #1311
- Use Sphinx 8 in #1303
- Live reload with sphinx-autobuild in #1323
Tests
- Update the smoke test series/bases in #1318
- Run pytest in parallel with pytest xdist in #1319
- Bump pyright to 1.1.377 in #1332
- Run tests on Py 3.12 and install test on Py 3.13 in #1315
CI
- Add a workflow that runs the TIOBE quality checks in #1301
- Allow executing the TIOBE workflow manually in #1321
- Make Pyright report unnecessary type ignore comments in #1333
- Enable linting of docs/custom_conf.py in #1330
New Contributors
Thanks @james-garner-canonical for your first contributions, and welcome to the team!
Full Changelog: 2.15.0...2.16.0