Package: garnish 0.1.0

garnish: Python-Style Decorators for R

Popular Python decorators ported to R with the 'adorn' framework: retrying, caching, context managers and argument validation.

Authors:Dyfan Jones [aut, cre]

garnish_0.1.0.tar.gz
garnish_0.1.0.tar.gz(r-4.6-any)
garnish_0.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION
card.svg |card.png
garnish/json (API)

# Install 'garnish' in R:
install.packages('garnish', repos = c('https://dyfanjones.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/dyfanjones/garnish/issues

Pkgdown/docs site:https://dyfanjones.github.io

On CRAN:

Conda:

3.40 score 1 stars 46 exports 6 dependencies

Last updated from:37c900aa0f. Checks:7 FAIL, 2 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develFAIL83
source / vignettesOK165
linux-releaseFAIL83
macos-releaseFAIL104
macos-oldrelFAIL101
windows-develFAIL42
windows-releaseFAIL48
windows-oldrelFAIL43
wasm-releaseOK104

Exports::=%@%after_sleep_baseafter_sleep_fnafter_sleep_logafter_sleep_noneas_decoratorbefore_sleep_basebefore_sleep_fnbefore_sleep_logbefore_sleep_nonecachecircuit_breakercontextmanagerdisk_cachelru_cacherate_limitretryretry_allretry_baseretry_fnretry_if_errorretry_if_error_messageretry_if_resultretry_neverstop_after_attemptstop_after_delaystop_allstop_anystop_basestop_before_delaystop_fnstop_neverteardownvalidate_argsvalidate_returnwait_basewait_chainwait_combinewait_expwait_exp_jitterwait_fixedwait_fnwait_nonewait_randwith_context

Dependencies:adorncachemfastmaprlangS7withr

Failing fast with a circuit breaker
A service that is down | The three states | What counts as a failure | Handling an open circuit | Using it with retry | Notes

Last update: 2026-10-31
Started: 2026-10-31

Retrying failing calls
A function that fails at first | Deciding when to stop | Deciding how long to wait | Deciding what to retry | Seeing what is happening | Writing your own strategies | Putting it together | Notes

Last update: 2026-10-31
Started: 2026-10-31

Validating arguments and results
What counts as a validator | Messages | Which arguments are checked | Validating the result | Handling failures | Combining with other decorators

Last update: 2026-10-31
Started: 2026-10-31

Caching results
In memory | What counts as the same call | What is and is not cached | Limiting size | On disk | Changing the function | Choosing a file format | When not to cache | Choosing

Last update: 2026-10-31
Started: 2026-10-31

Context managers
The problem with on.exit() | What withr already does | What contextmanager adds | A worked comparison | With withr, by hand | With contextmanager | When not to use it | Behaviour worth knowing | How it works

Last update: 2026-10-31
Started: 2026-10-31

Readme and manuals

Help Manual

Help pageTopics
Write your own stop, wait, retry and hook strategiesafter_sleep_base after_sleep_fn before_sleep_base before_sleep_fn extending_retry retry_base retry_fn stop_base stop_fn wait_base wait_fn
Run a hook after 'retry()' sleepsafter_sleep_log after_sleep_none
Use a context manager as a decoratoras_decorator
Run a hook before 'retry()' sleepsbefore_sleep_log before_sleep_none
Stop calling a function that keeps failingcircuit_breaker
Write setup and teardown oncecontextmanager teardown
Cache function resultscache disk_cache lru_cache
Limit how often a function can be calledrate_limit
Retry a function when it failsretry
Retry conditionsretry_all retry_if_error retry_if_error_message retry_if_result retry_never
Stop conditionsstop_after_attempt stop_after_delay stop_all stop_any stop_before_delay stop_never
Validate arguments and return valuesvalidate_args validate_return
Wait strategieswait_chain wait_combine wait_exp wait_exp_jitter wait_fixed wait_none wait_rand
Run code inside a contextwith_context