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

Rely on roxygen2 more #1849

Merged
merged 3 commits into from Aug 19, 2018
Merged

Rely on roxygen2 more #1849

merged 3 commits into from Aug 19, 2018

Conversation

hadley
Copy link
Member

@hadley hadley commented Aug 17, 2018

Much of the previous code is no longer necessary as roxygen2 handles it internally. Once we can move roxygen2 back into imports, we can add a version dependency there and then delete the old code.

Much of the previous code is no longer necessary as roxygen2 handles it internally. Once we can move roxygen2 back into imports, we can add a version dependency there and then delete the old code.
@hadley hadley requested a review from jimhester Aug 17, 2018
@jimhester
Copy link
Member

@jimhester jimhester commented Aug 17, 2018

Couldn't we just depend on roxygen 6.1.0 now that it is on CRAN, even with it still in Suggests? We already depend on roxygen 5.0.0 there. IIRC check_suggested() (called above) will throw an error for older versions if a version dependency is in the DESCRIPTION.

@hadley
Copy link
Member Author

@hadley hadley commented Aug 17, 2018

My memory is that the version requirements of suggested packages aren't enforced, but I might be wrong.

@gaborcsardi
Copy link
Contributor

@gaborcsardi gaborcsardi commented Aug 17, 2018

My memory is that the version requirements of suggested packages aren't enforced, but I might be wrong.

WRE has:

Version requirements can be specified but should be checked by the code which uses the package.

Kind of makes sense for a suggested package.

@jimhester
Copy link
Member

@jimhester jimhester commented Aug 17, 2018

Right, but we do check this explicitly with pkgload::check_suggested() earlier in this function, although you get a warning rather than an error. (I artificially bumped the version in the DESCRIPTION as a test).

> check_suggested("roxygen2")
Warning in check_dep_version(package, version) :
  Need roxygen2 >= 7.0.0 but loaded version is 6.1.0

R/document.r Outdated
if (packageVersion("roxygen2") < "6.1.0") {
load_all(pkg$path, helpers = FALSE)
}
if (packageVersion("roxygen2") < "6.1.0") {
Copy link
Member

@jimhester jimhester Aug 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this conditional, the only way you could be in this block is by being less than "6.1.0"

Copy link
Member Author

@hadley hadley Aug 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh

@hadley
Copy link
Member Author

@hadley hadley commented Aug 17, 2018

Hmm, looks like it should be an error? I'm in favour of just bumping if you're ok with it.

@jimhester
Copy link
Member

@jimhester jimhester commented Aug 17, 2018

Yeah just bumping sounds good to me.

@hadley
Copy link
Member Author

@hadley hadley commented Aug 18, 2018

Appveyor failure seems unrelated; I think this is good to merge.

@jennybc
Copy link
Member

@jennybc jennybc commented Aug 18, 2018

I am finding that I need this PR in order for devtools::document() to do the right thing with roxygen2 v6.1.0. Specifically, without this PR, re-document()ing after changing a function signature does not, in fact, cause the corresponding change in the .Rd. The signatures appear to persistently derive from the installed version, as opposed to current source.

Here's what happens if you create a new package with usethis::create_package() and add an exported, roxygen-documented function (but you never install the package):

==> devtools::document(roclets=c('rd', 'collate', 'namespace'))

Updating aabb documentation
First time using roxygen2. Upgrading automatically...
Writing NAMESPACE
Error in as.environment(where) : using 'as.environment(NULL)' is defunct
Calls: suppressPackageStartupMessages ... block_find_object -> object_from_call -> parser -> exists
Execution halted

Exited with status 1.

A different consequence of this PR that might be undesirable is that the helpers = FALSE behaviour (in the sense of load_all(pkg$path, helpers = FALSE)) has been lost. Is that worth taking a stand on?

@jimhester jimhester merged commit 2d012d1 into master Aug 19, 2018
2 of 3 checks passed
@jimhester
Copy link
Member

@jimhester jimhester commented Aug 20, 2018

Thanks!

@jennybc
Copy link
Member

@jennybc jennybc commented Aug 20, 2018

I think this is still worth pondering but I guess it's a roxygen2 matter now (?):

A different consequence of this PR that might be undesirable is that the helpers = FALSE behaviour (in the sense of load_all(pkg$path, helpers = FALSE)) has been lost. Is that worth taking a stand on?

@hadley
Copy link
Member Author

@hadley hadley commented Aug 20, 2018

Would you mind filing a roxygen2 bug so I don't forget?

@jimhester
Copy link
Member

@jimhester jimhester commented Aug 20, 2018

Maybe we should be calling pkgload::load_all(helpers = FALSE) in roxygen2 and maybe export_all = FALSE to more closely mimic a normal package namespace? I am not sure what roxygen2 assumes in regards to exports.

@jimhester
Copy link
Member

@jimhester jimhester commented Aug 20, 2018

Also potentially recompile = FALSE, which would be a way to fix r-lib/roxygen2#771, but maybe would cause other issues if the dll was not built.

@hadley
Copy link
Member Author

@hadley hadley commented Aug 21, 2018

Yeah, that seems like a good idea.

HughParsonage pushed a commit to HughParsonage/devtools that referenced this issue Jul 2, 2019
* Rely on roxygen2 all more

Much of the previous code is no longer necessary as roxygen2 handles it internally. Once we can move roxygen2 back into imports, we can add a version dependency there and then delete the old code.
@lionel- lionel- deleted the roxygen2-6.1.0 branch May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants