Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package dependencies of modules #50

Closed
mschubert opened this issue Mar 1, 2015 · 5 comments
Closed

Package dependencies of modules #50

mschubert opened this issue Mar 1, 2015 · 5 comments

Comments

@mschubert
Copy link
Collaborator

There is two possibilities to use packages/package functions inside a module:

library(mypackage)
#or
mypackage::method()

Disregarding that the latter is preferred to not shadow objects in .GlobalEnv, either call occur somewhere in a given module.

The question is: is there a good way to track package dependencies of modules, without having to look for these calls in each module file?

Ideally, I would like to see something that provides:

  • a way to track required packages in a module (roxygen annotations?)
  • an option in modules to automatically install these packages upon module loading
@klmr
Copy link
Owner

klmr commented Mar 2, 2015

Related: #45 — in the long run, neither library nor :: should be used in modules.

I’m not sure I see the use in annotating required packages, to be honest. In principle we could use Roxygen for this, though. The same goes for dependent modules, of course.

I’m also not a big fan of automatically installing dependencies when loading modules. But the deployment mechanism outlined in #11 would take care of this, don’t you think?

@mschubert
Copy link
Collaborator Author

Ok, let's split this into two parts:

  • keeping track of dependencies in a machine-readable manner
  • automatically satisfying those dependencies

For the first part, it shouldn't matter how external packages and modules are loaded. - Just that they are required in order for the module to function properly, and the module needs to somehow "know" about that.

For the 2nd you are right that satisfying them makes more sense during install time as opposed to runtime (however, if you git clone manually, you won't get this benefit - packages always do this when calling R CMD INSTALL).

Maybe you thought of handling both when writing #11, but there is no explicit mention of whether or how dependencies are to be resolved (within modules or including packages).

@klmr
Copy link
Owner

klmr commented Mar 4, 2015

#11 doesn’t mention these issues yet because I haven’t thought about them in detail. In fact, a packaging system may be a separate project rather than being bundled with modules (these are related, but ultimately distinct concerns).

That said, I definitely see the need for this. I just need to find the time: I want to avoid a Pythonesque FUBAR, where we have umpteen competing package managers.

@klmr
Copy link
Owner

klmr commented Jun 29, 2015

Package loading — #45 — is now implemented. This doesn’t solve tracking package dependencies yet. However, it may actually help in doing so because a package manager could conceivably parse the module code, resolve all calls to import_package and thus auto-generate a list of package dependencies (and the same for import and modules).

@klmr
Copy link
Owner

klmr commented Mar 27, 2021

This issue is now tracked in two parts in #11, #28 and #71.

@klmr klmr closed this as completed Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants