Skip to content

Commit

Permalink
deprecate rmm._lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt711 committed Sep 16, 2024
1 parent afef539 commit 15b1ae1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
15 changes: 15 additions & 0 deletions python/rmm/rmm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,18 @@
"should_log",
"unregister_reinitialize_hook",
]


def __getattr__(name):
if name == "_lib":
import importlib
import warnings

warnings.warn(
"The `rmm._lib` module is deprecated in will be removed in a future release. Use `rmm.python` instead.",
FutureWarning,
)
module = importlib.import_module("rmm.python")
return module
else:
raise AttributeError(f"Module '{__name__}' has no attribute '{name}'")
22 changes: 22 additions & 0 deletions python/rmm/rmm/_lib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2018-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import warnings

warnings.warn(
"The `rmm._lib` module is deprecated in will be removed in a future release. Use `rmm.python` instead.",
FutureWarning,
)

from rmm.python import *
5 changes: 5 additions & 0 deletions python/rmm/rmm/tests/test_rmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,3 +1076,8 @@ def test_available_device_memory():
assert initial_memory[1] == final_memory[1]
assert initial_memory[0] > 0
assert final_memory[0] > 0


def test_deprecate_rmm_lib():
with pytest.warns(FutureWarning):
rmm._lib.device_buffer.DeviceBuffer(size=100)

0 comments on commit 15b1ae1

Please sign in to comment.