-
Notifications
You must be signed in to change notification settings - Fork 15
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
New feature idea/request: cross-module, project-contained, functions #240
Comments
I like this as a stepping stone to "build a package!". On the first point... I think it would be reasonable to "just" have an On the second point, we just have to source those functions into a new environment that gets inserted ( |
Uhm.. wait, I think I may have jumped the gun here. |
Mmm. Good point. How about this: The project could "be" an R package (this is what |
Let me see if I get what you meant... |
An package is minimally defined by having a So, |
I like the idea of 'stepping stone' too but I'm not sure if it's quite that straightforward. It's not just the However, an R package can be in a subdirectory of e.g., a git repo and still be installed using the usual tools: remotes::install_github("mfrasca/r-logging/pkg")
devtools::install("thePkg") ## current project's 'thePkg/' directory |
We already have all the infrastructure to convert a module to a package, and I think the issue of whether or not to do it is conceptual. What is a way to make source code useable by multiple modules without knowing how to build and maintain an R package? My gut feeling is using sub-directories will cause more confusion than it is worth. There is the complicated case of "when put in a sub-directoyr, the name of the package is commonly different than the repository". I find this one particularly annoying and frankly quite difficult to work with as a user. I mean we can create: On the other hand, we don't actually have to make any infrastructure to do or not do this. A user can just "do this" without us. But, they kind of have to maintain a package... which was the original motivation for having something different. If "we" do something, it would be something like:
|
Sorry for the late reply.
Another overall comment: One thing that the developer will need to remember is that if the modules are hosted publically and depend on project-level functions, the project will need to be public as well |
At this moment, cross-module functions must either be created in .GlobalEnv or be contained in packages (or else repeated in each module's
R
folder). Although packages is the way to go, it can represent a major barrier to many users -- package development has an additional learning curve to SpaDES. On the other hand, cluttering the .GlobalEnv with functions is not great.So I thought that it would be great/awesome if SpaDES could use/create project-specific functions to be used across modules. An idea of how to implement this would be:
setPath
"(e.g "functionsPath").sim
environmentThe text was updated successfully, but these errors were encountered: