Skip to content

Commit 4a98140

Browse files
[Docs] Apply Google style guide to development.rst
Apply Google developer documentation style guide rules to development.rst: - Sentence case: fix 11 headings (Source, Steps, Only, Full Source Build, MacOS, Development Tooling, Pre-commit Hooks, Advanced Build Options, Fast/Debug/Optimized Builds, Building the Docs) - Second person: replace "We provide" with "Use the script" - Present tense: replace future "will" constructions throughout (env var list, prose sections) - Contractions: "Do not" -> "Don't", "will not" -> "won't", "pip is not" -> "isn't" - Active voice: env var list passive constructions converted ("will be built" -> "Ray builds", etc.) - macOS branding: fix "MacOS" -> "macOS" and "mac" -> "Mac" throughout Topic: style-wheel-docs Relative: add-refs Signed-off-by: andrew <andrew@anyscale.com>
1 parent 87b91a3 commit 4a98140

1 file changed

Lines changed: 57 additions & 60 deletions

File tree

doc/source/ray-contribute/development.rst

Lines changed: 57 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. _building-ray:
22

3-
Building Ray from Source
3+
Building Ray from source
44
=========================
55

66
To contribute to the Ray repository, follow the instructions below to build from the latest master branch.
@@ -85,12 +85,12 @@ Create a virtual environment to prevent version conflicts and to develop with an
8585
8686
.. _python-develop:
8787

88-
Building Ray (Python Only)
88+
Building Ray (Python only)
8989
--------------------------
9090

9191
.. note:: Unless otherwise stated, directory and file paths are relative to the project root directory.
9292

93-
RLlib, Tune, Autoscaler, and most Python files do not require you to build and compile Ray. Follow these instructions to develop Ray's Python files locally without building Ray.
93+
RLlib, Tune, Autoscaler, and most Python files don't require you to build and compile Ray. Follow these instructions to develop Ray's Python files locally without building Ray.
9494

9595
1. Make sure you have a clone of Ray's git repository (see :ref:`fork-ray-repo`).
9696

@@ -103,15 +103,15 @@ RLlib, Tune, Autoscaler, and most Python files do not require you to build and c
103103
# For example, for Python 3.10:
104104
pip install -U https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp310-cp310-manylinux2014_x86_64.whl
105105
106-
4. Replace Python files in the installed package with your local editable copy. We provide a simple script to help you do this: ``python python/ray/setup-dev.py``. Running the script will remove the ``ray/tune``, ``ray/rllib``, ``ray/autoscaler`` dir (among other directories) bundled with the ``ray`` pip package, and replace them with links to your local code. This way, changing files in your git clone will directly affect the behavior of your installed Ray.
106+
4. Replace Python files in the installed package with your local editable copy. Use the script ``python python/ray/setup-dev.py`` to do this. The script removes the ``ray/tune``, ``ray/rllib``, ``ray/autoscaler`` directories (among others) bundled with the ``ray`` pip package, replacing them with links to your local code. This way, changing files in your git clone directly affects the behavior of your installed Ray.
107107

108108
.. code-block:: shell
109109
110110
# This replaces `<package path>/site-packages/ray/<package>`
111111
# with your local `ray/python/ray/<package>`.
112112
python python/ray/setup-dev.py
113113
114-
.. note:: [Advanced] You can also optionally skip creating symbolic link for directories of your choice.
114+
.. note:: [Advanced] You can also optionally skip creating symbolic links for specific directories:
115115

116116
.. code-block:: shell
117117
@@ -120,7 +120,7 @@ RLlib, Tune, Autoscaler, and most Python files do not require you to build and c
120120
121121
.. _python-develop-uninstall:
122122

123-
.. warning:: Do not run ``pip uninstall ray`` or ``pip install -U`` (for Ray or Ray wheels) if setting up your environment this way. To uninstall or upgrade, you must first ``rm -rf`` the pip-installation site (usually a directory at the ``site-packages/ray`` location), then do a pip reinstall (see the command above), and finally run the above ``setup-dev.py`` script again.
123+
.. warning:: Don't run ``pip uninstall ray`` or ``pip install -U`` (for Ray or Ray wheels) if setting up your environment this way. To uninstall or upgrade, first ``rm -rf`` the pip-installation site (usually a directory at the ``site-packages/ray`` location), then do a pip reinstall (see the command above), and finally run the ``setup-dev.py`` script again.
124124

125125
.. code-block:: shell
126126
@@ -131,18 +131,18 @@ RLlib, Tune, Autoscaler, and most Python files do not require you to build and c
131131
132132
.. _full-source-build:
133133

134-
Full Source Build
134+
Full source build
135135
-----------------
136136

137137
.. tip::
138138

139139
If you already followed the instructions in :ref:`python-develop` and want to switch
140-
to the Full build, you will need to first uninstall Ray (see :ref:`uninstallation steps <python-develop-uninstall>`).
140+
to the Full build, you need to first uninstall Ray (see :ref:`uninstallation steps <python-develop-uninstall>`).
141141

142142
Preparing to build Ray on Linux
143143
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144144

145-
.. tip:: If you are only editing Tune/RLlib/Autoscaler files, follow instructions for :ref:`python-develop` to avoid long build times.
145+
.. tip:: If you're only editing Tune/RLlib/Autoscaler files, follow :ref:`python-develop` instead to avoid long build times.
146146

147147
To build Ray on Ubuntu, run the following commands:
148148

@@ -159,10 +159,7 @@ To build Ray on Ubuntu, run the following commands:
159159
nvm install 14
160160
nvm use 14
161161
162-
.. note::
163-
The `install-bazel.sh` script installs `bazelisk` for building Ray.
164-
Note that `bazel` is installed at `$HOME/bin/bazel`; make sure it's on the executable `PATH`.
165-
If you prefer to use `bazel`, only version `6.5.0` is currently supported.
162+
.. note:: The ``install-bazel.sh`` script installs ``bazelisk``. Note that ``bazel`` is installed at ``$HOME/bin/bazel``; make sure it's on your ``PATH``. If you prefer to use ``bazel`` directly, only version ``6.5.0`` is currently supported.
166163

167164
For RHELv8 (Redhat EL 8.0-64 Minimal), run the following commands:
168165

@@ -173,12 +170,12 @@ For RHELv8 (Redhat EL 8.0-64 Minimal), run the following commands:
173170
174171
In RedHat, install Bazel manually from this link: https://bazel.build/versions/6.5.0/install/redhat
175172

176-
Preparing to build Ray on MacOS
173+
Preparing to build Ray on macOS
177174
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
178175

179-
.. tip:: Assuming you already have Brew and Bazel installed on your mac and you also have grpc and protobuf installed on your mac consider removing those (grpc and protobuf) for smooth build through the commands ``brew uninstall grpc``, ``brew uninstall protobuf``. If you have built the source code earlier and it still fails with errors like ``No such file or directory:``, try cleaning previous builds on your host by running the commands ``brew uninstall binutils`` and ``bazel clean --expunge``.
176+
.. tip:: If you have grpc or protobuf installed, remove them first for a smooth build: ``brew uninstall grpc``, ``brew uninstall protobuf``. If the build fails with ``No such file or directory`` errors, clean previous builds with ``brew uninstall binutils`` and ``bazel clean --expunge``.
180177

181-
To build Ray on MacOS, first install these dependencies:
178+
To build Ray on macOS, first install these dependencies:
182179

183180
.. code-block:: bash
184181
@@ -188,31 +185,31 @@ To build Ray on MacOS, first install these dependencies:
188185
# Install Bazel.
189186
ci/env/install-bazel.sh
190187
191-
Building Ray on Linux & MacOS (full)
188+
Building Ray on Linux & macOS (full)
192189
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
193190

194-
Make sure you have a local clone of Ray's git repository (see :ref:`fork-ray-repo`). You will also need to install NodeJS_ to build the dashboard.
191+
Make sure you have a local clone of Ray's git repository (see :ref:`fork-ray-repo`). You also need to install NodeJS_ to build the dashboard.
195192

196193
Enter into the project directory, for example:
197194

198195
.. code-block:: shell
199196
200197
cd ray
201198
202-
Now you can build the dashboard. From inside of your local Ray project directory enter into the dashboard client directory:
199+
Build the dashboard. From inside your local Ray project directory, enter the dashboard client directory:
203200

204201
.. code-block:: bash
205202
206203
cd python/ray/dashboard/client
207204
208-
Then you can install the dependencies and build the dashboard:
205+
Install the dependencies and build the dashboard:
209206

210207
.. code-block:: bash
211208
212209
npm ci
213210
npm run build
214211
215-
After that, you can now move back to the top level Ray directory:
212+
Move back to the top-level Ray directory:
216213

217214
.. code-block:: shell
218215
@@ -236,20 +233,21 @@ Enter into the ``python/`` directory inside of the Ray project directory and ins
236233
pip install -e . --verbose # Add --user if you see a permission denied error.
237234
238235
The ``-e`` means "editable", so changes you make to files in the Ray
239-
directory will take effect without reinstalling the package.
236+
directory take effect without reinstalling the package.
240237

241-
.. warning:: if you run ``python setup.py install``, files will be copied from the Ray directory to a directory of Python packages (``/lib/python3.6/site-packages/ray``). This means that changes you make to files in the Ray directory will not have any effect.
238+
.. warning:: Don't run ``python setup.py install`` — Python copies files from the Ray directory to a packages directory (``/lib/python3.6/site-packages/ray``), so changes you make to files in the Ray directory won't have any effect.
242239

243240
.. tip::
244241

245-
If your machine is running out of memory during the build or the build is causing other programs to crash, try adding the following line to ``~/.bazelrc``:
242+
If your machine runs out of memory during the build, add the following to ``~/.bazelrc``:
246243

247-
``build --local_ram_resources=HOST_RAM*.5 --local_cpu_resources=4``
244+
.. code-block:: shell
248245
249-
The ``build --disk_cache=~/bazel-cache`` option can be useful to speed up repeated builds too.
246+
build --local_ram_resources=HOST_RAM*.5 --local_cpu_resources=4
250247
251-
.. note::
252-
Warning: If you run into an error building protobuf, switching from miniforge to anaconda might help.
248+
The ``build --disk_cache=~/bazel-cache`` option can also speed up repeated builds.
249+
250+
.. note:: If you run into an error building protobuf, switching from miniforge to anaconda might help.
253251

254252
.. _NodeJS: https://nodejs.org
255253

@@ -258,7 +256,7 @@ Building Ray on Windows (full)
258256

259257
**Requirements**
260258

261-
The following links were correct during the writing of this section. In case the URLs changed, search at the organizations' sites.
259+
The following links were accurate at the time of writing. If a URL has changed, search the organization's site.
262260

263261
- Bazel 6.5.0 (https://github.com/bazelbuild/bazel/releases/tag/6.5.0)
264262
- Microsoft Visual Studio 2019 (or Microsoft Build Tools 2019 - https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019)
@@ -292,10 +290,10 @@ You can also use the included script to install Bazel:
292290

293291
3. Define an environment variable ``BAZEL_SH`` to point to ``bash.exe``. If git for Windows was installed for all users, bash's path should be ``C:\Program Files\Git\bin\bash.exe``. If git was installed for a single user, adjust the path accordingly.
294292

295-
4. Bazel 6.5.0 installation. Go to Bazel 6.5.0 release web page and download
296-
bazel-4.2.1-windows-x86_64.exe. Copy the exe into the directory of your choice.
297-
Define an environment variable BAZEL_PATH to full exe path (example:
298-
``set BAZEL_PATH=C:\bazel\bazel.exe``). Also add the Bazel directory to the
293+
4. Install Bazel 6.5.0. Go to the Bazel 6.5.0 release page and download
294+
``bazel-6.5.0-windows-x86_64.exe``. Copy the exe into the directory of your choice.
295+
Define an environment variable ``BAZEL_PATH`` to the full exe path (example:
296+
``set BAZEL_PATH=C:\bazel\bazel.exe``). Also add the Bazel directory to
299297
``PATH`` (example: ``set PATH=%PATH%;C:\bazel``)
300298

301299
5. Download ray source code and build it.
@@ -307,29 +305,28 @@ Define an environment variable BAZEL_PATH to full exe path (example:
307305
cd ray\python
308306
pip install -e . --verbose
309307
310-
Advanced Build Options
308+
Advanced build options
311309
----------------------
312310

313311
Environment variables that influence builds
314312
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
315313

316314
You can tweak the build with the following environment variables (when running ``pip install -e .`` or ``python setup.py install``):
317315

318-
- ``RAY_BUILD_CORE``: If set and equal to ``1``, the core parts will be built. Defaults to ``1``.
319-
- ``RAY_INSTALL_JAVA``: If set and equal to ``1``, extra build steps will be executed
320-
to build java portions of the codebase
321-
- ``RAY_INSTALL_CPP``: If set and equal to ``1``, ``ray-cpp`` will be installed
322-
- ``RAY_BUILD_REDIS``: If set and equal to ``1``, Redis binaries will be built or fetched.
316+
- ``RAY_BUILD_CORE``: If set and equal to ``1``, Ray builds the core parts. Defaults to ``1``.
317+
- ``RAY_INSTALL_JAVA``: If set and equal to ``1``, Ray runs extra build steps
318+
to build Java portions of the codebase
319+
- ``RAY_INSTALL_CPP``: If set and equal to ``1``, Ray installs ``ray-cpp``
320+
- ``RAY_BUILD_REDIS``: If set and equal to ``1``, Ray builds or fetches Redis binaries.
323321
These binaries are only used for testing. Defaults to ``1``.
324-
- ``RAY_DISABLE_EXTRA_CPP``: If set and equal to ``1``, a regular (non -
325-
``cpp``) build will not provide some ``cpp`` interfaces
326-
- ``SKIP_BAZEL_BUILD``: If set and equal to ``1``, no Bazel build steps will be
327-
executed
328-
- ``SKIP_THIRDPARTY_INSTALL_CONDA_FORGE``: If set, setup will skip installation of
322+
- ``RAY_DISABLE_EXTRA_CPP``: If set and equal to ``1``, a regular (non-``cpp``)
323+
build won't provide some ``cpp`` interfaces
324+
- ``SKIP_BAZEL_BUILD``: If set and equal to ``1``, Ray skips all Bazel build steps
325+
- ``SKIP_THIRDPARTY_INSTALL_CONDA_FORGE``: If set, setup skips installation of
329326
third-party packages required for build. This is active on conda-forge where
330-
pip is not used to create a build environment.
331-
- ``RAY_DEBUG_BUILD``: Can be set to ``debug``, ``asan``, or ``tsan``. Any
332-
other value will be ignored
327+
pip isn't used to create a build environment.
328+
- ``RAY_DEBUG_BUILD``: Can be set to ``debug``, ``asan``, or ``tsan``. Ray ignores
329+
any other value
333330
- ``BAZEL_ARGS``: If set, pass a space-separated set of arguments to Bazel. This can be useful
334331
for restricting resource usage during builds, for example. See https://bazel.build/docs/user-manual
335332
for more information about valid arguments.
@@ -340,19 +337,19 @@ You can tweak the build with the following environment variables (when running `
340337
- ``BAZEL_PATH``: used on Windows to find ``bazel.exe``, see below
341338
- ``MINGW_DIR``: used on Windows to find ``bazel.exe`` if not found in ``BAZEL_PATH``
342339

343-
Fast, Debug, and Optimized Builds
344-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
340+
Fast, debug, and optimized builds
341+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
345342

346-
Currently, Ray is built with optimizations, which can take a long time and
347-
interfere with debugging. To perform fast, debug, or optimized builds, you can
343+
By default, Ray builds with optimizations, which can take a long time and
344+
interfere with debugging. To perform fast, debug, or optimized builds,
348345
run the following (via ``-c`` ``fastbuild``/``dbg``/``opt``, respectively):
349346

350347
.. code-block:: shell
351348
352349
bazel run -c fastbuild //:gen_ray_pkg
353350
354-
This will rebuild Ray with the appropriate options (which may take a while).
355-
If you need to build all targets, you can use ``bazel build //:all`` instead of
351+
This rebuilds Ray with the appropriate options (which might take a while).
352+
If you need to build all targets, use ``bazel build //:all`` instead of
356353
``bazel run //:gen_ray_pkg``.
357354

358355
To make this change permanent, you can add an option such as the following
@@ -396,28 +393,28 @@ To test switching back to the original rule, change ``False`` to ``True``.
396393

397394
.. _`PR template`: https://github.com/ray-project/ray/blob/master/.github/PULL_REQUEST_TEMPLATE.md
398395

399-
Development Tooling
396+
Development tooling
400397
-------------------
401398

402399
Installing additional dependencies for development
403400
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
404401

405-
Dependencies for the linter (``pre-commit``) can be installed with:
402+
Install dependencies for the linter (``pre-commit``):
406403

407404
.. code-block:: shell
408405
409406
pip install -c python/requirements_compiled.txt pre-commit
410407
pre-commit install
411408
412-
Dependencies for running Ray unit tests under ``python/ray/tests`` can be installed with:
409+
Install dependencies for running Ray unit tests under ``python/ray/tests``:
413410

414411
.. code-block:: shell
415412
416413
pip install -c python/requirements_compiled.txt -r python/requirements/test-requirements.txt
417414
418415
Requirement files for running Ray Data / ML library tests are under ``python/requirements/``.
419416

420-
Pre-commit Hooks
417+
Pre-commit hooks
421418
~~~~~~~~~~~~~~~~
422419

423420
Ray uses pre-commit hooks with `the pre-commit python package <https://pre-commit.com/>`_.
@@ -429,7 +426,7 @@ To start using ``pre-commit``:
429426
pip install pre-commit
430427
pre-commit install
431428
432-
This will install pre-commit into the current environment, and enable pre-commit checks every time
429+
This installs pre-commit into the current environment and enables pre-commit checks every time
433430
you commit new code changes with git. To temporarily skip pre-commit checks, use the ``-n`` or
434431
``--no-verify`` flag when committing:
435432

@@ -442,7 +439,7 @@ If you encounter any issues with ``pre-commit``, please `report an issue here`_.
442439
.. _report an issue here: https://github.com/ray-project/ray/issues/new?template=bug-report.yml
443440

444441

445-
Building the Docs
442+
Building the docs
446443
-----------------
447444

448445
To learn more about building the docs refer to `Contributing to the Ray Documentation`_.
@@ -472,7 +469,7 @@ in this error:
472469
from . import _psutil_osx as cext
473470
ImportError: cannot import name '_psutil_osx' from partially initialized module 'psutil' (most likely due to a circular import) (.../ray/python/ray/thirdparty_files/psutil/__init__.py)
474471
475-
Then you should run the following commands:
472+
Run the following commands:
476473

477474
.. code-block:: bash
478475

0 commit comments

Comments
 (0)