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

devtools::release() trashes NAMESPACE #1437

Closed
friendly opened this Issue Jan 9, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@friendly

friendly commented Jan 9, 2017

I have a legacy package developed without using roxygen for the .Rd files. When I tried to use devtools::release() to submit the package, rogygen2 was run, resulting in an empty NAMESPACE file, with no prompt for 'first time use of roxygen2`. This seems to be a bug, but certainly unexpected.
Is there any way to prevent this?

> devtools::release()
Warning: DR_DEVTOOLS FOUND PROBLEMS
* R is out of date (3.2.5 vs 3.3.2)
* RStudio is out of date (0.99.1266 vs 1.0.136)
Proceed anyway?
1: Uhhhh... Maybe?
2: I agree
3: I forget

Selection: 2
Building and checking HistData ===========================================================================================
Updating HistData documentation
Loading HistData
First time using roxygen2. Upgrading automatically...
Updating roxygen version in  C:\R\projects\histdata\pkg/DESCRIPTION 
Writing NAMESPACE
@jimhester

This comment has been minimized.

Member

jimhester commented Jan 9, 2017

The issue is devtools::release() calls devtools::check() with the default argument document = TRUE. You can run the check manually then run devtools::release() without the check.

devtools::check(document = FALSE)
devtools::release(check = FALSE)
@levimcclenny

This comment has been minimized.

levimcclenny commented Jan 9, 2017

I actually had the same issue, when calling devtools::release() my NAMESPACE was overwritten with a blank one, resulting in some random warnings and notes right before submission. Funny part is that I used roxygen2 to create the initial NAMESPACE anyway, so I'm not sure about the comment 'first time use of roxygen2'

I believe this is a bug, but I got my package submitted using devtools::release(check = FALSE) regardless. I just ran an extra check before submitting.

Edit After a little more digging, it turns out that devtools::release() runs roxygen2::oxygenize() (somehow), therefore the NAMESPACE file is overwritten by one from your roxygen2 comments every time release() is run. I elected not to use any roxygen2 formatting in my package and do it the old fashioned way (e.g. writing .rd files by hand), which burned me here. That being said, simply going through and adding the @importFrom and @export to the applicable functions allowed for a proper namespace to be developed and viola, no, issues with NAMESPACE when running release()

That being said, perhaps there is a way to change release() (or an upstream function) to overlook this for those electing to hand-write their .rd and NAMESPACE files.

@hadley

This comment has been minimized.

Member

hadley commented Aug 1, 2017

Maybe release() should only document() if a RoxygenNote is present in the description?

@hadley hadley added feature check release and removed check labels Aug 1, 2017

@hadley hadley closed this in ab5fd77 Aug 2, 2017

@lock

This comment has been minimized.

lock bot commented Sep 17, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Sep 17, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.