klmr / klmr/box

Search for modules after packages has been exhausted

Open
#307 7 comments 0 reactions 1 assignee Claimed by @klmr View on GitHub
✨ new feature
Dominant language
R
Stars
979
Forks
49
PR merge metrics
No merged PRs in 30d

Description

### Please describe your feature request

Lets assume you have set the systems `R_BOX_PATH` environment variable to something like `/opt/box`. It would be convenient to take advantage of the `__init__.r` usage pattern with modules within `/opt/box`.

For example, suppose the following directory structure in `/opt/box`

`foo/__init__.r`

```
#' @export
box::use(./mod1[...], ./mod2[...])
```
`foo/mod1.r`

```
#' @export
bar <- 1L
```

`foo/mod2.r`

```
#' @export
baz <- 2L
```

Then, the expected result may look something like this:

```
box::use(foo)

foo$bar # 1L
foo$baz # 2L
```

Instead, we currently get an error dictating that there is no package named `foo`. Thus back to my point, to there being some convenience if `box` would then start searching the paths.

I am aware that if `R_BOX_PATH` had `/opt` set, then the following usage may work

```
box::use(box/foo)
```
But in my case, there may be other things within `/opt` that I do not want the `box` package to walk over.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.