Skip to content

Restrict package to load-only access - prevent attempts to attach it

2 messages · Iñaki Ucar, Henrik Bengtsson

#
Hi Henrik,

A bit late, but you can take a look at smbache's {import} package [1]
in case you didn't know it. I believe it does what you are describing.

[1] https://github.com/smbache/import

I?aki

On Tue, 23 Jun 2020 at 22:21, Henrik Bengtsson
<henrik.bengtsson at gmail.com> wrote:

  
    
#
Thanks. Though, AFAIU, that addresses another use case/need.

I want reverse package dependencies to be able to import functions
from my package using standard R namespace mechanisms, e.g. import()
and importFrom().  The only thing I want to prevent is relying on it
being *attached* to the search() path and access functions that way.
So, basically, all usage should be via import(), importFrom()
NAMESPACE statements or pkg::fcn() calls.  All for the purpose of
avoiding the package being used outside of other packages.

I've got a few suggestions offline in addition to the above comments
including allowing the package to be attached but having .onAttach()
wipe the attached environment so it effectively adds zero objects to
the search() path.  This is a non-critical feature for me but
nevertheless an interesting one.

/Henrik
On Fri, Jul 17, 2020 at 1:01 PM I?aki Ucar <iucar at fedoraproject.org> wrote: