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

Full integration with codetoolsBioc #77

Open
federicomarini opened this issue May 8, 2020 · 9 comments
Open

Full integration with codetoolsBioc #77

federicomarini opened this issue May 8, 2020 · 9 comments
Assignees
Labels
Advanced Advanced level Hackathon project

Comments

@federicomarini
Copy link
Contributor

... potentially with codetoolsBioc (https://github.com/Bioconductor/codetoolsBioC) becoming at all effects a part of Bioconductor. As of now, it only lives in Github and is listed in the Enhances for BiocCheck.

Why?
I find particularly useful the integration with BiocCheck when it automatically provides a bunch of meaningful (and in most of the cases working perfectly OOTB) namespace imports.

How?
Some aspects could be updated for codetoolsBioc: roxygen-based manual & handling of dependencies, potential switch to testthat for unit testing, ...

@hpages
Copy link
Contributor

hpages commented May 8, 2020

Let's please be cautious with codetoolsBioc namespace imports. I've really bad memories of seeing many packages with questionable NAMESPACE directives generated by codetoolsBioc automatic namespace generation feature, e.g. super selective imports from the methods package. These NAMESPACE files would almost always create problems in the long run and I had to fix dozens of them. I'd rather not go through this again.

@federicomarini
Copy link
Contributor Author

Agreed, I also recall the strange behavior on methods.
It could probably still be useful for generating the first bulk of such directives - which often needs as you say some manual curation? I'm fine with either answer here 😊

@mtmorgan mtmorgan added Advanced Advanced level Hackathon project Hackathon labels May 8, 2020
@HenrikBengtsson
Copy link

HenrikBengtsson commented May 17, 2020

I find particularly useful the integration with BiocCheck when it automatically provides a bunch of meaningful (and in most of the cases working perfectly OOTB) namespace imports.

FWIW, R CMD check produces WARNINGs with suggestions like:

Consider adding
  importFrom("methods", "is")
to your NAMESPACE file (and ensure that your DESCRIPTION Imports field
contains 'methods').

I'm not 100% sure under what circumstances these are picked up. It might be that it only recommends this for functions in base R packages.

@federicomarini
Copy link
Contributor Author

Yes, the base (+ graphics or so) functions seem like they're the ones that get correctly suggested in that scope.

@federicomarini
Copy link
Contributor Author

Happy to try out the full grooming to Bioc package. @federicomarini

@federicomarini
Copy link
Contributor Author

I did start up with some code last week, for bringing the package to a "modern status".

  • apologies for the not so full descriptions in the commit
  • I was working on my master and not on a separate branch, I hope it is not so dramatic (did not expect any new commits coming in for this package)

The PR will be posted on the https://github.com/Bioconductor/codetoolsBioC repo directly

@hpages
Copy link
Contributor

hpages commented May 21, 2020

Hi Federico, Henrik,

Just to be clear on this, the importFrom("methods", "is") suggestion is unfortunately not a good one. See this recent discussion on the bioc-devel mailing list.

H.

@federicomarini
Copy link
Contributor Author

Thanks @hpages for pointing this out!
I'm far from delving into the gears of codetoolsBioc internals, this really exceeds my current understanding of the whole thing 😛
My proposal in this case was to pimp up the package "to the Bioc level". I understand that this should be done with handfuls of care to have it return the best suggestions. I think mine was more an homage of the many times it turned out to be useful for my own packages ;)

@hpages
Copy link
Contributor

hpages commented May 21, 2020

I understand. One more thing that would need to be addressed in the process of pimping up the package "to the Bioc level" is writeNamespaceImports() use of importMethodsFrom when really importFrom should almost always be used instead. This is because what should really be imported are generic functions, not their particular methods. It still works to use importMethodsFrom but only because it has the side effect of also importing the generics. So it works only by chance and thanks to an obscure feature.

Using importMethodsFrom instead of importFrom occasionally leads to problems, especially when changes happen in "parent packages" (methods tend to move around a lot more than generic functions). I've fixed countless of NAMESPACE files in the past and I still fix some occasionally.

Unfortunately we still have about 350 software packages that still use importMethodsFrom in their NAMESPACE at the moment, and most of them should use importFrom instead. AFAICT situations where importMethodsFrom is actually the right thing to use are very rare.

@lshep lshep removed the Hackathon label Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Advanced Advanced level Hackathon project
Projects
None yet
Development

No branches or pull requests

5 participants