← Back to all sparks
P

pkgload

INFRA · APIS
Velocity0.0

Simulates loading an R package during development without a full install

pkgload is quietly wiring R package development into modern IDE tooling.

rpackage-developmentdevtoolside-integrationload-all
Current state
pkgload implements load_all(), the function that simulates installing and loading a package during development, and sits directly underneath devtools. Recent releases pair correctness work on the reload path with integrations aimed at editors: compile_commands.json generation for LSP servers, and breakpoint injection in Positron.
Where it's heading
Two threads run in parallel. One tightens namespace lifecycle handling — running unload hooks on reload, keeping the old namespace and DLL loaded so dangling references survive, demoting .onUnload() errors to warnings so a broken hook cannot block reloading. The other exports development metadata so external tools can reason about a package's compiled sources.
Prediction
Expect deeper Positron and LSP integration, plus continued hardening of reload semantics as R restricts direct namespace manipulation further.

Recent moves

  1. 1mo ago

    pkgload 1.5.3 runs unload hooks when reloading a package

    load_all() now runs the previous package's unload hooks on reload regardless of how it was loaded, while deliberately keeping the old namespace and DLL alive so existing references do not break. Errors from .onUnload() are demoted to warnings — a pragmatic choice that stops a faulty hook from trapping you mid-development.

    View source ↗
  2. 3mo ago

    pkgload 1.5.2 improves S7 topic handling

    Improved handling of S7 topics. A narrow adjustment for R's newer object system with no broader effect on the load_all() workflow.

    View source ↗
  3. 4mo ago

    pkgload 1.5.0 supports breakpoint injection in Positron

    Adds support for injecting breakpoints in Positron, continuing the pattern of pkgload acting as the bridge between a package under development and the editor around it.

    View source ↗
  4. 10mo ago

    pkgload 1.4.1 adds a debug flag option, hardens compile_commands

    An explicit debug option controls debug compiler flags, and the compile_commands.json generator is hardened for packages compiling extra libraries such as ragg, sources in subdirectories, and existing R_SHARE_DIR settings. Follow-through on the LSP integration introduced in 1.4.0.

    View source ↗
  5. 2y ago

    pkgload 1.4.0 generates compile_commands.json for LSP servers

    Introduces experimental compile_commands.json generation after each load_all(), letting LSP servers like clangd understand a package's C and C++ sources. The reset argument is removed outright because recent R versions no longer permit unlocking a namespace environment — an external constraint forcing an API change.

    View source ↗
  6. 2y ago

    pkgload 1.3.4 exposes a parent temp directory for subprocesses

    Sets PKGLOAD_PARENT_TEMPDIR on load, giving subprocess-based workflows such as devtools::test() and devtools::document() a predictable place to cache results. Small, but it addresses a real coordination problem between parent and child R sessions.

    View source ↗