klmr / box

Write reusable, composable and modular R code
https://klmr.me/box/
MIT License
829 stars 47 forks source link

`box::use` with relative paths does not seem to work with Plumber APIs with `entrypoint.R` deployed to RStudio / Posit Connect #329

Closed king-of-poppk closed 8 months ago

king-of-poppk commented 11 months ago

Error description

box::use fails saying path cannot be resolved. Works fine if all box::used paths are absolute in entrypoint.R and "plumbed" endpoints. Relative paths work fine in nested modules, or in "plumbed" endpoints when sourcing entrypoint.R on a development machine.

R version

4.2.2

box version

1.1.2

plumber version

1.2.1
king-of-poppk commented 11 months ago

PS: I witnessed this while migrating from import::from which worked with "relative" paths:

- import::from("config.R", getConfig)
+ box::use(./config[getConfig])
klmr commented 11 months ago

Could you please post a reprex/minimum working example? I can’t reproduce this, but I also don’t quite understand your description.

klmr commented 8 months ago

If the issue persists please feel free to reopen this after posting a reprex.