docs: for apt, clarify that add_package doesn't raise PackageNotFoundError#124
Merged
james-garner-canonical merged 3 commits intocanonical:mainfrom Aug 21, 2025
Merged
Conversation
add_package doesn't raise PackageNotFoundErroradd_package doesn't raise PackageNotFoundError
james-garner-canonical
approved these changes
Aug 21, 2025
Collaborator
james-garner-canonical
left a comment
There was a problem hiding this comment.
Look good, thanks.
james-garner-canonical
added a commit
to james-garner-canonical/charmlibs
that referenced
this pull request
Aug 21, 2025
Squashed commit of the following: commit 5bc9d7b Author: Dave Wilding <david.wilding@canonical.com> Date: Fri Aug 22 05:35:38 2025 +0800 docs: for apt, clarify that `add_package` doesn't raise `PackageNotFoundError` (canonical#124) This PR updates the relevant docs to clarify when PackageNotFoundError is raised. commit 2687180 Author: James Garner <james.garner@canonical.com> Date: Thu Aug 21 19:24:57 2025 +1200 ci: lower apt version so we can trigger the 1.0.0 release by bumping it (canonical#122) commit b098c19 Author: James Garner <james.garner@canonical.com> Date: Thu Aug 21 17:24:54 2025 +1200 ci: skip tests and publication if no packages have had version bumps (canonical#121) This PR updates the `publish.yaml` workflow to gracefully skip the `tests` and `build-n-publish` jobs if there are no packages for publication. commit a52fce6 Author: James Garner <james.garner@canonical.com> Date: Thu Aug 21 17:18:23 2025 +1200 ci: bugfix for publish script, avoid trailing blank line in diff (canonical#120) commit 7e2d5ff Author: James Garner <james.garner@canonical.com> Date: Thu Aug 21 17:08:54 2025 +1200 ci: release on version change (canonical#118) This PR changes our publication workflow from running on the push event of specific tags (one per library), to running on every push to main. The unify-publish-inputs.py script has been modified to: 1. Get a list of the packages that changed in this event 2. Narrow that list to just those that have a different version now (new packages are included as having a different version -- the first merge to main will be a release, so they should start with a 0.X + .devY / .aY version unless they really are ready for a true release) The publish job is then run with just those packages (using the matrix strategy). Narrowing the publish job to only run on packages with a changed version is mostly an efficiency and UX thing -- running the publish job with a package whose version is identical to a released version will fail for that package, but there shouldn't be any other bad effects. This release strategy has the following benefits: - We don't need to worry about permissions to use github releases or push tags to main - Adding a new library won't require editing the publish job to add its tag - CODEOWNERS for a library control its releases via their approval and merge - We don't need to worry about limitations of the push tag event, like how it won't trigger at all if more than 3 tags are pushed at once commit 490e50f Author: Jonas Jelten <jj@sft.lol> Date: Wed Aug 20 23:30:28 2025 +0200 apt: fix dependency name (canonical#119) commit ef039f0 Author: James Garner <james.garner@canonical.com> Date: Mon Aug 18 18:11:40 2025 +1200 ci: substrate specific integration tests (canonical#117) This PR adds support for substrate specific integration tests by way of two new pytest markers, k8s_only and machine_only. Integration tests are collected with -m not k8s_only for integration-machine, and vice versa for integration-k8s. Integration test jobs are skipped in CI if there are no tests collected, however it is an error to have a tests/integration directory and have no tests collected for any substrate. Additionally, the pack.sh script has been moved up one level to tests/integration, and if it does not exist, the separate packing step is skipped. commit db22045 Author: James Garner <james.garner@canonical.com> Date: Mon Aug 18 17:42:43 2025 +1200 ci: install package specified dependencies for test suites (canonical#116) This PR expands the justfile to install dependency groups for the lint, unit, functional, and integration test suites. lint installs all four dependency groups, while for tests, the dependency group matching the test name is installed. commit 5f8bfaf Author: James Garner <james.garner@canonical.com> Date: Mon Aug 18 12:24:20 2025 +1200 ci: unify pebble and ubuntu test suites as functional (canonical#115) This PR combines the non-Juju integration tests (`integration/pebble` and `integration/ubuntu`) into the `functional` test suite (alongside `unit` and `integration`). Juju integration tests are moved from `integration/juju` to `integration`. To facilitate the different needs of different packages, the `functional` test suite can be customised in CI -- the package can specify the matrix of `pebble` versions to use (or not use it at all), the matrix of Ubuntu versions to run on, and whether or not the tests need to be run with `sudo`. The default is to use `ubuntu-latest` without `sudo`, and not to install `pebble`. commit 98f7ac9 Author: James Garner <james.garner@canonical.com> Date: Fri Aug 15 22:41:46 2025 +1200 docs: update conf.py, add sitemap and last modified (canonical#114) This PR updates .docs/conf.py to clean things up and add the sitemap and last modified features from the latest docs starter pack. commit 74e1aa9 Author: Tony Meyer <tony.meyer@canonical.com> Date: Fri Aug 15 11:03:02 2025 +1200 feat: add charms.proxylib (canonical#113) Add charms.proxylib to the non-interface list of charm libraries. commit 355b133 Author: James Garner <james.garner@canonical.com> Date: Thu Aug 14 19:19:55 2025 +1200 docs: drop new Python dunder attributes from the docs (canonical#112) This PR excludes recently added Python dunder attributes from the docs. commit e69c223 Author: James Garner <james.garner@canonical.com> Date: Thu Aug 14 17:08:56 2025 +1200 feat: add charmlibs.interfaces package and update CI accordingly (canonical#110) This PR adds the charmlibs.interfaces package and updates CI accordingly -- for packages under interfaces/, changes will now be correctly detected, and docs will be generated. commit 96df199 Author: James Garner <james.garner@canonical.com> Date: Thu Aug 14 10:13:27 2025 +1200 feat: add apt library (canonical#108) This PR adds the `apt` library from the `operator-libs-linux` charm ([code](https://github.com/canonical/operator-libs-linux/blob/main/lib/charms/operator_libs_linux/v0/apt.py), [unit tests](https://github.com/canonical/operator-libs-linux/blob/main/tests/unit/test_apt.py), [integration tests](https://github.com/canonical/operator-libs-linux/blob/main/tests/integration/test_apt.py)) to the `charmlibs` monorepo. The code itself is unmodified, though it has been `ruff`ed, and the documentation has been updated to pass spellchecking (e.g. using `` :class:`Foo` `` links, etc.). The tests also required reformatting, and the unit tests in particular required slightly different mocking -- we use `patch.object` now. I took this opportunity to switch the test assertions to `pytest` style. More significantly for this repository, an additional type of integration test has been added: `integration/ubuntu`. These tests perform no special setup (i.e. don't need to install Juju, pebble, etc.), but are run with `sudo` in CI (an expectation of the `operator-libs-linux` integration tests, `apt` in particular). `.docs/conf.py` has been updated to find code for any lib in the monorepo, without needing to add it to the file by name. However, spellchecking needs some love in a separate PR (perhaps migrating to the new spellchecker will help?) -- it would be nice if libs could define their own `.custom_wordlist.txt` for domain specific terms, and it would be nice to avoid encoding the library names in `spellingcheck.yaml`. commit d8ee56f Author: James Garner <james.garner@canonical.com> Date: Wed Aug 13 12:12:00 2025 +1200 docs: update conf.py for documentation.ubuntu.com (canonical#109) Plus stray references to charmtech-charmlibs, and the readme while we're here. commit cc83c68 Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 18:04:03 2025 +1200 ci: handle push context in ci (canonical#107) commit 6650fbc Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 17:53:50 2025 +1200 ci: drop debugging in publish (canonical#106) commit aa56ff8 Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 17:47:51 2025 +1200 ci: avoid quoting github output values in unify-inputs script (canonical#105) commit cf327e4 Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 17:32:08 2025 +1200 ci: avoid double quotes in github context (canonical#104) commit 089b602 Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 17:28:20 2025 +1200 ci: use fromJSON to pass boolean (canonical#103) commit 2184ff2 Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 17:18:38 2025 +1200 ci: treat skip-juju as boolean in publish (canonical#102) commit 8b720e3 Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 17:11:38 2025 +1200 ci: extra debugging for skip-juju (canonical#101) commit 371be92 Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 17:04:47 2025 +1200 ci: pass skip-juju correctly (canonical#100) commit 2d8c5b8 Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 17:00:34 2025 +1200 ci: desparately try to debug failure to run tests in publish (canonical#99) commit 065f90c Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 16:48:40 2025 +1200 ci: fix unify-inputs script, add debugging (canonical#98) * ci: fix unify-inputs script, add debugging * ci: fix debugging in tests.yaml * ci: drop possibly incorrect comments commit 36dbbb5 Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 16:32:03 2025 +1200 ci: checkout action when unifying publishing inputs (canonical#97) commit 74ebbde Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 16:28:15 2025 +1200 ci: install uv (canonical#96) commit 9b20a3c Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 16:23:33 2025 +1200 ci: use workflow_dispatch instead of workflow_call (oops) (canonical#95) This PR corrects a small mistake made in the previous PR. commit b50c7ac Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 16:20:20 2025 +1200 ci: actually unify publishing in a single workflow (canonical#94) This PR unifies all publishing into just one workflow, since reusable workflows don't play well with trusted publishing commit 49a5c1a Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 13:41:55 2025 +1200 ci: make publishing verbose (canonical#93) commit f398653 Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 13:29:43 2025 +1200 ci: wire up the skip-juju option correctly through publish.yaml (canonical#92) This PR is a quick amendment to the last PR to wire up the option correctly through test-publish -> publish -> tests. commit 3d21da6 Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 13:21:18 2025 +1200 ci: add an option to skip Juju integration tests on test publish (canonical#91) This PR adds an input to the tests.yaml workflow to skip Juju integration tests. This is passed through from the test-publish.yaml job to allow faster test publishing. I've also made tests.yaml dispatchable too. commit ce89124 Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 12:48:03 2025 +1200 chore: bump pathops version for post-release (canonical#90) Bump the charmlibs.pathops version to make a post-release that updates the readme. commit 1a53659 Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 12:38:58 2025 +1200 docs: add a local sphinx extension to generate charmlibs reference docs (canonical#89) This PR adds a local sphinx extension to generate the charmlibs reference TOC and automodule pages, so that contributed packages don't need to touch the .docs directory. commit 8ce62ae Author: James Garner <james.garner@canonical.com> Date: Fri Aug 8 10:14:19 2025 +1200 ci: only run tests for a package's supported Python versions (canonical#87) It seems essential that we allow individual charmlibs to set their own `requires-python`. Currently, CI hardcodes the Python versions that unit tests etc are run against. This PR adds a Python script that contains this hardcoded set of Python versions and returns only the versions that match the individual package's `requires-python` constraints. commit fce7d66 Author: James Garner <james.garner@canonical.com> Date: Thu Aug 7 16:33:39 2025 +1200 chore: _charmlibs and _docs -> .charmlibs and .docs (canonical#88) commit deebdf3 Author: James Garner <james.garner@canonical.com> Date: Thu Aug 7 15:40:19 2025 +1200 ci: rename static recipe to lint and run both lint and static there (canonical#84) * ci: rename static recipe to lint and run both lint and static there * ci: also update publishing jobs * ci: use the name fast-lint instead of check commit d5e9d6c Author: James Garner <james.garner@canonical.com> Date: Thu Aug 7 15:27:29 2025 +1200 ci: unify publication and test publication logic (canonical#86) * ci: put the logic for publication in a single workflow * ci: also unify the test publishing commit 1b97f50 Author: Dave Wilding <david.wilding@canonical.com> Date: Wed Aug 6 14:24:09 2025 +0800 docs: update links to Ops and Charmcraft docs (canonical#85) * update all links to Ops docs * update all links to Charmcraft docs * remove trailing slash for consistency commit fe20b9b Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jul 11 10:37:13 2025 +1200 chore(deps): bump astral-sh/setup-uv from 5 to 6 (canonical#83) Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 5 to 6. - [Release notes](https://github.com/astral-sh/setup-uv/releases) - [Commits](astral-sh/setup-uv@v5...v6) --- updated-dependencies: - dependency-name: astral-sh/setup-uv dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 5120be6 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jul 11 10:35:41 2025 +1200 chore(deps): bump actions/attest-build-provenance from 2.3.0 to 2.4.0 (canonical#82) Bumps [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance) from 2.3.0 to 2.4.0. - [Release notes](https://github.com/actions/attest-build-provenance/releases) - [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md) - [Commits](actions/attest-build-provenance@v2.3.0...v2.4.0) --- updated-dependencies: - dependency-name: actions/attest-build-provenance dependency-version: 2.4.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 3bea865 Author: James Garner <james.garner@canonical.com> Date: Fri Jul 11 10:33:48 2025 +1200 docs: add remaining interface libraries to listing (canonical#80) This PR adds the other known interface libraries to the library listing docs. The libraries were found using the methodology described in PR canonical#73 (where only a small number of the known libraries were added initially to simplify review). With the future organisation and review of interface libraries unclear, the status column has only been used to mark deprecated libraries (no recommended libraries yet). commit d8aab00 Author: James Garner <james.garner@canonical.com> Date: Tue Jul 1 19:36:53 2025 +1200 docs: add remaining general libraries to listing (canonical#79) This PR adds the other known general libraries to the library listing docs. The libraries were found using the methodology described in canonical#73, where only a small number of the known libraries were added to simplify review. The emojis for the statuses are updated based on discussion, as are status tooltips and library sorting. Key tables for the emojis now only include the emojis used on that page. Libraries with the `'unlisted'` status are filtered out of the table. Charmcraft-hosted libs are prefixed with their charm name, and linebreaks are controlled with injected html. A small number of words are added to the custom wordlist. commit df060dd Author: James Garner <james.garner@canonical.com> Date: Mon Jun 30 17:55:37 2025 +1200 docs: add charm libraries explanation page to complement listing pages (canonical#78) This PR adds an explanation page to complement the two library listing reference pages. It explains the different types of charm libraries and how they differ. commit 254fd5d Author: Dave Wilding <david.wilding@canonical.com> Date: Fri Jun 27 09:59:14 2025 +0800 docs: change title of how-to category (canonical#77) commit 8c5443e Author: James Garner <james.garner@canonical.com> Date: Fri Jun 27 13:56:34 2025 +1200 docs: library listing pages and infra (canonical#73) This PR adds pages to the charmlibs docs to list charm libraries. The libraries and their metadata are recorded in `csv` files. This PR currently contains a limited subset of libraries from the following sources (subsequent PRs will add all the relevant libraries from them): 1. running [charm-analysis/tools/summarise_deps.py](https://github.com/tonyandrewmeyer/charm-analysis/blob/main/tools/summarise_dependencies.py) 2. searching for 'charm' on PyPI (all results were manually filtered to charming related libs only, and then further filtered to libraries intended to be used in charms, rather than for testing, managing deployments, etc) 3. the [charmcraft docs](https://canonical-charmcraft.readthedocs-hosted.com/stable/reference/files/libname-py-file/#popular-libraries) 4. running [charm-analysis/tools/summarise_libs.py](https://github.com/tonyandrewmeyer/charm-analysis/blob/main/tools/summarise_libs.py) This PR adds a local `sphinx` extension, `generate`, which consumes these `csv` files and produces `rst` files with the information in table form. This includes writing some raw html to faciliate sorting cells logically, wrapping links in a class that disables spellchecking, and adding tooltips to the icons used to indicate status (which requires some custom CSS to show). This PR also adds the `sphinx_datatables` extension, which provides searching and sorting for the generated table. To support the development and maintenance of this local sphinx extension, some unit tests have also been added for it, and the docs CI has been extended to run unit and static tests for the extensions directory. The repo's linting config has also been updated with more selective ignores so that extensions are covered by linting as well. commit 9898726 Author: James Garner <james.garner@canonical.com> Date: Wed Jun 18 15:00:09 2025 +1200 docs: enable spellchecking in CI (canonical#74) This PR enables the docs spellchecking step in CI, updating the custom wordlist accordingly. commit eaa7a9f Author: James Garner <james.garner@canonical.com> Date: Wed Jun 18 14:29:25 2025 +1200 docs: simplify docs makefile and use just for docs (canonical#75) This PR refactors the docs CI to use uv to run the sphinx commands, and use the same command to build the docs in readthedocs as is used locally. I've also taken the opportunity to move the commands to a justfile for cleaner syntax and the ability to run the docs build commands from anywhere in the repository. They're all in a separate module, docs.just, keeping things clean and separate. This allows the default docs build (html, used in readthedocs) to be run with just docs, while other commands can be run with (e.g.) just docs linkcheck. The main _docs/Makefile targets are preserved for compatibility with the Canonical docs workflows, and to allow contributors who are used to this format to easily find and run the docs commands. These targets run just, making the docs.just file the single source of truth in all cases. commit a504e94 Author: James Garner <james.garner@canonical.com> Date: Thu Jun 5 13:16:51 2025 +1200 tests: add some pebble tests for user/group behaviour on file creation (canonical#72) * tests: add some pebble tests for user/group behaviour on file creation * tests: use getpass.getuser instead of os.getlogin to run correctly in CI commit d0b1700 Author: James Garner <james.garner@canonical.com> Date: Thu Jun 5 12:29:13 2025 +1200 tests: fix branching logic in test_file_creation_methods_call_chown (canonical#71) Branching logic tested for the wrong names, and didn't check for exhaustivity. commit a8de8d5 Author: James Garner <james.garner@canonical.com> Date: Thu Jun 5 10:35:09 2025 +1200 docs: align recommendations with latest from sprint (canonical#61) This PR aligns the recommendations in the Python packaging how-to with the recommendations from the sprint that relation libs should be charmcraft libs by default, and that charmcraft pack shouldn't be wrapped when packing a charm for publication. commit 44fd4b7 Author: James Garner <james.garner@canonical.com> Date: Thu Jun 5 10:33:02 2025 +1200 ci: correct test for an empty array (canonical#70) commit 8b7ff07 Author: James Garner <james.garner@canonical.com> Date: Thu Jun 5 10:22:43 2025 +1200 ci: skip the tests step cleanly if no packages are collected (canonical#69) commit 9a85f17 Author: James Garner <james.garner@canonical.com> Date: Thu Jun 5 10:13:53 2025 +1200 ci: correctly make git_base_ref an optional argument (canonical#68) commit 57f6f2b Author: James Garner <james.garner@canonical.com> Date: Thu Jun 5 10:05:34 2025 +1200 ci: refactor ci to facilitate dispatching (canonical#54) commit 00a4be7 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed Jun 4 09:43:27 2025 +1200 chore(deps): bump DavidAnson/markdownlint-cli2-action from 16 to 20 (canonical#67) Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 16 to 20. - [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases) - [Commits](DavidAnson/markdownlint-cli2-action@v16...v20) --- updated-dependencies: - dependency-name: DavidAnson/markdownlint-cli2-action dependency-version: '20' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 6606790 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed Jun 4 09:43:14 2025 +1200 chore(deps): bump actions/attest-build-provenance from 2.2.3 to 2.3.0 (canonical#66) Bumps [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance) from 2.2.3 to 2.3.0. - [Release notes](https://github.com/actions/attest-build-provenance/releases) - [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md) - [Commits](actions/attest-build-provenance@v2.2.3...v2.3.0) --- updated-dependencies: - dependency-name: actions/attest-build-provenance dependency-version: 2.3.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 9499c74 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed Jun 4 09:43:00 2025 +1200 chore(deps): bump astral-sh/setup-uv from 5 to 6 (canonical#65) Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 5 to 6. - [Release notes](https://github.com/astral-sh/setup-uv/releases) - [Commits](astral-sh/setup-uv@v5...v6) --- updated-dependencies: - dependency-name: astral-sh/setup-uv dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 821a9d6 Author: James Garner <james.garner@canonical.com> Date: Tue Jun 3 17:11:23 2025 +1200 docs: expand the charmlibs package readme (canonical#60) commit f107457 Author: James Garner <james.garner@canonical.com> Date: Tue Jun 3 12:07:10 2025 +1200 chore: allow pathops to run with ops 3 (canonical#64) This PR broadens the dependency range of `ops` for `pathops`, to allow `pathops` to be used with `ops` 3. As long as `pathops` itself supports Python 3.8, it should be compatible with `ops` 2. There are no planned changes in `ops` 3 that would break compatibility with `pathops`. commit 0b3e5d7 Author: James Garner <james.garner@canonical.com> Date: Tue Jun 3 11:15:51 2025 +1200 ci: configure dependabot (canonical#63) commit 811a8e9 Author: James Garner <james.garner@canonical.com> Date: Fri May 30 15:29:10 2025 +1200 docs: correct unlink docstring (canonical#62) * docs: correct unlink docstring The first line was erroneously copied from the rmdir docstring * chore: bump version for patch release commit 6c02e97 Author: James Garner <james.garner@canonical.com> Date: Fri May 30 12:09:58 2025 +1200 docs: move .readthedocs.yaml to _docs/ directory (canonical#59) Following canonical/operator#1762, move `.readthedocs.yaml` to the `_docs/` directory. commit d114470 Author: James Garner <james.garner@canonical.com> Date: Wed Apr 30 10:03:09 2025 +1200 ci: multi-base packing (canonical#56) This PR adds the option to specify the base when packing. Currently the 20.04 and 24.04 bases are supported and exercised in CI. The charm + pathops code is therefore now exercised on both bases in the integration tests run in CI. Most significantly this means that pathops is tested with multiple Python versions in integration tests (3.8 and 3.12). commit 518bb6b Author: James Garner <james.garner@canonical.com> Date: Fri Apr 25 12:52:55 2025 +1200 chore: bump version and development status for 1.0 stable release (canonical#57) commit f1a72cb Author: James Garner <james.garner@canonical.com> Date: Fri Apr 25 12:47:52 2025 +1200 docs(pathops): extended readme (canonical#55) * docs: add getting started directions and examples to pathops readme This will show up both in the git repository and on PyPI. * docs: correct typo in docs landing page * docs: softwrap content on landing page and improve wording * docs: update readme * docs: readability improvements Co-authored-by: Dave Wilding <tech@dpw.me> * docs: note that examples are available in readme --------- Co-authored-by: Dave Wilding <tech@dpw.me> commit 1df1b6a Author: James Garner <james.garner@canonical.com> Date: Thu Apr 24 11:14:42 2025 +1200 chore: bump version and development status for beta release (canonical#53) * chore: bump development status to beta * chore: drop alpha pre-release qualifier from version commit 443020b Author: James Garner <james.garner@canonical.com> Date: Thu Apr 24 10:58:02 2025 +1200 feat: add ContainerPath rmdir, unlink and is_symlink methods (canonical#52) This PR adds the ContainerPath.rmdir, ContainerPath.unlink, and ContainerPath.is_symlink methods. commit 0a9ffbe Author: James Garner <james.garner@canonical.com> Date: Wed Apr 16 12:45:07 2025 +1200 docs: use juju 3.6 for intersphinx since latest is now private (canonical#51) commit 612390e Author: James Garner <james.garner@canonical.com> Date: Wed Apr 16 09:40:48 2025 +1200 fix: consistent behaviour for mkdir chown args when exists (canonical#48) This PR makes the behaviour of the `user` and `group` args to the file creation methods consistent. - If the file already exists, `ContainerPath.write_{bytes,text}` will no longer modify the `user` or `group` if they're not supplied explicitly, just like how we recently updated these methods to not change the `mode` if it's not supplied explicitly in canonical#47 - If the directory already exists, `LocalPath.mkdir` will no longer modify the `user` or `group`, even if they're passed explicitly, matching the current `ContainerPath.mkdir` behaviour, and matching the behaviour of `mode` for `mkdir`. This PR also adds Juju integration tests to cover the `user` and `group` behaviour when the target file or directory already exists, and updates the unit tests to work with the new behaviour. commit c8df604 Author: James Garner <james.garner@canonical.com> Date: Tue Apr 15 17:53:43 2025 +1200 fix: write methods no longer change existing mode unless it's passed explicitly (canonical#47) The current behaviour of both `ContainerPath` and `LocalPath` for `write_{bytes,text}` is to always set the mode -- even setting the default mode if none is provided. I think overriding any existing file permissions with the default when none is provided is a mistake, as (e.g.) `pathlib.Path.write_bytes(data)` doesn't change any existing file permissions. This PR modifies these methods so that the permissions are only changed if the `mode` argument is not `None`. Tests have been expanded to cover the case of writing when the target file already exists, and updated to reflect this new behaviour. Resolves canonical#46 commit 00aea1c Author: James Garner <james.garner@canonical.com> Date: Tue Apr 15 11:43:18 2025 +1200 fix: Fileinfo.{user,group} are typed optional but should always be present (canonical#43) The idea that these values might be None in the FileInfo originates from the FileInfo.Sys call in Pebble's code. However, it looks like this won't ever actually fail on the Linux implementation of this interface, so we don't need to pass this on to our users here. commit 3686ff8 Author: James Garner <james.garner@canonical.com> Date: Tue Apr 15 11:36:35 2025 +1200 feat: LocalPath also sets group (if not specified) based on user (canonical#38) This PR aligns the behaviour of the file creation methods (mkdir, write_bytes, write_text) when the user argument is provided but the group argument is not. In this case, Pebble sets the group based on the user (like chown $user: $path), while shutil.chown by default does not (like chown $user $path). Since changing the Pebble behaviour to match shutil here would require additional API calls (and possibly creating the directory twice?), and since the user and group arguments for the file creation methods are an API design that follows Pebble rather than pathlib, LocalPath is updated to follow Pebble's behaviour here. This PR updates the unit tests to reflect this change, and adds a collection of integration tests for file ownership. Documentation of the error case when group is provided without user for ContainerPath has also been added. Resolves canonical#39 commit 1bbdf1d Author: James Garner <james.garner@canonical.com> Date: Mon Apr 14 17:41:31 2025 +1200 tests: validate that Pebble and LocalPath.mkdir behaviour aligns (canonical#45) Add tests to validate that Pebble and LocalPath.mkdir behaviour aligns. commit 3e2643e Author: James Garner <james.garner@canonical.com> Date: Mon Apr 14 08:14:50 2025 +1200 docs: remove bad whitespace (canonical#44) commit 9b41edb Author: James Garner <james.garner@canonical.com> Date: Fri Apr 11 16:10:21 2025 +1200 docs: better examples and ordering for ContainerPath constructor (canonical#42) commit e7679c1 Author: James Garner <james.garner@canonical.com> Date: Fri Apr 11 16:03:51 2025 +1200 docs: correct the description of the default permissions for directories (canonical#41) commit 410b5ca Author: James Garner <james.garner@canonical.com> Date: Fri Apr 11 14:00:51 2025 +1200 docs: add Python packages how-to (canonical#36) This PR adds a how-to guide for distributing charm libraries as Python packages. commit aaf1d1f Author: James Garner <james.garner@canonical.com> Date: Mon Apr 7 14:55:46 2025 +1200 fix: strip whitespace from runtime version string (canonical#34) * fix: strip whitespace from version * chore: bump version for publication commit b2811b1 Author: James Garner <james.garner@canonical.com> Date: Mon Apr 7 14:47:21 2025 +1200 ci: fix workflow filenames and correct name in yaml (canonical#33) commit b6be436 Author: James Garner <james.garner@canonical.com> Date: Mon Apr 7 14:38:51 2025 +1200 ci: correct the names of the pathops publishing workflows (canonical#32) commit 71044fe Author: James Garner <james.garner@canonical.com> Date: Mon Apr 7 14:35:53 2025 +1200 chore: revert charmlibs license specification format (canonical#31) * chore: switch back to the license specification format that works * chore: bump version for publication commit 0dec12e Author: James Garner <james.garner@canonical.com> Date: Mon Apr 7 14:34:18 2025 +1200 ci: add workflows for publishing pathops (canonical#30) These are essentially identical to the workflows for the charmlibs package. Also bump the version for publication. commit 532f865 Author: James Garner <james.garner@canonical.com> Date: Mon Apr 7 13:58:04 2025 +1200 chore: switch to non-deprecated format for specifying package license (canonical#29) commit dc2bf0f Author: James Garner <james.garner@canonical.com> Date: Mon Apr 7 13:51:17 2025 +1200 ci: add missing checkout step to charmlibs publish workflows (canonical#28) commit b017794 Author: James Garner <james.garner@canonical.com> Date: Mon Apr 7 13:41:14 2025 +1200 feat: add charmlibs package and publication actions (canonical#27) This PR adds the charmlibs package to this repository. This is supposed to be a minimal package that just claims the name on PyPI. It shouldn't be installed, so it emits a warning at import time. This PR also adds the workflows to publish the package to PyPI and test PyPI. Due to the monorepo structure, PyPI publication is triggered by tags being pushed, while publication to test PyPI is triggered manually. commit 519aac1 Author: James Garner <james.garner@canonical.com> Date: Mon Apr 7 12:03:42 2025 +1200 chore: update urls to point to new repository name (canonical#26) * chore: update urls to point to new repository name * docs: remove more pathops references from top-level commit dfc54f9 Author: Tony Meyer <tony.meyer@gmail.com> Date: Mon Apr 7 11:05:33 2025 +1200 docs: Add a security policy (canonical#14) * docs: Add a security policy. * chore: exclude 0.X releases from security update promise --------- Co-authored-by: James Garner <james.garner@canonical.com> commit be194e4 Author: James Garner <james.garner@canonical.com> Date: Mon Apr 7 10:50:03 2025 +1200 docs: cleanup docs etc (canonical#25) commit 60199c6 Author: James Garner <james.garner@canonical.com> Date: Mon Apr 7 10:00:26 2025 +1200 tests: add Juju integrations tests (canonical#16) This PR adds simple Juju integration tests for pathops. To test with the in-development version of pathops, the pack.sh script copies the pathops library into the charm before packing. This PR updates the justfile to have separate pack-k8s, pack-vm, juju-k8s and juju-vm recipes. These pack the kubernetes or machine charm respectively, and execute the integration tests for the respective substrate. commit 8b357cc Author: James Garner <james.garner@canonical.com> Date: Thu Apr 3 17:18:24 2025 +1300 fix: make ensure_contents accept PathProtocol typed paths (canonical#21) * fix: make ensure_contents accept PathProtocol typed paths * docs: drop recommendation for what turned out to be an anti-pattern commit 0b3f548 Author: James Garner <james.garner@canonical.com> Date: Thu Apr 3 16:53:45 2025 +1300 feat: support Python 3.10+ newline argument of pathlib.Path.write_text (canonical#19) commit ae85ca9 Author: James Garner <james.garner@canonical.com> Date: Thu Apr 3 16:35:42 2025 +1300 ci: correctly detect packages if changes aren't global (canonical#20) The packages script in CI previously incorrectly checked if the entire change was a directory, rather than the base of the change being a directory. commit e883aa9 Author: James Garner <james.garner@canonical.com> Date: Wed Apr 2 15:04:46 2025 +1300 ci: update task runners and workflows to handle the monorepo structure dynamically (canonical#13) This PR replaces the current `tox.ini`, which is hardcoded to run the tests for the `pathops` package, with a `justfile` that can be parametrized by package name. The `justfile` provides two public variables, `python` for setting the Python version, and `package` for specifying which package to run tests for. The monorepo's top-level `pyproject.toml` is updated to specify the development dependencies, allowing `uv run` to install these for linting and tests. To install the package itself for testing and static analysis, an optional dependency group is specified for each package, instructing `uv` to install the package from the local files. The github `tests` workflow is updated to invoke `just` instead of `tox`, passing the appropriate arguments. It also features a new job which checks which packages have changes, and which test suites they have, so that only tests for the changed packages are run in PRs. If global files like the `justfile` or `pyproject.toml` are changed, then tests are run for all packages regardless of other changes. Where simple commands are not possible in `tests.yaml` and the `justfile`, scripts are used, in-line bash scripts in the `justfile`, and a separate Python script in `.github` for `tests.yaml`. commit 5572bb9 Author: James Garner <james.garner@canonical.com> Date: Fri Mar 28 16:18:18 2025 +1300 chore: restructure repository as a monorepo (#8) Move pathops to a subdirectory and update repo and package config to support a monorepo structure. commit 29e2c45 Author: James Garner <james.garner@canonical.com> Date: Fri Mar 28 09:48:22 2025 +1300 docs: add docstrings and tweak docs config (#7) Add docstrings to public methods and classes and generate reference documentation. Make some docs configuration changes to support this. Minor runtime/test changes reflecting error cases/etc discovered during documentation. commit 759d35f Author: James Garner <james.garner@canonical.com> Date: Thu Mar 20 16:29:25 2025 +1300 docs: add docs config (#6) Add scaffolding from docs starterpack + some minor changes. commit 15d2fe2 Author: James Garner <james.garner@canonical.com> Date: Thu Mar 20 14:46:33 2025 +1300 feat: implementation and tests (#1) Initial implementation of LocalPath, ContainerPath, PathProtocol, ensure_contents, and tests. commit 6ab074f Author: James Garner <james.garner@canonical.com> Date: Mon Mar 10 10:46:04 2025 +1300 ci: add github workflow to run tests (#2) commit 7d141de Author: James Garner <james.garner@canonical.com> Date: Tue Mar 4 17:51:49 2025 +1300 Initial commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When testing the apt library, I noticed that
add_packagedoesn't raisePackageNotFoundErrorif any packages aren't found. Instead, the function raisesPackageError. That's becauseadd_packagerelies on a function_addto add each package, and_addcatchesPackageNotFoundErrorand returns a boolean instead.This PR updates the relevant docs to clarify when
PackageNotFoundErroris raised.Preview docs