Skip to main content

RAPIDS CLI

The RAPIDS CLI is a command line tool for performing common RAPIDS operations in a quick and scriptable way.

$ rapids --help

 Usage: rapids [OPTIONS] COMMAND [ARGS]...

 The Rapids CLI is a command-line interface for RAPIDS.

╭─ Options ───────────────────────────────────────────────────────────────────────────╮
│ --help      Show this message and exit.                                             │
╰─────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ──────────────────────────────────────────────────────────────────────────╮
│ doctor    Run health checks to ensure RAPIDS is installed correctly.                │
╰─────────────────────────────────────────────────────────────────────────────────────╯

RAPIDS Doctor

The rapids doctor subcommand performs health checks on installations of RAPIDS to ensure versions of the driver, CUDA, and other compiled dependencies are compatible with each other.

The core command has checks based on the standard setup requirements. Other packages in the RAPIDS ecosystem can also register additional checks via a plugin system.

$ rapids doctor
🧑‍⚕️ Performing REQUIRED health check for RAPIDS
All checks passed!

Developing

# Install and activate a RAPIDS environment E.g
conda create -y -n rapids-25.06 -c rapidsai -c conda-forge rapids=25.06 python=3.13 'cuda-version>=12.0,<=12.8'
conda activate rapids-25.06

# Install the RAPIDS CLI
git clone git@github.com:rapidsai/rapids-cli.git
cd rapids-cli
pip install -e .

# Run rapids doctor
rapids doctor
# 🧑‍⚕️ Performing REQUIRED health check for RAPIDS
# All checks passed!

Testing

# Install test dependencies
pip install -e .[test]

# Run pytest
pytest
# ========================= test session starts ==========================
# platform linux -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0
# rootdir: /home/jtomlinson/Projects/rapids/rapids-cli
# configfile: pyproject.toml
# plugins: anyio-4.8.0
# collected 2 items
#
# rapids_cli/tests/test_cuda.py ..
# ========================== 2 passed in 0.08s ==========================

Check plugins

Any project can add checks to rapids doctor by exposing a function via an entrypoint.

These checks would live in existing RAPIDS libraries like cudf, cuml or cugraph, but for an example let's create a summy package.

$ hatch new doctor-check-example
doctor-check-example
├── src
│   └── doctor_check_example
│       ├── __about__.py
│       └── __init__.py
├── tests
│   └── __init__.py
├── LICENSE.txt
├── README.md
└── pyproject.toml

$ cd doctor-check-example

Then let's create a new file in our package and create a simple check function.

# src/doctor_check_example/check.py
def my_awesome_check(**kwargs):
    """A quick check to ensure we can import cudf and create a GPU memory resource."""
    import cudf

    s = cudf.Series([1, 2, 3, None, 4])
    assert isinstance(s, cudf.core.series.Series)

Then we need to register this function with rapids doctor by adding an entrypoint to pyproject.toml.

# pyproject.toml
# ...

[project.entry-points.rapids_doctor_check]
quick_cudf_check = "doctor_check_example.check:my_awesome_check"

Now we can install our new package, which will register the entrypoint.

$ pip install -e .
Successfully installed doctor-check-example-0.0.1

Then if we run rapids doctor with the --verbose flag we can see our new check is discovered and included in our list of checks.

$ rapids doctor --verbose
🧑‍⚕️ Performing REQUIRED health check for RAPIDS
Discovering checks
Found check 'quick_cudf_check' provided by 'doctor_check_example.check:my_awesome_check'
...
Discovered 14 checks
Running checks
All checks passed!

Check status

If a check function returns successfully it is assumed the check was successful, regardless of what was returned.

To fail a test an exception should be raised, ideally with a helpful message that gives the user actionable next steps to resolve the problem. It may be helpful to catch a common exception and reraise it with a more helpful error message.

# src/doctor_check_example/check.py
def my_awesome_check(**kwargs):
    """A quick check to ensure we can import cudf and create a GPU memory resource."""
    try:
        import cudf
    except ImportError as e:
        raise ImportError(
            "Module cudf not found. Tip: you can install it with `pip install cudf-cu12`"
        ) from e
    s = cudf.Series([1, 2, 3, None, 4])
    assert isinstance(s, cudf.core.series.Series)

Warnings

You can also raise warnings from within your test. These will not cause the test to fail, but warnings will be caught and presented to the user.

$ rapids doctor
🧑‍⚕️ Performing REQUIRED health check for RAPIDS
Warning: System Memory to total GPU Memory ratio not at least 2:1 ratio.
It is recommended to have double the system memory to GPU memory for optimal performance.
All checks passed!

Check keyword arguments

When calling a check function a number of keyword arguments will be passed. The list of keywords may change over time so it is recommended to always pack unknown kwargs with **kwargs to ensure forward compatibility.

def my_awesome_check(**kwargs):
    pass

Keyword arguments may be added in the future, but never removed, so it's safe to explicitly accept keywords you know you want to use.

def my_awesome_check(
    verbose=False,  # Has the --verbose flag been set
    **kwargs,
):
    if verbose:
        print("Print additional messages in here")

Metadata

Release files for rapids-cli 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for rapids-cli 0.2.0
File Interpreter ABI Platform
rapids_cli-0.2.0-py3-none-any.whl Python 3 none any Details

Release files / rapids_cli-0.2.0-py3-none-any.whl

Download URL rapids_cli-0.2.0-py3-none-any.whl
Size 38.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b7825e6916ea7da67a57c75fa18b1e0ca4c7d751de796de01991d31da34e10c
BLAKE2b-256 checksum
How to use checksums
ef084c55ea204251f234504d0abae2e8c9e490669f5f67b70a7ca1c2271f2f34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.20

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page