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

[R-package] [docs] remove devtools dependency for docs builds (fixes #3036) #3072

Merged
merged 20 commits into from
May 14, 2020

Conversation

jameslamb
Copy link
Collaborator

@jameslamb jameslamb commented May 11, 2020

I'd like to propose removing the dependency on devtools in our readthedocs builds. We are only using it for devtools::document(), which is just a thin wrapper around roxygen2::roxygenize().

devtools is a very expensive dependency (it depends recursively on successfully building 101 other R packages) compared to roxygen2 (41 recursive dependencies), and we're already installing roxygen2 anyway.

I'm also proposing bumping up our version of roxygen2 to 7.1.0, the most recent version used in DESCRIPTION

RoxygenNote: 7.1.0

How I got dependency counts

I figured out those recursive dependency numbers with the pkgnet package, a project I work on with some friends from a previous job. In an R environment, you can run pkgnet::CreatePackageReport('devtools') (for example), to see a summary of the dependencies.

@jameslamb
Copy link
Collaborator Author

@StrikerRUS I created this as a LightGBM branch, not on my fork. Could you enable it on readthedocs so we can test?

@StrikerRUS
Copy link
Collaborator

@jameslamb

Could you enable it on readthedocs so we can test?

Sure, done!

docs/conf.py Outdated Show resolved Hide resolved
@jameslamb
Copy link
Collaborator Author

@StrikerRUS hey it looks like this is working!

Some notes:

By "it's working", I mean updating pkgdown and roxygen2 in the conda environment. I still need too add the use of pkgdown url option for #3036. Trying that next.

@jameslamb jameslamb changed the title [R-package] [docs] remove devtools dependency for docs builds [R-package] [docs] remove devtools dependency for docs builds (fixes #3036) May 12, 2020
@jameslamb
Copy link
Collaborator Author

jameslamb commented May 12, 2020

The changes for #3036 do not seem to be working :/

The GitHub logo was updated correctly, but links like Source: R/lightgbm.R point to the wrong place.

For example, Source: R/lightgbm.R on https://lightgbm.readthedocs.io/en/fix-remove-devtools/R/reference/agaricus.train.html points to https://github.com/Microsoft/LightGBM/blob/master/R/lightgbm.R

I'm investigating.

UPDATE 1: tried updating the YAML to repo: url.

UPDATE 2: Tried updating URL in R-package/DESCRIPTION. pkgdown docs make it seem like repo: url: in _pkgdown.yml will only be used if BugReports and URL are not given in DESCRIPTION

UPDATE 3: Tried completely removing URL and BugReports in R-package/DESCRIPTION, to see if that would force pkgdown to use the URLs I provided.

UPDATE 4 Update 3 worked, but I originally thought it hadn't because my browser was caching RTD changes. Trying to revert the DESCRIPTION changes. The diff in https://github.com/r-lib/pkgdown/pull/1253/files makes it look like _pkgdown.yml takes precedence over DESCRIPTION fields for URLs

image

@jameslamb
Copy link
Collaborator Author

Ok I think this is fully working now and closes #3036 . This is ready for review.

@StrikerRUS
Copy link
Collaborator

the first few builds were very tough to debug on https://readthedocs.org/projects/lightgbm/builds/ because the logs from build_r.R were disabled by the sed call. Can we please remove it so the logs can be used for debugging? They aren't THAT long, and I think they're valuable

Are you speaking about this sed?

sed -i'.bak' '/# Build the package (do not touch this line!)/q' build_r.R

This sed was used to prevent double building of LightGBM similarly to trick for CI with R cmd check and allows us to fit in RTD build time limits.

You can safely drop ca-certificates dependency now.

In build_reference() document argument is replaced by devel since 1.4.0 version.
https://github.com/r-lib/pkgdown/blob/c181e5c9ac09b28974a97f5e32deddc36690fcf2/R/build-reference.R#L139

Refer to https://github.com/r-lib/pkgdown/releases/tag/v1.4.0

build_site(), build_reference() and build_home() gain a parameter
devel which controls whether you're in deployment or development mode.
It generalises and replaces (with deprecation) the existing document
argument.

@jameslamb
Copy link
Collaborator Author

the first few builds were very tough to debug on https://readthedocs.org/projects/lightgbm/builds/ because the logs from build_r.R were disabled by the sed call. Can we please remove it so the logs can be used for debugging? They aren't THAT long, and I think they're valuable

Are you speaking about this sed?

sed -i'.bak' '/# Build the package (do not touch this line!)/q' build_r.R

This sed was used to prevent double building of LightGBM similarly to trick for CI with R cmd check and allows us to fit in RTD build time limits.
You can safely drop ca-certificates dependency now.

In build_reference() document argument is replaced by devel since 1.4.0 version.
https://github.com/r-lib/pkgdown/blob/c181e5c9ac09b28974a97f5e32deddc36690fcf2/R/build-reference.R#L139

Refer to https://github.com/r-lib/pkgdown/releases/tag/v1.4.0

build_site(), build_reference() and build_home() gain a parameter
devel which controls whether you're in deployment or development mode.
It generalises and replaces (with deprecation) the existing document
argument.

Oh ok! Yes I misunderstood what that sed command was doing, thanks for the clarification. But I still think we should remove it. roxygen2::roxygenize(load = "installed") will say "don't try to rebuild the package, just assume it has already been built and installed".

I'll try removing ca-certificates and updating build_reference() call tonight.

@jameslamb
Copy link
Collaborator Author

@jameslamb jameslamb closed this May 13, 2020
@jameslamb
Copy link
Collaborator Author

close-reopen to re-trigger CI. Azure got stuck trying to download MiKTeX 😬

@jameslamb jameslamb reopened this May 13, 2020
docs/conf.py Outdated Show resolved Hide resolved
docs/conf.py Show resolved Hide resolved
Copy link
Collaborator

@StrikerRUS StrikerRUS left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks a lot!

@StrikerRUS StrikerRUS merged commit 9085f4e into master May 14, 2020
@StrikerRUS StrikerRUS deleted the fix/remove-devtools branch May 14, 2020 18:14
odimka pushed a commit to odimka/LightGBM that referenced this pull request May 17, 2020
…icrosoft#3036) (microsoft#3072)

* [R-package] [docs] remove devtools dependency for docs builds

* linting

* updating docs conda env

* empty roxygenize()

* env for R libraries

* get logs

* remove comment

* added pkgdown URLs

* more paths

* fix incorrect YAML keys

* update DESCRIPTION URL link

* more URL changes

* revert DESCRIPTION changes

* remove ca-certificates

* empty commit

* Update docs/conf.py

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>

* empty commit

* remove outdated line in build_r.R

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
ChipKerchner pushed a commit to ChipKerchner/LightGBM that referenced this pull request Jun 10, 2020
…icrosoft#3036) (microsoft#3072)

* [R-package] [docs] remove devtools dependency for docs builds

* linting

* updating docs conda env

* empty roxygenize()

* env for R libraries

* get logs

* remove comment

* added pkgdown URLs

* more paths

* fix incorrect YAML keys

* update DESCRIPTION URL link

* more URL changes

* revert DESCRIPTION changes

* remove ca-certificates

* empty commit

* Update docs/conf.py

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>

* empty commit

* remove outdated line in build_r.R

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
ChipKerchner pushed a commit to ChipKerchner/LightGBM that referenced this pull request Jun 11, 2020
…icrosoft#3036) (microsoft#3072)

* [R-package] [docs] remove devtools dependency for docs builds

* linting

* updating docs conda env

* empty roxygenize()

* env for R libraries

* get logs

* remove comment

* added pkgdown URLs

* more paths

* fix incorrect YAML keys

* update DESCRIPTION URL link

* more URL changes

* revert DESCRIPTION changes

* remove ca-certificates

* empty commit

* Update docs/conf.py

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>

* empty commit

* remove outdated line in build_r.R

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants