Git Product home page Git Product logo

Comments (4)

micha-silver avatar micha-silver commented on June 21, 2024

@oggioniale : I had a look at chapter 12 of Hadley Wickham's book.

  • We should (must) have all R dependency packages listed in the DESCRIPTION file under Imports:. As it is now. This insures that whoever installs ReLTER will also have all the dependencies installed (>200). Installing all dependencies is done, of course, only once when a new user installs ReLTER.

  • On the other hand, the packages listed in NAMESPACE file are actually loaded (attached) every time you load ReLTER. This takes some time and memory. And probably is not necessary for many cases. When we specify a function, i.e. worrms::wm_records_names() with the full package::function() format then the wm_records_names() function is found in the worrms package even if that package is not loaded (attached). And we have been careful from the start to specify all function calls with that full format. So we can remove many (most) of the @import and @importFrom lines from many of the function definitions, and rerun devtools::document() to rewrite the NAMESPACE file. Then all the rarely used packages will not be loaded from the start. This will make startup faster, avoid namespace collisions, and allow the package to use less memory.

@maelle : Any further comments on this??
Thanks

from relter.

maelle avatar maelle commented on June 21, 2024

What's the specific question? In any case yes it is better to not import (in the NAMESPACE) a whole package when you use only a few functions of that package.

from relter.

micha-silver avatar micha-silver commented on June 21, 2024

Here's what I see (not sure if this is the correct way to test...)

direct_deps <- remotes::local_package_deps()
length(direct_deps)
[1] 46
all_deps <- renv::dependencies()
Finding R package dependencies ... Done!
length(all_deps$Package)
[1] 401

So we are declaring @import of 46 packages. And these are pulling along (recursively) another 350. And with all the importFrom() lines in NAMESPACE we are actually attaching all these right from the start. Is this a problem?

from relter.

maelle avatar maelle commented on June 21, 2024

Yes it is a problem, especially as there is a hard CRAN limit on direct Imports in DESCRIPTION (20 if I remember correctly).

from relter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.