Repository navigation
feat: package_check() on_missing levels and once - #193
Merged
Merged
Conversation
Missing packages now return FALSE at every level but "error". optional is deprecated in favour of on_missing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Oct 22, 2026
Merged
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.
package_check()gains two arguments:on_missing = c("error", "warning", "message", "none"): what to do when a package is missing. Every level but"error"returnsFALSE, so callers can fall back:once = FALSE: whenTRUE, the warning or message is shown once per session, throughrlang's.frequency = "once", the same mechanism GiottoDisk already uses for its engine hints. The id is keyed on the package names, so every caller asking about the same package shares it. Errors are always raised.A version shortfall (installed, but below a requested floor) is reported at the same level.
"error"still reports it as a warning, as before, and the call returnsTRUEsince the package is there.Fix:
package_check()returnedTRUEeven when an optional package was missing, soif (package_check(x, optional = TRUE))never skipped its body. GiottoVisuals'show_saved_plotguards inaux_save.R(png/tiff) rely on that and error inpng::readPNG()instead. They now work without changes.Deprecation:
optionalis soft-deprecated.TRUEmaps to"message"andFALSEto"error", and a vector errors if any entry isFALSE, as before. Passing bothoptionalandon_missingerrors. The only callers that pass it are GiottoVisuals' 4optional = TRUEsites and oneoptional = FALSEin Giotto'sspdep.R. Those move over once this is released.Other changes:
rlangadded to Imports. It was already installed through lifecycle.devhas been 0.2.8 since suite_install(): tilework from dev until 1.0.1 is on CRAN #189, so 0.2.8 alone doesn't guarantee them.optionaldocs, which had the error/message behaviour reversed, are replaced.Tests: new cases for each level,
once, version shortfalls and the deprecated alias. The full suite has the same 7 failures asdev(pip:scipyandtest_pyutils.R, which need Python packages not in the local env).🤖 Generated with Claude Code