Skip to content

Commit

Permalink
[docs] use consistent naming for R-package and Python-package across …
Browse files Browse the repository at this point in the history
…the repo (#6655)
  • Loading branch information
StrikerRUS authored Oct 7, 2024
1 parent 718da7d commit e8a68f2
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 55 deletions.
4 changes: 2 additions & 2 deletions .ci/check-python-dists.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DIST_DIR=${1}
METHOD=${METHOD:-""}
TASK=${TASK:-""}

echo "checking Python package distributions in '${DIST_DIR}'"
echo "checking Python-package distributions in '${DIST_DIR}'"

pip install \
-qq \
Expand Down Expand Up @@ -55,4 +55,4 @@ else
echo "skipping pydistcheck (does not support Python 3.${PY_MINOR_VER})"
fi

echo "done checking Python package distributions"
echo "done checking Python-package distributions"
2 changes: 1 addition & 1 deletion .ci/test-python-oldest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pip freeze
echo ""
echo "checking that examples run without error"

# run a few examples to test that Python package minimally works
# run a few examples to test that Python-package minimally works
echo ""
echo "--- advanced_example.py ---"
echo ""
Expand Down
6 changes: 3 additions & 3 deletions .ci/test-r-package-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Write-Output "Installing dependencies"
$packages = "c('data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'processx', 'R6', 'RhpcBLASctl', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo')"
Run-R-Code-Redirect-Stderr "options(install.packages.check.source = 'no'); install.packages($packages, repos = '$env:CRAN_MIRROR', type = 'binary', lib = '$env:R_LIB_PATH', Ncpus = parallel::detectCores())" ; Check-Output $?

Write-Output "Building R package"
Write-Output "Building R-package"

# R CMD check is not used for MSVC builds
if ($env:COMPILER -ne "MSVC") {
Expand Down Expand Up @@ -234,7 +234,7 @@ if ($checks_cnt -eq 0) {
Check-Output $False
}

# Checking that we actually got the expected compiler. The R package has some logic
# Checking that we actually got the expected compiler. The R-package has some logic
# to fail back to MinGW if MSVC fails, but for CI builds we need to check that the correct
# compiler was used.
if ($env:R_BUILD_TYPE -eq "cmake") {
Expand Down Expand Up @@ -303,4 +303,4 @@ if ($env:COMPILER -eq "MSVC") {
Rscript.exe --vanilla "testthat.R" ; Check-Output $?
}

Write-Output "No issues were found checking the R package"
Write-Output "No issues were found checking the R-package"
4 changes: 2 additions & 2 deletions .ci/test-r-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ elif [[ $R_BUILD_TYPE == "cran" ]]; then
git diff --name-only | wc -l
)
if [[ ${num_files_changed} -gt 0 ]]; then
echo "'configure' in the R package has changed. Please recreate it and commit the changes."
echo "'configure' in the R-package has changed. Please recreate it and commit the changes."
echo "Changed files:"
git diff --compact-summary
echo "See R-package/README.md for details on how to recreate this script."
Expand All @@ -167,7 +167,7 @@ elif [[ $R_BUILD_TYPE == "cran" ]]; then
./build-cran-package.sh || exit 1

if [[ "${TASK}" == "r-rchk" ]]; then
echo "Checking R package with rchk"
echo "Checking R-package with rchk"
mkdir -p packages
cp ${PKG_TARBALL} packages
RCHK_LOG_FILE="rchk-logs.txt"
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ option(BUILD_CLI "Build the 'lightbgm' command-line interface in addition to lib
option(BUILD_CPP_TEST "Build C++ tests with Google Test" OFF)
option(BUILD_STATIC_LIB "Build static library" OFF)
option(INSTALL_HEADERS "Install headers to CMAKE_INSTALL_PREFIX (e.g. '/usr/local/include')" ON)
option(__BUILD_FOR_PYTHON "Set to ON if building lib_lightgbm for use with the Python package" OFF)
option(__BUILD_FOR_R "Set to ON if building lib_lightgbm for use with the R package" OFF)
option(__BUILD_FOR_PYTHON "Set to ON if building lib_lightgbm for use with the Python-package" OFF)
option(__BUILD_FOR_R "Set to ON if building lib_lightgbm for use with the R-package" OFF)
option(__INTEGRATE_OPENCL "Set to ON if building LightGBM with the OpenCL ICD Loader and its dependencies included" OFF)

cmake_minimum_required(VERSION 3.28)
Expand Down Expand Up @@ -60,9 +60,9 @@ if(__INTEGRATE_OPENCL)
endif()

if(__BUILD_FOR_PYTHON OR __BUILD_FOR_R OR USE_SWIG)
# the SWIG wrapper, the Python and R package don't require the CLI
# the SWIG wrapper, the Python and R packages don't require the CLI
set(BUILD_CLI OFF)
# installing the SWIG wrapper, the R and Python package shouldn't place LightGBM's headers
# installing the SWIG wrapper, the R and Python packages shouldn't place LightGBM's headers
# outside of where the package is installed
set(INSTALL_HEADERS OFF)
endif()
Expand Down Expand Up @@ -497,7 +497,7 @@ endif()

set(API_SOURCES "src/c_api.cpp")
# Only build the R part of the library if building for
# use with the R package
# use with the R-package
if(__BUILD_FOR_R)
list(APPEND API_SOURCES "src/lightgbm_R.cpp")
endif()
Expand Down
20 changes: 10 additions & 10 deletions R-package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ NOTE: `Rtools42` and later take a very different approach to the compiler toolch

#### Windows Toolchain Options

A "toolchain" refers to the collection of software used to build the library. The R package can be built with three different toolchains.
A "toolchain" refers to the collection of software used to build the library. The R-package can be built with three different toolchains.

**Warning for Windows users**: it is recommended to use *Visual Studio* for its better multi-threading efficiency in Windows for many core systems. For very simple systems (dual core computers or worse), MinGW64 is recommended for maximum performance. If you do not know what to choose, it is recommended to use [Visual Studio](https://visualstudio.microsoft.com/downloads/), the default compiler. **Do not try using MinGW in Windows on many core systems. It may result in 10x slower results than Visual Studio.**

Expand Down Expand Up @@ -221,7 +221,7 @@ CRAN does not prepare precompiled binaries for Linux, and as of this writing nei

### Installing from a Pre-compiled lib_lightgbm <a name="lib_lightgbm"></a>

Previous versions of LightGBM offered the ability to first compile the C++ library (`lib_lightgbm.{dll,dylib,so}`) and then build an R package that wraps it.
Previous versions of LightGBM offered the ability to first compile the C++ library (`lib_lightgbm.{dll,dylib,so}`) and then build an R-package that wraps it.

As of version 3.0.0, this is no longer supported. If building from source is difficult for you, please [open an issue](https://github.com/microsoft/LightGBM/issues).

Expand All @@ -241,11 +241,11 @@ Please visit [demo](https://github.com/microsoft/LightGBM/tree/master/R-package/
Testing
-------

The R package's unit tests are run automatically on every commit, via integrations like [GitHub Actions](https://github.com/microsoft/LightGBM/actions). Adding new tests in `R-package/tests/testthat` is a valuable way to improve the reliability of the R package.
The R-package's unit tests are run automatically on every commit, via integrations like [GitHub Actions](https://github.com/microsoft/LightGBM/actions). Adding new tests in `R-package/tests/testthat` is a valuable way to improve the reliability of the R-package.

### Running the Tests

While developing the R package, run the code below to run the unit tests.
While developing the R-package, run the code below to run the unit tests.

```shell
sh build-cran-package.sh \
Expand All @@ -268,7 +268,7 @@ Rscript testthat.R

When adding tests, you may want to use test coverage to identify untested areas and to check if the tests you've added are covering all branches of the intended code.

The example below shows how to generate code coverage for the R package on a macOS or Linux setup. To adjust for your environment, refer to [the customization step described above](#custom-installation-linux-mac).
The example below shows how to generate code coverage for the R-package on a macOS or Linux setup. To adjust for your environment, refer to [the customization step described above](#custom-installation-linux-mac).

```shell
# Install
Expand All @@ -287,7 +287,7 @@ Rscript -e " \
Updating Documentation
----------------------

The R package uses [`{roxygen2}`](https://CRAN.R-project.org/package=roxygen2) to generate its documentation.
The R-package uses [`{roxygen2}`](https://CRAN.R-project.org/package=roxygen2) to generate its documentation.
The generated `DESCRIPTION`, `NAMESPACE`, and `man/` files are checked into source control.
To regenerate those files, run the following.

Expand All @@ -310,9 +310,9 @@ Rscript \
Preparing a CRAN Package
------------------------

This section is primarily for maintainers, but may help users and contributors to understand the structure of the R package.
This section is primarily for maintainers, but may help users and contributors to understand the structure of the R-package.

Most of `LightGBM` uses `CMake` to handle tasks like setting compiler and linker flags, including header file locations, and linking to other libraries. Because CRAN packages typically do not assume the presence of `CMake`, the R package uses an alternative method that is in the CRAN-supported toolchain for building R packages with C++ code: `Autoconf`.
Most of `LightGBM` uses `CMake` to handle tasks like setting compiler and linker flags, including header file locations, and linking to other libraries. Because CRAN packages typically do not assume the presence of `CMake`, the R-package uses an alternative method that is in the CRAN-supported toolchain for building R packages with C++ code: `Autoconf`.

For more information on this approach, see ["Writing R Extensions"](https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Configure-and-cleanup).

Expand Down Expand Up @@ -344,7 +344,7 @@ R CMD install lightgbm_*.tar.gz

### Changing the CRAN Package

A lot of details are handled automatically by `R CMD build` and `R CMD install`, so it can be difficult to understand how the files in the R package are related to each other. An extensive treatment of those details is available in ["Writing R Extensions"](https://cran.r-project.org/doc/manuals/r-release/R-exts.html).
A lot of details are handled automatically by `R CMD build` and `R CMD install`, so it can be difficult to understand how the files in the R-package are related to each other. An extensive treatment of those details is available in ["Writing R Extensions"](https://cran.r-project.org/doc/manuals/r-release/R-exts.html).

This section briefly explains the key files for building a CRAN package. To update the package, edit the files relevant to your change and re-run the steps in [Build a CRAN Package](#build-a-cran-package).

Expand Down Expand Up @@ -488,4 +488,4 @@ These tests can also be triggered on any pull request by leaving a comment in a
Known Issues
------------
For information about known issues with the R package, see the [R-package section of LightGBM's main FAQ page](https://lightgbm.readthedocs.io/en/latest/FAQ.html#r-package).
For information about known issues with the R-package, see the [R-package section of LightGBM's main FAQ page](https://lightgbm.readthedocs.io/en/latest/FAQ.html#r-package).
4 changes: 2 additions & 2 deletions R-package/tests/testthat/test_basic.R
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ test_that("lgb.cv() prefers objective in params to keyword argument", {
for (bst_list in cv_bst$boosters) {
bst <- bst_list[["booster"]]
expect_equal(bst$params$objective, "regression_l1")
# NOTE: using save_model_to_string() since that is the simplest public API in the R package
# NOTE: using save_model_to_string() since that is the simplest public API in the R-package
# allowing access to the "objective" attribute of the Booster object on the C++ side
model_txt_lines <- strsplit(
x = bst$save_model_to_string()
Expand Down Expand Up @@ -807,7 +807,7 @@ test_that("lgb.train() prefers objective in params to keyword argument", {
, obj = "regression_l2"
)
expect_equal(bst$params$objective, "regression_l1")
# NOTE: using save_model_to_string() since that is the simplest public API in the R package
# NOTE: using save_model_to_string() since that is the simplest public API in the R-package
# allowing access to the "objective" attribute of the Booster object on the C++ side
model_txt_lines <- strsplit(
x = bst$save_model_to_string()
Expand Down
6 changes: 3 additions & 3 deletions R-package/tests/testthat/test_lgb.Booster.R
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ test_that("all parameters are stored correctly with save_model_to_string()", {
)
all_param_entries <- c(non_default_param_entries, default_param_entries)

# parameters should match what was passed from the R package
# parameters should match what was passed from the R-package
model_str <- bst$save_model_to_string()
params_in_file <- .params_from_model_string(model_str = model_str)
.expect_in(all_param_entries, params_in_file)
Expand Down Expand Up @@ -1176,7 +1176,7 @@ test_that("early_stopping, num_iterations are stored correctly in model string e
model_str <- bst$save_model_to_string()
params_in_file <- .params_from_model_string(model_str = model_str)

# parameters should match what was passed from the R package, and the "main" (non-alias)
# parameters should match what was passed from the R-package, and the "main" (non-alias)
# params values in `params` should be preferred to keyword argumentts or aliases
expect_equal(sum(startsWith(params_in_file, "[num_iterations:")), 1L)
expect_equal(sum(params_in_file == sprintf("[num_iterations: %s]", num_iterations)), 1L)
Expand Down Expand Up @@ -1406,7 +1406,7 @@ test_that("lgb.cv() correctly handles passing through params to the model file",
model_str <- bst[["booster"]]$save_model_to_string()
params_in_file <- .params_from_model_string(model_str = model_str)

# parameters should match what was passed from the R package, and the "main" (non-alias)
# parameters should match what was passed from the R-package, and the "main" (non-alias)
# params values in `params` should be preferred to keyword argumentts or aliases
expect_equal(sum(startsWith(params_in_file, "[num_iterations:")), 1L)
expect_equal(sum(params_in_file == sprintf("[num_iterations: %s]", num_iterations)), 1L)
Expand Down
2 changes: 1 addition & 1 deletion R-package/vignettes/basic_walkthrough.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ table(bank$y)

## Training the model

The R package of LightGBM offers two functions to train a model:
The R-package of LightGBM offers two functions to train a model:

- `lgb.train()`: This is the main training logic. It offers full flexibility but requires a `Dataset` object created by the `lgb.Dataset()` function.
- `lightgbm()`: Simpler, but less flexible. Data can be passed without having to bother with `lgb.Dataset()`.
Expand Down
10 changes: 5 additions & 5 deletions build-cran-package.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/sh

# [description]
# Prepare a source distribution of the R package
# Prepare a source distribution of the R-package
# to be submitted to CRAN.
#
# [arguments]
#
# --r-executable Customize the R executable used by `R CMD build`.
# Useful if building the R package in an environment with
# Useful if building the R-package in an environment with
# non-standard builds of R, such as those provided in
# https://github.com/wch/r-debug.
#
Expand Down Expand Up @@ -83,7 +83,7 @@ cp \
external_libs/fmt/include/fmt/*.h \
"${TEMP_R_DIR}/src/include/LightGBM/utils/fmt"

# including only specific files from Eigen, to keep the R package
# including only specific files from Eigen, to keep the R-package
# small and avoid redistributing code with licenses incompatible with
# LightGBM's license
EIGEN_R_DIR="${TEMP_R_DIR}/src/include/Eigen"
Expand Down Expand Up @@ -116,7 +116,7 @@ cd "${TEMP_R_DIR}"
rm recreate-configure.sh

# files only used by the lightgbm CLI aren't needed for
# the R package
# the R-package
rm src/application/application.cpp
rm src/include/LightGBM/application.h
rm src/main.cpp
Expand Down Expand Up @@ -223,4 +223,4 @@ else
lightgbm_r
fi

echo "Done building R package"
echo "Done building R-package"
8 changes: 4 additions & 4 deletions build-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# [description]
#
# Prepare a source distribution (sdist) or built distribution (wheel)
# of the Python package, and optionally install it.
# of the Python-package, and optionally install it.
#
# [usage]
#
Expand All @@ -13,10 +13,10 @@
# # build wheel and put it in dist/
# sh ./build-python.sh bdist_wheel [OPTIONS]
#
# # compile lib_lightgbm and install the Python package wrapping it
# # compile lib_lightgbm and install the Python-package wrapping it
# sh ./build-python.sh install [OPTIONS]
#
# # install the Python package using a pre-compiled lib_lightgbm
# # install the Python-package using a pre-compiled lib_lightgbm
# # (assumes lib_lightgbm.{dll,so} is located at the root of the repo)
# sh ./build-python.sh install --precompile
#
Expand Down Expand Up @@ -184,7 +184,7 @@ done
pip install --prefer-binary 'build>=0.10.0'

# create a new directory that just contains the files needed
# to build the Python package
# to build the Python-package
create_isolated_source_dir() {
rm -rf \
./lightgbm-python \
Expand Down
2 changes: 1 addition & 1 deletion build_r.R
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ for (submodule in list.dirs(
, recursive = FALSE
)) {
# compute/ is a submodule with boost, only needed if
# building the R package with GPU support;
# building the R-package with GPU support;
# eigen/ has a special treatment due to licensing aspects
if ((submodule == "compute" && !USING_GPU) || submodule == "eigen") {
next
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/FindLibR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if(NOT R_ARCH)
endif()

if(NOT ("${R_ARCH}" STREQUAL "x64"))
message(FATAL_ERROR "LightGBM's R package currently only supports 64-bit operating systems")
message(FATAL_ERROR "LightGBM's R-package currently only supports 64-bit operating systems")
endif()

# Creates R.lib and R.def in the build directory for linking with MSVC
Expand Down
12 changes: 6 additions & 6 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ For more details on how to configure and use the LightGBM CLI, see https://light

## Running the Python-package Сontainer

Build an image with the LightGBM Python package installed.
Build an image with the LightGBM Python-package installed.

```shell
mkdir lightgbm-docker
Expand All @@ -69,8 +69,8 @@ docker build \
.
```

Once that completes, the built image can be used to run LightGBM's Python package in a container.
Run the following to produce a model using the Python package.
Once that completes, the built image can be used to run LightGBM's Python-package in a container.
Run the following to produce a model using the Python-package.

```shell
# get training data
Expand Down Expand Up @@ -116,7 +116,7 @@ docker run \

## Running the R-package Сontainer

Build an image with the LightGBM R package installed.
Build an image with the LightGBM R-package installed.

```shell
mkdir lightgbm-docker
Expand All @@ -129,8 +129,8 @@ docker build \
.
```

Once that completes, the built image can be used to run LightGBM's R package in a container.
Run the following to produce a model using the R package.
Once that completes, the built image can be used to run LightGBM's R-package in a container.
Run the following to produce a model using the R-package.

```shell
# get training data
Expand Down
Loading

0 comments on commit e8a68f2

Please sign in to comment.