From afd8196a27655efc2ef918d5bd2ddb0ccdd165e4 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Wed, 27 Nov 2024 16:55:38 -0800 Subject: [PATCH 1/9] Adopt updated version of pybind11-stubgen --- ci/conda/recipes/morpheus-libs/meta.yaml | 4 ++-- ci/conda/recipes/morpheus/meta.yaml | 2 +- conda/environments/all_cuda-125_arch-x86_64.yaml | 2 +- conda/environments/dev_cuda-125_arch-x86_64.yaml | 2 +- dependencies.yaml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ci/conda/recipes/morpheus-libs/meta.yaml b/ci/conda/recipes/morpheus-libs/meta.yaml index f6d88716b..d22b9d66e 100644 --- a/ci/conda/recipes/morpheus-libs/meta.yaml +++ b/ci/conda/recipes/morpheus-libs/meta.yaml @@ -69,7 +69,7 @@ outputs: - mrc {{ minor_version }} - nlohmann_json 3.11.* - pip - - pybind11-stubgen 0.10.5 + - pybind11-stubgen 2.4.2 - python {{ python }} - rapidjson 1.1.0 - scikit-build 0.17.6 @@ -214,7 +214,7 @@ outputs: - cython 3.0.* - glog >=0.7.1,<0.8 - pip - - pybind11-stubgen 0.10.5 + - pybind11-stubgen 2.4.2 - python {{ python }} - rapidjson 1.1.0 - scikit-build 0.17.6 diff --git a/ci/conda/recipes/morpheus/meta.yaml b/ci/conda/recipes/morpheus/meta.yaml index fd60e4924..41f4fbd78 100644 --- a/ci/conda/recipes/morpheus/meta.yaml +++ b/ci/conda/recipes/morpheus/meta.yaml @@ -74,7 +74,7 @@ outputs: - mrc {{ minor_version }} - nlohmann_json 3.11.* - pip - - pybind11-stubgen 0.10.5 + - pybind11-stubgen 2.4.2 - python {{ python }} - rapidjson 1.1.0 - rdma-core >=48 # Needed for DOCA. diff --git a/conda/environments/all_cuda-125_arch-x86_64.yaml b/conda/environments/all_cuda-125_arch-x86_64.yaml index ebbb3dffe..c10b34fc3 100644 --- a/conda/environments/all_cuda-125_arch-x86_64.yaml +++ b/conda/environments/all_cuda-125_arch-x86_64.yaml @@ -85,7 +85,7 @@ dependencies: - pkg-config=0.29 - pluggy=1.3 - pre-commit -- pybind11-stubgen=0.10.5 +- pybind11-stubgen=2.4.2 - pydantic - pylibcudf=24.10 - pylint=3.0.3 diff --git a/conda/environments/dev_cuda-125_arch-x86_64.yaml b/conda/environments/dev_cuda-125_arch-x86_64.yaml index 15bf6a0c1..1af2690dc 100644 --- a/conda/environments/dev_cuda-125_arch-x86_64.yaml +++ b/conda/environments/dev_cuda-125_arch-x86_64.yaml @@ -70,7 +70,7 @@ dependencies: - pkg-config=0.29 - pluggy=1.3 - pre-commit -- pybind11-stubgen=0.10.5 +- pybind11-stubgen=2.4.2 - pydantic - pylibcudf=24.10 - pylint=3.0.3 diff --git a/dependencies.yaml b/dependencies.yaml index 1f9941ad3..15e388723 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -299,7 +299,7 @@ dependencies: - libzlib >=1.3.1,<2 - mrc=25.02 - nlohmann_json=3.11 - - pybind11-stubgen=0.10.5 + - pybind11-stubgen=2.4.2 - pylibcudf=24.10 - rapidjson=1.1.0 - rdma-core>=48 # Needed for DOCA. From b330e29b4cdfa5c6eb77b4959146647002972de9 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Wed, 27 Nov 2024 17:22:26 -0800 Subject: [PATCH 2/9] Import needed enums into the module, use py::arg_v to define the enum default values --- .../morpheus/morpheus/_lib/common/module.cpp | 11 ++++++-- .../morpheus/morpheus/_lib/stages/module.cpp | 28 +++++++++++-------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/python/morpheus/morpheus/_lib/common/module.cpp b/python/morpheus/morpheus/_lib/common/module.cpp index d12d53120..bee041c0b 100644 --- a/python/morpheus/morpheus/_lib/common/module.cpp +++ b/python/morpheus/morpheus/_lib/common/module.cpp @@ -54,7 +54,7 @@ PYBIND11_MODULE(common, _module) { _module.doc() = R"pbdoc( ----------------------- - .. currentmodule:: morpheus.common + .. currentmodule:: morpheus._lib.common .. autosummary:: :toctree: _generate )pbdoc"; @@ -132,17 +132,22 @@ PYBIND11_MODULE(common, _module) return DType(tid).is_fully_supported(); }); + // Using py::arg_v style for default arguments where the default is a C++ enum + // ref https://pybind11.readthedocs.io/en/latest/advanced/functions.html#default-arguments-revisited _module.def( "determine_file_type", py::overload_cast(&determine_file_type), py::arg("filename")); _module.def("determine_file_type", py::overload_cast(&determine_file_type), py::arg("filename")); - _module.def("read_file_to_df", &read_file_to_df, py::arg("filename"), py::arg("file_type") = FileTypes::Auto); + _module.def("read_file_to_df", + &read_file_to_df, + py::arg("filename"), + py::arg_v("file_type", FileTypes::Auto, "FileTypes.Auto")); _module.def("write_df_to_file", &SerializersProxy::write_df_to_file, py::arg("df"), py::arg("filename"), - py::arg("file_type") = FileTypes::Auto); + py::arg_v("file_type", FileTypes::Auto, "FileTypes.Auto")); py::enum_( _module, "FilterSource", "Enum to indicate which source the FilterDetectionsStage should operate on.") diff --git a/python/morpheus/morpheus/_lib/stages/module.cpp b/python/morpheus/morpheus/_lib/stages/module.cpp index fdda9d34b..f6bbff29a 100644 --- a/python/morpheus/morpheus/_lib/stages/module.cpp +++ b/python/morpheus/morpheus/_lib/stages/module.cpp @@ -35,8 +35,8 @@ #include "morpheus/utilities/http_server.hpp" // for DefaultMaxPayloadSize #include "morpheus/version.hpp" // for morpheus_VERSION_MAJOR, morpheus_VERSION_MINOR, morp... -#include // for Color -#include // for FontStyle +#include // for Color +#include // for FontStyle #include // for Builder #include // for Object, ObjectProperties #include // for MRC_CONCAT_STR @@ -61,7 +61,7 @@ PYBIND11_MODULE(stages, _module) { _module.doc() = R"pbdoc( ----------------------- - .. currentmodule:: morpheus.stages + .. currentmodule:: morpheus._lib.stages .. autosummary:: :toctree: _generate @@ -73,7 +73,11 @@ PYBIND11_MODULE(stages, _module) // Import the mrc coro module mrc::pymrc::import(_module, "mrc.core.coro"); - mrc::pymrc::from_import(_module, "morpheus._lib.common", "FilterSource"); + // Import enums which are used as default argument values all of which require using py::arg_v + // ref https://pybind11.readthedocs.io/en/latest/advanced/functions.html#default-arguments-revisited + mrc::pymrc::from_import(_module, "morpheus._lib.common", "FileTypes"); + mrc::pymrc::from_import(_module, "morpheus._lib.common", "IndicatorsFontStyle"); + mrc::pymrc::from_import(_module, "morpheus._lib.common", "IndicatorsTextColor"); py::class_, mrc::segment::ObjectProperties, @@ -200,9 +204,9 @@ PYBIND11_MODULE(stages, _module) py::arg("builder"), py::arg("name"), py::arg("description"), - py::arg("unit") = "messages", - py::arg("text_color") = indicators::Color::cyan, - py::arg("font_style") = indicators::FontStyle::bold, + py::arg("unit") = "messages", + py::arg_v("text_color", indicators::Color::cyan, "IndicatorsTextColor.cyan"), + py::arg_v("font_style", indicators::FontStyle::bold, "IndicatorsFontStyle.bold"), py::arg("determine_count_fn") = py::none()); py::class_>, @@ -213,9 +217,9 @@ PYBIND11_MODULE(stages, _module) py::arg("builder"), py::arg("name"), py::arg("description"), - py::arg("unit") = "messages", - py::arg("text_color") = indicators::Color::cyan, - py::arg("font_style") = indicators::FontStyle::bold, + py::arg("unit") = "messages", + py::arg_v("text_color", indicators::Color::cyan, "IndicatorsTextColor.cyan"), + py::arg_v("font_style", indicators::FontStyle::bold, "IndicatorsFontStyle.bold"), py::arg("determine_count_fn") = py::none()); py::class_>, @@ -331,8 +335,8 @@ PYBIND11_MODULE(stages, _module) py::arg("builder"), py::arg("name"), py::arg("filename"), - py::arg("mode") = "w", - py::arg("file_type") = FileTypes::Auto, + py::arg("mode") = "w", + py::arg_v("file_type", FileTypes::Auto, "FileTypes.Auto"), py::arg("include_index_col") = true, py::arg("flush") = false); From dd957fed8046f56cac804c2eb03d5b0e31d04f77 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Mon, 2 Dec 2024 15:15:01 -0800 Subject: [PATCH 3/9] Fix module docstring --- python/morpheus/morpheus/_lib/modules/module.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/morpheus/morpheus/_lib/modules/module.cpp b/python/morpheus/morpheus/_lib/modules/module.cpp index 1c7dc4811..24b53988f 100644 --- a/python/morpheus/morpheus/_lib/modules/module.cpp +++ b/python/morpheus/morpheus/_lib/modules/module.cpp @@ -33,7 +33,7 @@ PYBIND11_MODULE(modules, _module) { _module.doc() = R"pbdoc( ----------------------- - .. currentmodule:: morpheus.modules + .. currentmodule:: morpheus._lib.modules .. autosummary:: :toctree: _generate From fc65f56d827fa6a384cd705aacf90d1149f80f76 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Mon, 2 Dec 2024 16:15:10 -0800 Subject: [PATCH 4/9] Set MODULE_ROOT --- .../3_simple_cpp_stage/src/simple_cpp_stage/_lib/CMakeLists.txt | 2 ++ .../src/rabbitmq_cpp_stage/_lib/CMakeLists.txt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/examples/developer_guide/3_simple_cpp_stage/src/simple_cpp_stage/_lib/CMakeLists.txt b/examples/developer_guide/3_simple_cpp_stage/src/simple_cpp_stage/_lib/CMakeLists.txt index 330142443..f09d72bb5 100644 --- a/examples/developer_guide/3_simple_cpp_stage/src/simple_cpp_stage/_lib/CMakeLists.txt +++ b/examples/developer_guide/3_simple_cpp_stage/src/simple_cpp_stage/_lib/CMakeLists.txt @@ -16,6 +16,8 @@ list(APPEND CMAKE_MESSAGE_CONTEXT "pass_thru_cpp_stage") morpheus_add_pybind11_module(pass_thru_cpp + MODULE_ROOT + ${CMAKE_CURRENT_SOURCE_DIR} SOURCE_FILES "pass_thru.cpp" INCLUDE_DIRS diff --git a/examples/developer_guide/4_rabbitmq_cpp_stage/src/rabbitmq_cpp_stage/_lib/CMakeLists.txt b/examples/developer_guide/4_rabbitmq_cpp_stage/src/rabbitmq_cpp_stage/_lib/CMakeLists.txt index 0f3c768db..e20eb794c 100644 --- a/examples/developer_guide/4_rabbitmq_cpp_stage/src/rabbitmq_cpp_stage/_lib/CMakeLists.txt +++ b/examples/developer_guide/4_rabbitmq_cpp_stage/src/rabbitmq_cpp_stage/_lib/CMakeLists.txt @@ -16,6 +16,8 @@ list(APPEND CMAKE_MESSAGE_CONTEXT "rabbitmq_cpp_stage") morpheus_add_pybind11_module(rabbitmq_cpp_stage + MODULE_ROOT + ${CMAKE_CURRENT_SOURCE_DIR} SOURCE_FILES "rabbitmq_source.cpp" INCLUDE_DIRS From 077af52aefa45813ced629ccf7f65cfb83b69d4b Mon Sep 17 00:00:00 2001 From: David Gardner Date: Mon, 2 Dec 2024 16:46:17 -0800 Subject: [PATCH 5/9] Updated stubs --- .../_lib/pass_thru_cpp/__init__.pyi | 14 +- .../_lib/rabbitmq_cpp_stage/__init__.pyi | 14 +- .../morpheus/_lib/common/__init__.pyi | 479 +++++++++--------- .../morpheus/_lib/cudf_helpers/__init__.pyi | 29 +- .../morpheus/_lib/messages/__init__.pyi | 407 +++++++-------- .../morpheus/_lib/modules/__init__.pyi | 17 +- .../morpheus/_lib/stages/__init__.pyi | 114 ++--- .../morpheus_llm/_lib/llm/__init__.pyi | 333 ++++++------ 8 files changed, 670 insertions(+), 737 deletions(-) diff --git a/examples/developer_guide/3_simple_cpp_stage/src/simple_cpp_stage/_lib/pass_thru_cpp/__init__.pyi b/examples/developer_guide/3_simple_cpp_stage/src/simple_cpp_stage/_lib/pass_thru_cpp/__init__.pyi index 566d38fa3..6822075a4 100644 --- a/examples/developer_guide/3_simple_cpp_stage/src/simple_cpp_stage/_lib/pass_thru_cpp/__init__.pyi +++ b/examples/developer_guide/3_simple_cpp_stage/src/simple_cpp_stage/_lib/pass_thru_cpp/__init__.pyi @@ -1,14 +1,6 @@ from __future__ import annotations -import src.simple_cpp_stage._lib.pass_thru_cpp -import typing -import morpheus._lib.messages import mrc.core.segment - -__all__ = [ - "PassThruStage" -] - - +__all__ = ['PassThruStage'] class PassThruStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str) -> None: + ... diff --git a/examples/developer_guide/4_rabbitmq_cpp_stage/src/rabbitmq_cpp_stage/_lib/rabbitmq_cpp_stage/__init__.pyi b/examples/developer_guide/4_rabbitmq_cpp_stage/src/rabbitmq_cpp_stage/_lib/rabbitmq_cpp_stage/__init__.pyi index 93e02914b..d64e746cc 100644 --- a/examples/developer_guide/4_rabbitmq_cpp_stage/src/rabbitmq_cpp_stage/_lib/rabbitmq_cpp_stage/__init__.pyi +++ b/examples/developer_guide/4_rabbitmq_cpp_stage/src/rabbitmq_cpp_stage/_lib/rabbitmq_cpp_stage/__init__.pyi @@ -1,15 +1,7 @@ from __future__ import annotations -import src.rabbitmq_cpp_stage._lib.rabbitmq_cpp_stage -import typing import datetime -import morpheus._lib.messages import mrc.core.segment - -__all__ = [ - "RabbitMQSourceStage" -] - - +__all__ = ['RabbitMQSourceStage'] class RabbitMQSourceStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, host: str, exchange: str, exchange_type: str = 'fanout', queue_name: str = '', poll_interval: datetime.timedelta = datetime.timedelta(microseconds=100000)) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, host: str, exchange: str, exchange_type: str = 'fanout', queue_name: str = '', poll_interval: datetime.timedelta = ...) -> None: + ... diff --git a/python/morpheus/morpheus/_lib/common/__init__.pyi b/python/morpheus/morpheus/_lib/common/__init__.pyi index d64f663d2..38ff03721 100644 --- a/python/morpheus/morpheus/_lib/common/__init__.pyi +++ b/python/morpheus/morpheus/_lib/common/__init__.pyi @@ -1,316 +1,339 @@ """ + ----------------------- - .. currentmodule:: morpheus.common + .. currentmodule:: morpheus._lib.common .. autosummary:: :toctree: _generate - """ + +""" from __future__ import annotations -import morpheus._lib.common -import typing import os - -__all__ = [ - "FiberQueue", - "FileTypes", - "FilterSource", - "HttpEndpoint", - "HttpServer", - "IndicatorsFontStyle", - "IndicatorsTextColor", - "Tensor", - "TypeId", - "determine_file_type", - "read_file_to_df", - "typeid_is_fully_supported", - "typeid_to_numpy_str", - "write_df_to_file" -] - - -class FiberQueue(): - def __enter__(self) -> FiberQueue: ... - def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ... - def __init__(self, max_size: int) -> None: ... - def close(self) -> None: ... - def get(self, block: bool = True, timeout: float = 0.0) -> object: ... - def is_closed(self) -> bool: ... - def put(self, item: object, block: bool = True, timeout: float = 0.0) -> None: ... - pass -class FileTypes(): +import typing +__all__ = ['FiberQueue', 'FileTypes', 'FilterSource', 'HttpEndpoint', 'HttpServer', 'IndicatorsFontStyle', 'IndicatorsTextColor', 'Tensor', 'TypeId', 'determine_file_type', 'read_file_to_df', 'typeid_is_fully_supported', 'typeid_to_numpy_str', 'write_df_to_file'] +class FiberQueue: + def __enter__(self) -> FiberQueue: + ... + def __exit__(self, arg0: typing.Any, arg1: typing.Any, arg2: typing.Any) -> None: + ... + def __init__(self, max_size: int) -> None: + ... + def close(self) -> None: + ... + def get(self, block: bool = True, timeout: float = 0.0) -> typing.Any: + ... + def is_closed(self) -> bool: + ... + def put(self, item: typing.Any, block: bool = True, timeout: float = 0.0) -> None: + ... +class FileTypes: """ The type of files that the `FileSourceStage` can read and `WriteToFileStage` can write. Use 'auto' to determine from the file extension. - + Members: - + Auto - + JSON - + CSV - + PARQUET """ - def __eq__(self, other: object) -> bool: ... - def __getstate__(self) -> int: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __init__(self, value: int) -> None: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - def __repr__(self) -> str: ... - def __setstate__(self, state: int) -> None: ... + Auto: typing.ClassVar[FileTypes] # value = + CSV: typing.ClassVar[FileTypes] # value = + JSON: typing.ClassVar[FileTypes] # value = + PARQUET: typing.ClassVar[FileTypes] # value = + __members__: typing.ClassVar[dict[str, FileTypes]] # value = {'Auto': , 'JSON': , 'CSV': , 'PARQUET': } + def __eq__(self, other: typing.Any) -> bool: + ... + def __getstate__(self) -> int: + ... + def __hash__(self) -> int: + ... + def __index__(self) -> int: + ... + def __init__(self, value: int) -> None: + ... + def __int__(self) -> int: + ... + def __ne__(self, other: typing.Any) -> bool: + ... + def __repr__(self) -> str: + ... + def __setstate__(self, state: int) -> None: + ... + def __str__(self) -> str: + ... @property def name(self) -> str: - """ - :type: str - """ + ... @property def value(self) -> int: - """ - :type: int - """ - Auto: morpheus._lib.common.FileTypes # value = - CSV: morpheus._lib.common.FileTypes # value = - JSON: morpheus._lib.common.FileTypes # value = - PARQUET: morpheus._lib.common.FileTypes # value = - __members__: dict # value = {'Auto': , 'JSON': , 'CSV': , 'PARQUET': } - pass -class FilterSource(): + ... +class FilterSource: """ Enum to indicate which source the FilterDetectionsStage should operate on. - + Members: - + Auto - + TENSOR - + DATAFRAME """ - def __eq__(self, other: object) -> bool: ... - def __getstate__(self) -> int: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __init__(self, value: int) -> None: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - def __repr__(self) -> str: ... - def __setstate__(self, state: int) -> None: ... + Auto: typing.ClassVar[FilterSource] # value = + DATAFRAME: typing.ClassVar[FilterSource] # value = + TENSOR: typing.ClassVar[FilterSource] # value = + __members__: typing.ClassVar[dict[str, FilterSource]] # value = {'Auto': , 'TENSOR': , 'DATAFRAME': } + def __eq__(self, other: typing.Any) -> bool: + ... + def __getstate__(self) -> int: + ... + def __hash__(self) -> int: + ... + def __index__(self) -> int: + ... + def __init__(self, value: int) -> None: + ... + def __int__(self) -> int: + ... + def __ne__(self, other: typing.Any) -> bool: + ... + def __repr__(self) -> str: + ... + def __setstate__(self, state: int) -> None: + ... + def __str__(self) -> str: + ... @property def name(self) -> str: - """ - :type: str - """ + ... @property def value(self) -> int: - """ - :type: int - """ - Auto: morpheus._lib.common.FilterSource # value = - DATAFRAME: morpheus._lib.common.FilterSource # value = - TENSOR: morpheus._lib.common.FilterSource # value = - __members__: dict # value = {'Auto': , 'TENSOR': , 'DATAFRAME': } - pass -class HttpEndpoint(): - def __init__(self, py_parse_fn: function, url: str, method: str, include_headers: bool = False) -> None: ... - pass -class HttpServer(): - def __enter__(self) -> HttpServer: ... - def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ... - def __init__(self, endpoints: typing.List[HttpEndpoint], bind_address: str = '127.0.0.1', port: int = 8080, num_threads: int = 1, max_payload_size: int = 10485760, request_timeout: int = 30) -> None: ... - def is_running(self) -> bool: ... - def start(self) -> None: ... - def stop(self) -> None: ... - pass -class IndicatorsFontStyle(): + ... +class HttpEndpoint: + def __init__(self, py_parse_fn: typing.Callable, url: str, method: str, include_headers: bool = False) -> None: + ... +class HttpServer: + def __enter__(self) -> HttpServer: + ... + def __exit__(self, arg0: typing.Any, arg1: typing.Any, arg2: typing.Any) -> None: + ... + def __init__(self, endpoints: list[HttpEndpoint], bind_address: str = '127.0.0.1', port: int = 8080, num_threads: int = 1, max_payload_size: int = 10485760, request_timeout: int = 30) -> None: + ... + def is_running(self) -> bool: + ... + def start(self) -> None: + ... + def stop(self) -> None: + ... +class IndicatorsFontStyle: """ Members: - + bold - + dark - + italic - + underline - + blink - + reverse - + concealed - + crossed """ - def __eq__(self, other: object) -> bool: ... - def __getstate__(self) -> int: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __init__(self, value: int) -> None: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - def __repr__(self) -> str: ... - def __setstate__(self, state: int) -> None: ... + __members__: typing.ClassVar[dict[str, IndicatorsFontStyle]] # value = {'bold': , 'dark': , 'italic': , 'underline': , 'blink': , 'reverse': , 'concealed': , 'crossed': } + blink: typing.ClassVar[IndicatorsFontStyle] # value = + bold: typing.ClassVar[IndicatorsFontStyle] # value = + concealed: typing.ClassVar[IndicatorsFontStyle] # value = + crossed: typing.ClassVar[IndicatorsFontStyle] # value = + dark: typing.ClassVar[IndicatorsFontStyle] # value = + italic: typing.ClassVar[IndicatorsFontStyle] # value = + reverse: typing.ClassVar[IndicatorsFontStyle] # value = + underline: typing.ClassVar[IndicatorsFontStyle] # value = + def __eq__(self, other: typing.Any) -> bool: + ... + def __getstate__(self) -> int: + ... + def __hash__(self) -> int: + ... + def __index__(self) -> int: + ... + def __init__(self, value: int) -> None: + ... + def __int__(self) -> int: + ... + def __ne__(self, other: typing.Any) -> bool: + ... + def __repr__(self) -> str: + ... + def __setstate__(self, state: int) -> None: + ... + def __str__(self) -> str: + ... @property def name(self) -> str: - """ - :type: str - """ + ... @property def value(self) -> int: - """ - :type: int - """ - __members__: dict # value = {'bold': , 'dark': , 'italic': , 'underline': , 'blink': , 'reverse': , 'concealed': , 'crossed': } - blink: morpheus._lib.common.IndicatorsFontStyle # value = - bold: morpheus._lib.common.IndicatorsFontStyle # value = - concealed: morpheus._lib.common.IndicatorsFontStyle # value = - crossed: morpheus._lib.common.IndicatorsFontStyle # value = - dark: morpheus._lib.common.IndicatorsFontStyle # value = - italic: morpheus._lib.common.IndicatorsFontStyle # value = - reverse: morpheus._lib.common.IndicatorsFontStyle # value = - underline: morpheus._lib.common.IndicatorsFontStyle # value = - pass -class IndicatorsTextColor(): + ... +class IndicatorsTextColor: """ Members: - + grey - + red - + green - + yellow - + blue - + magenta - + cyan - + white - + unspecified """ - def __eq__(self, other: object) -> bool: ... - def __getstate__(self) -> int: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __init__(self, value: int) -> None: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - def __repr__(self) -> str: ... - def __setstate__(self, state: int) -> None: ... + __members__: typing.ClassVar[dict[str, IndicatorsTextColor]] # value = {'grey': , 'red': , 'green': , 'yellow': , 'blue': , 'magenta': , 'cyan': , 'white': , 'unspecified': } + blue: typing.ClassVar[IndicatorsTextColor] # value = + cyan: typing.ClassVar[IndicatorsTextColor] # value = + green: typing.ClassVar[IndicatorsTextColor] # value = + grey: typing.ClassVar[IndicatorsTextColor] # value = + magenta: typing.ClassVar[IndicatorsTextColor] # value = + red: typing.ClassVar[IndicatorsTextColor] # value = + unspecified: typing.ClassVar[IndicatorsTextColor] # value = + white: typing.ClassVar[IndicatorsTextColor] # value = + yellow: typing.ClassVar[IndicatorsTextColor] # value = + def __eq__(self, other: typing.Any) -> bool: + ... + def __getstate__(self) -> int: + ... + def __hash__(self) -> int: + ... + def __index__(self) -> int: + ... + def __init__(self, value: int) -> None: + ... + def __int__(self) -> int: + ... + def __ne__(self, other: typing.Any) -> bool: + ... + def __repr__(self) -> str: + ... + def __setstate__(self, state: int) -> None: + ... + def __str__(self) -> str: + ... @property def name(self) -> str: - """ - :type: str - """ + ... @property def value(self) -> int: - """ - :type: int - """ - __members__: dict # value = {'grey': , 'red': , 'green': , 'yellow': , 'blue': , 'magenta': , 'cyan': , 'white': , 'unspecified': } - blue: morpheus._lib.common.IndicatorsTextColor # value = - cyan: morpheus._lib.common.IndicatorsTextColor # value = - green: morpheus._lib.common.IndicatorsTextColor # value = - grey: morpheus._lib.common.IndicatorsTextColor # value = - magenta: morpheus._lib.common.IndicatorsTextColor # value = - red: morpheus._lib.common.IndicatorsTextColor # value = - unspecified: morpheus._lib.common.IndicatorsTextColor # value = - white: morpheus._lib.common.IndicatorsTextColor # value = - yellow: morpheus._lib.common.IndicatorsTextColor # value = - pass -class Tensor(): + ... +class Tensor: @staticmethod - def from_cupy(arg0: object) -> Tensor: ... - def to_cupy(self) -> object: ... + def from_cupy(arg0: typing.Any) -> Tensor: + ... + def to_cupy(self) -> typing.Any: + ... @property def __cuda_array_interface__(self) -> dict: - """ - :type: dict - """ - pass -class TypeId(): + ... +class TypeId: """ Supported Morpheus types - + Members: - + EMPTY - + INT8 - + INT16 - + INT32 - + INT64 - + UINT8 - + UINT16 - + UINT32 - + UINT64 - + FLOAT32 - + FLOAT64 - + BOOL8 - + STRING """ - def __eq__(self, other: object) -> bool: ... - def __getstate__(self) -> int: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __init__(self, value: int) -> None: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - def __repr__(self) -> str: ... - def __setstate__(self, state: int) -> None: ... + BOOL8: typing.ClassVar[TypeId] # value = + EMPTY: typing.ClassVar[TypeId] # value = + FLOAT32: typing.ClassVar[TypeId] # value = + FLOAT64: typing.ClassVar[TypeId] # value = + INT16: typing.ClassVar[TypeId] # value = + INT32: typing.ClassVar[TypeId] # value = + INT64: typing.ClassVar[TypeId] # value = + INT8: typing.ClassVar[TypeId] # value = + STRING: typing.ClassVar[TypeId] # value = + UINT16: typing.ClassVar[TypeId] # value = + UINT32: typing.ClassVar[TypeId] # value = + UINT64: typing.ClassVar[TypeId] # value = + UINT8: typing.ClassVar[TypeId] # value = + __members__: typing.ClassVar[dict[str, TypeId]] # value = {'EMPTY': , 'INT8': , 'INT16': , 'INT32': , 'INT64': , 'UINT8': , 'UINT16': , 'UINT32': , 'UINT64': , 'FLOAT32': , 'FLOAT64': , 'BOOL8': , 'STRING': } + def __eq__(self, other: typing.Any) -> bool: + ... + def __getstate__(self) -> int: + ... + def __hash__(self) -> int: + ... + def __index__(self) -> int: + ... + def __init__(self, value: int) -> None: + ... + def __int__(self) -> int: + ... + def __ne__(self, other: typing.Any) -> bool: + ... + def __repr__(self) -> str: + ... + def __setstate__(self, state: int) -> None: + ... + def __str__(self) -> str: + ... @property def name(self) -> str: - """ - :type: str - """ + ... @property def value(self) -> int: - """ - :type: int - """ - BOOL8: morpheus._lib.common.TypeId # value = - EMPTY: morpheus._lib.common.TypeId # value = - FLOAT32: morpheus._lib.common.TypeId # value = - FLOAT64: morpheus._lib.common.TypeId # value = - INT16: morpheus._lib.common.TypeId # value = - INT32: morpheus._lib.common.TypeId # value = - INT64: morpheus._lib.common.TypeId # value = - INT8: morpheus._lib.common.TypeId # value = - STRING: morpheus._lib.common.TypeId # value = - UINT16: morpheus._lib.common.TypeId # value = - UINT32: morpheus._lib.common.TypeId # value = - UINT64: morpheus._lib.common.TypeId # value = - UINT8: morpheus._lib.common.TypeId # value = - __members__: dict # value = {'EMPTY': , 'INT8': , 'INT16': , 'INT32': , 'INT64': , 'UINT8': , 'UINT16': , 'UINT32': , 'UINT64': , 'FLOAT32': , 'FLOAT64': , 'BOOL8': , 'STRING': } - pass -@typing.overload -def determine_file_type(filename: os.PathLike) -> FileTypes: - pass + ... @typing.overload def determine_file_type(filename: str) -> FileTypes: - pass -def read_file_to_df(filename: str, file_type: FileTypes = FileTypes.Auto) -> object: - pass + ... +@typing.overload +def determine_file_type(filename: os.PathLike) -> FileTypes: + ... +def read_file_to_df(filename: str, file_type: FileTypes = ...) -> typing.Any: + ... def typeid_is_fully_supported(arg0: TypeId) -> bool: - pass + ... def typeid_to_numpy_str(arg0: TypeId) -> str: - pass -def write_df_to_file(df: object, filename: str, file_type: FileTypes = FileTypes.Auto, **kwargs) -> None: - pass -__version__ = '25.2.0' + ... +def write_df_to_file(df: typing.Any, filename: str, file_type: FileTypes = ..., **kwargs) -> None: + ... +__version__: str = '25.2.0' diff --git a/python/morpheus/morpheus/_lib/cudf_helpers/__init__.pyi b/python/morpheus/morpheus/_lib/cudf_helpers/__init__.pyi index f4acdbedb..963a8d786 100644 --- a/python/morpheus/morpheus/_lib/cudf_helpers/__init__.pyi +++ b/python/morpheus/morpheus/_lib/cudf_helpers/__init__.pyi @@ -1,24 +1,13 @@ +from View.MemoryView import __pyx_unpickle_Enum from __future__ import annotations -import morpheus._lib.cudf_helpers -import typing +import builtins as __builtins__ +import cudf as cudf +from cudf._lib.null_mask import bitmask_allocation_size_bytes from cudf.core.buffer.exposure_tracked_buffer import ExposureTrackedBuffer from cudf.core.buffer.spillable_buffer import SpillableBuffer +from cudf.core.buffer.utils import as_buffer from cudf.core.dtypes import StructDtype -import _cython_3_0_11 -import cudf -import rmm - -__all__ = [ - "ExposureTrackedBuffer", - "SpillableBuffer", - "StructDtype", - "as_buffer", - "bitmask_allocation_size_bytes", - "cudf", - "rmm" -] - - -__pyx_capi__: dict # value = {'make_table_from_table_with_metadata': , 'make_table_from_table_info_data': , 'make_table_info_data_from_table': , 'data_from_table_view_indexed': } -__test__ = {} -bitmask_allocation_size_bytes: _cython_3_0_11.cython_function_or_method # value = +import rmm as rmm +__all__ = ['ExposureTrackedBuffer', 'SpillableBuffer', 'StructDtype', 'as_buffer', 'bitmask_allocation_size_bytes', 'cudf', 'rmm'] +__pyx_capi__: dict # value = {'make_table_from_table_with_metadata': , 'make_table_from_table_info_data': , 'make_table_info_data_from_table': , 'data_from_table_view_indexed': } +__test__: dict = {} diff --git a/python/morpheus/morpheus/_lib/messages/__init__.pyi b/python/morpheus/morpheus/_lib/messages/__init__.pyi index 11fba00ae..9d0d665a6 100644 --- a/python/morpheus/morpheus/_lib/messages/__init__.pyi +++ b/python/morpheus/morpheus/_lib/messages/__init__.pyi @@ -1,268 +1,249 @@ """ + ----------------------- .. currentmodule:: morpheus.messages .. autosummary:: :toctree: _generate - """ + +""" from __future__ import annotations -import morpheus._lib.messages +import cupy as cupy import typing -import cupy -import morpheus._lib.common -import mrc.core.node - -__all__ = [ - "ControlMessage", - "ControlMessageType", - "DataLoaderRegistry", - "DataTable", - "InferenceMemory", - "InferenceMemoryFIL", - "InferenceMemoryNLP", - "MessageMeta", - "MutableTableCtxMgr", - "RawPacketMessage", - "ResponseMemory", - "ResponseMemoryProbs", - "TensorMemory", - "cupy" -] - - -class ControlMessage(): +__all__ = ['ControlMessage', 'ControlMessageType', 'DataLoaderRegistry', 'DataTable', 'InferenceMemory', 'InferenceMemoryFIL', 'InferenceMemoryNLP', 'MessageMeta', 'MutableTableCtxMgr', 'RawPacketMessage', 'ResponseMemory', 'ResponseMemoryProbs', 'TensorMemory', 'cupy'] +class ControlMessage: @typing.overload - def __init__(self) -> None: ... + def __init__(self) -> None: + ... @typing.overload - def __init__(self, arg0: ControlMessage) -> None: ... + def __init__(self, arg0: ControlMessage) -> None: + ... @typing.overload - def __init__(self, arg0: object) -> None: ... - def add_task(self, task_type: str, task: object | None) -> None: ... + def __init__(self, arg0: typing.Any) -> None: + ... + def add_task(self, task_type: str, task: typing.Any | None) -> None: + ... @typing.overload - def config(self) -> object | None: ... + def config(self, config: typing.Any | None) -> None: + ... @typing.overload - def config(self, config: object | None) -> None: ... - def copy(self) -> ControlMessage: ... - def filter_timestamp(self, regex_filter: str) -> dict: + def config(self) -> typing.Any | None: + ... + def copy(self) -> ControlMessage: + ... + def filter_timestamp(self, regex_filter: str) -> dict: """ Retrieve timestamps matching a regex filter within a given group. """ - def get_metadata(self, key: object = None, default_value: object = None) -> object: ... - def get_tasks(self) -> object | None: ... - def get_timestamp(self, key: str, fail_if_nonexist: bool = False) -> object: + def get_metadata(self, key: typing.Any = None, default_value: typing.Any = None) -> typing.Any: + ... + def get_tasks(self) -> typing.Any | None: + ... + def get_timestamp(self, key: str, fail_if_nonexist: bool = False) -> typing.Any: """ Retrieve the timestamp for a given group and key. Returns None if the timestamp does not exist and fail_if_nonexist is False. """ - def get_timestamps(self) -> dict: ... - def has_metadata(self, key: str) -> bool: ... - def has_task(self, task_type: str) -> bool: ... - def list_metadata(self) -> list: ... - @typing.overload - def payload(self) -> MessageMeta: ... - @typing.overload - def payload(self, arg0: MessageMeta) -> None: ... - @typing.overload - def payload(self, meta: object) -> None: ... - def remove_task(self, task_type: str) -> object | None: ... - def set_metadata(self, key: str, value: object | None) -> None: ... - def set_timestamp(self, key: str, timestamp: object) -> None: + def get_timestamps(self) -> dict: + ... + def has_metadata(self, key: str) -> bool: + ... + def has_task(self, task_type: str) -> bool: + ... + def list_metadata(self) -> list: + ... + @typing.overload + def payload(self) -> MessageMeta: + ... + @typing.overload + def payload(self, arg0: MessageMeta) -> None: + ... + @typing.overload + def payload(self, meta: typing.Any) -> None: + ... + def remove_task(self, task_type: str) -> typing.Any | None: + ... + def set_metadata(self, key: str, value: typing.Any | None) -> None: + ... + def set_timestamp(self, key: str, timestamp: typing.Any) -> None: """ Set a timestamp for a given key and group. """ @typing.overload - def task_type(self) -> ControlMessageType: ... + def task_type(self) -> ControlMessageType: + ... @typing.overload - def task_type(self, task_type: ControlMessageType) -> None: ... + def task_type(self, task_type: ControlMessageType) -> None: + ... @typing.overload - def tensors(self) -> TensorMemory: ... + def tensors(self) -> TensorMemory: + ... @typing.overload - def tensors(self, arg0: TensorMemory) -> None: ... - pass -class ControlMessageType(): + def tensors(self, arg0: TensorMemory) -> None: + ... +class ControlMessageType: """ Members: - + INFERENCE - + NONE - + TRAINING """ - def __eq__(self, other: object) -> bool: ... - def __getstate__(self) -> int: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __init__(self, value: int) -> None: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - def __repr__(self) -> str: ... - def __setstate__(self, state: int) -> None: ... + INFERENCE: typing.ClassVar[ControlMessageType] # value = + NONE: typing.ClassVar[ControlMessageType] # value = + TRAINING: typing.ClassVar[ControlMessageType] # value = + __members__: typing.ClassVar[dict[str, ControlMessageType]] # value = {'INFERENCE': , 'NONE': , 'TRAINING': } + def __eq__(self, other: typing.Any) -> bool: + ... + def __getstate__(self) -> int: + ... + def __hash__(self) -> int: + ... + def __index__(self) -> int: + ... + def __init__(self, value: int) -> None: + ... + def __int__(self) -> int: + ... + def __ne__(self, other: typing.Any) -> bool: + ... + def __repr__(self) -> str: + ... + def __setstate__(self, state: int) -> None: + ... + def __str__(self) -> str: + ... @property def name(self) -> str: - """ - :type: str - """ + ... @property def value(self) -> int: - """ - :type: int - """ - INFERENCE: morpheus._lib.messages.ControlMessageType # value = - NONE: morpheus._lib.messages.ControlMessageType # value = - TRAINING: morpheus._lib.messages.ControlMessageType # value = - __members__: dict # value = {'INFERENCE': , 'NONE': , 'TRAINING': } - pass -class DataLoaderRegistry(): + ... +class DataLoaderRegistry: @staticmethod - def contains(name: str) -> bool: ... + def contains(name: str) -> bool: + ... @staticmethod - def list() -> typing.List[str]: ... + def list() -> list[str]: + ... @staticmethod - def register_loader(name: str, loader: typing.Callable[[ControlMessage, dict], ControlMessage], throw_if_exists: bool = True) -> None: ... + def register_loader(name: str, loader: typing.Callable[[ControlMessage, dict], ControlMessage], throw_if_exists: bool = True) -> None: + ... @staticmethod - def unregister_loader(name: str, throw_if_not_exists: bool = True) -> None: ... - pass -class DataTable(): - pass -class TensorMemory(): - def __init__(self, *, count: int, tensors: object = None) -> None: ... - def get_tensor(self, name: str) -> object: ... - def get_tensors(self) -> typing.Dict[str, object]: ... - def has_tensor(self, arg0: str) -> bool: ... - def set_tensor(self, name: str, tensor: object) -> None: ... - def set_tensors(self, tensors: typing.Dict[str, object]) -> None: ... - @property - def count(self) -> int: - """ - :type: int - """ - @property - def tensor_names(self) -> typing.List[str]: - """ - :type: typing.List[str] - """ + def unregister_loader(name: str, throw_if_not_exists: bool = True) -> None: + ... +class DataTable: pass class InferenceMemory(TensorMemory): - def __init__(self, *, count: int, tensors: object = None) -> None: ... - def get_input(self, name: str) -> object: ... - def set_input(self, name: str, tensor: object) -> None: ... - pass -class InferenceMemoryNLP(InferenceMemory, TensorMemory): - def __init__(self, *, count: int, input_ids: object, input_mask: object, seq_ids: object) -> None: ... - @property - def input_ids(self) -> object: - """ - :type: object - """ - @input_ids.setter - def input_ids(self, arg1: object) -> None: - pass - @property - def input_mask(self) -> object: - """ - :type: object - """ - @input_mask.setter - def input_mask(self, arg1: object) -> None: - pass - @property - def seq_ids(self) -> object: - """ - :type: object - """ - @seq_ids.setter - def seq_ids(self, arg1: object) -> None: - pass - pass -class MessageMeta(): - def __init__(self, df: object) -> None: ... - def copy_dataframe(self) -> object: ... - def copy_ranges(self, ranges: typing.List[typing.Tuple[int, int]]) -> MessageMeta: ... - def ensure_sliceable_index(self) -> typing.Optional[str]: ... - def get_column_names(self) -> typing.List[str]: ... - @typing.overload - def get_data(self) -> object: ... - @typing.overload - def get_data(self, columns: None) -> object: ... - @typing.overload - def get_data(self, columns: str) -> object: ... - @typing.overload - def get_data(self, columns: typing.List[str]) -> object: ... - def get_slice(self, start: int, stop: int) -> MessageMeta: ... - def has_sliceable_index(self) -> bool: ... + def __init__(self, *, count: int, tensors: typing.Any = None) -> None: + ... + def get_input(self: TensorMemory, name: str) -> typing.Any: + ... + def set_input(self: TensorMemory, name: str, tensor: typing.Any) -> None: + ... +class InferenceMemoryFIL(InferenceMemory): + input__0: typing.Any + seq_ids: typing.Any + def __init__(self, *, count: int, input__0: typing.Any, seq_ids: typing.Any) -> None: + ... +class InferenceMemoryNLP(InferenceMemory): + input_ids: typing.Any + input_mask: typing.Any + seq_ids: typing.Any + def __init__(self, *, count: int, input_ids: typing.Any, input_mask: typing.Any, seq_ids: typing.Any) -> None: + ... +class MessageMeta: @staticmethod - def make_from_file(arg0: str) -> MessageMeta: ... - def mutable_dataframe(self) -> MutableTableCtxMgr: ... - def set_data(self, arg0: object, arg1: object) -> None: ... + def make_from_file(arg0: str) -> MessageMeta: + ... + def __init__(self, df: typing.Any) -> None: + ... + def copy_dataframe(self) -> typing.Any: + ... + def copy_ranges(self, ranges: list[tuple[int, int]]) -> MessageMeta: + ... + def ensure_sliceable_index(self) -> str | None: + ... + def get_column_names(self) -> list[str]: + ... + @typing.overload + def get_data(self) -> typing.Any: + ... + @typing.overload + def get_data(self, columns: str) -> typing.Any: + ... + @typing.overload + def get_data(self, columns: list[str]) -> typing.Any: + ... + @typing.overload + def get_data(self, columns: None) -> typing.Any: + ... + def get_slice(self, start: int, stop: int) -> MessageMeta: + ... + def has_sliceable_index(self) -> bool: + ... + def mutable_dataframe(self) -> MutableTableCtxMgr: + ... + def set_data(self, arg0: typing.Any, arg1: typing.Any) -> None: + ... @property def count(self) -> int: - """ - :type: int - """ + ... @property - def df(self) -> object: - """ - :type: object - """ - pass -class MutableTableCtxMgr(): - def __enter__(self) -> object: ... - def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ... - def __getattr__(self, *args, **kwargs) -> None: ... - def __getitem__(self, *args, **kwargs) -> None: ... - def __setattr__(self, *args, **kwargs) -> None: ... - def __setitem__(self, *args, **kwargs) -> None: ... - pass -class RawPacketMessage(): + def df(self) -> typing.Any: + ... +class MutableTableCtxMgr: + def __enter__(self) -> typing.Any: + ... + def __exit__(self, arg0: typing.Any, arg1: typing.Any, arg2: typing.Any) -> None: + ... + def __getattr__(self, *args, **kwargs) -> None: + ... + def __getitem__(self, *args, **kwargs) -> None: + ... + def __setattr__(self, *args, **kwargs) -> None: + ... + def __setitem__(self, *args, **kwargs) -> None: + ... +class RawPacketMessage: @property def gpu_mem(self) -> bool: - """ - :type: bool - """ + ... @property def max_size(self) -> int: - """ - :type: int - """ + ... @property def num(self) -> int: - """ - :type: int - """ - pass + ... class ResponseMemory(TensorMemory): - def __init__(self, *, count: int, tensors: object = None) -> None: ... - def get_output(self, name: str) -> object: ... - def set_output(self, name: str, tensor: object) -> None: ... - pass -class ResponseMemoryProbs(ResponseMemory, TensorMemory): - def __init__(self, *, count: int, probs: object) -> None: ... - @property - def probs(self) -> object: - """ - :type: object - """ - @probs.setter - def probs(self, arg1: object) -> None: - pass - pass -class InferenceMemoryFIL(InferenceMemory, TensorMemory): - def __init__(self, *, count: int, input__0: object, seq_ids: object) -> None: ... + def __init__(self, *, count: int, tensors: typing.Any = None) -> None: + ... + def get_output(self: TensorMemory, name: str) -> typing.Any: + ... + def set_output(self: TensorMemory, name: str, tensor: typing.Any) -> None: + ... +class ResponseMemoryProbs(ResponseMemory): + probs: typing.Any + def __init__(self, *, count: int, probs: typing.Any) -> None: + ... +class TensorMemory: + def __init__(self, *, count: int, tensors: typing.Any = None) -> None: + ... + def get_tensor(self, name: str) -> typing.Any: + ... + def get_tensors(self) -> dict[str, typing.Any]: + ... + def has_tensor(self, arg0: str) -> bool: + ... + def set_tensor(self, name: str, tensor: typing.Any) -> None: + ... + def set_tensors(self, tensors: dict[str, typing.Any]) -> None: + ... @property - def input__0(self) -> object: - """ - :type: object - """ - @input__0.setter - def input__0(self, arg1: object) -> None: - pass + def count(self) -> int: + ... @property - def seq_ids(self) -> object: - """ - :type: object - """ - @seq_ids.setter - def seq_ids(self, arg1: object) -> None: - pass - pass -__version__ = '25.2.0' + def tensor_names(self) -> list[str]: + ... +__version__: str = '25.2.0' diff --git a/python/morpheus/morpheus/_lib/modules/__init__.pyi b/python/morpheus/morpheus/_lib/modules/__init__.pyi index ed47a38d3..b192ce6e6 100644 --- a/python/morpheus/morpheus/_lib/modules/__init__.pyi +++ b/python/morpheus/morpheus/_lib/modules/__init__.pyi @@ -1,17 +1,12 @@ """ + ----------------------- - .. currentmodule:: morpheus.modules + .. currentmodule:: morpheus._lib.modules .. autosummary:: :toctree: _generate - """ + +""" from __future__ import annotations -import morpheus._lib.modules -import typing - -__all__ = [ - -] - - -__version__ = '25.2.0' +__all__ = list() +__version__: str = '25.2.0' diff --git a/python/morpheus/morpheus/_lib/stages/__init__.pyi b/python/morpheus/morpheus/_lib/stages/__init__.pyi index d99f70983..4a21aaf65 100644 --- a/python/morpheus/morpheus/_lib/stages/__init__.pyi +++ b/python/morpheus/morpheus/_lib/stages/__init__.pyi @@ -1,97 +1,79 @@ """ + ----------------------- - .. currentmodule:: morpheus.stages + .. currentmodule:: morpheus._lib.stages .. autosummary:: :toctree: _generate - """ + +""" from __future__ import annotations -import morpheus._lib.stages -import typing -from morpheus._lib.common import FilterSource import morpheus._lib.common +from morpheus._lib.common import FileTypes +from morpheus._lib.common import IndicatorsFontStyle +from morpheus._lib.common import IndicatorsTextColor import morpheus._lib.messages -import mrc.core.coro import mrc.core.segment import os - -__all__ = [ - "AddClassificationsStage", - "AddScoresStage", - "DeserializeStage", - "FileSourceStage", - "FilterDetectionsStage", - "FilterSource", - "HttpServerControlMessageSourceStage", - "HttpServerMessageMetaSourceStage", - "InferenceClientStage", - "KafkaSourceStage", - "MonitorControlMessageStage", - "MonitorMessageMetaStage", - "PreallocateControlMessageStage", - "PreallocateMessageMetaStage", - "PreprocessFILStage", - "PreprocessNLPStage", - "SerializeStage", - "WriteToFileStage" -] - - +import typing +__all__ = ['AddClassificationsStage', 'AddScoresStage', 'DeserializeStage', 'FileSourceStage', 'FileTypes', 'FilterDetectionsStage', 'HttpServerControlMessageSourceStage', 'HttpServerMessageMetaSourceStage', 'IndicatorsFontStyle', 'IndicatorsTextColor', 'InferenceClientStage', 'KafkaSourceStage', 'MonitorControlMessageStage', 'MonitorMessageMetaStage', 'PreallocateControlMessageStage', 'PreallocateMessageMetaStage', 'PreprocessFILStage', 'PreprocessNLPStage', 'SerializeStage', 'WriteToFileStage'] class AddClassificationsStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, idx2label: typing.Dict[int, str], threshold: float) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, idx2label: dict[int, str], threshold: float) -> None: + ... class AddScoresStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, idx2label: typing.Dict[int, str]) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, idx2label: dict[int, str]) -> None: + ... class DeserializeStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, batch_size: int, ensure_sliceable_index: bool = True, task_type: object = None, task_payload: object = None) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, batch_size: int, ensure_sliceable_index: bool = True, task_type: typing.Any = None, task_payload: typing.Any = None) -> None: + ... class FileSourceStage(mrc.core.segment.SegmentObject): @typing.overload - def __init__(self, builder: mrc.core.segment.Builder, name: str, filename: os.PathLike, repeat: int, filter_null: bool, filter_null_columns: typing.List[str], parser_kwargs: dict) -> None: ... + def __init__(self, builder: mrc.core.segment.Builder, name: str, filename: str, repeat: int, filter_null: bool, filter_null_columns: list[str], parser_kwargs: dict) -> None: + ... @typing.overload - def __init__(self, builder: mrc.core.segment.Builder, name: str, filename: str, repeat: int, filter_null: bool, filter_null_columns: typing.List[str], parser_kwargs: dict) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, filename: os.PathLike, repeat: int, filter_null: bool, filter_null_columns: list[str], parser_kwargs: dict) -> None: + ... class FilterDetectionsStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, threshold: float, copy: bool, filter_source: morpheus._lib.common.FilterSource, field_name: str = 'probs') -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, threshold: float, copy: bool, filter_source: morpheus._lib.common.FilterSource, field_name: str = 'probs') -> None: + ... class HttpServerControlMessageSourceStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, bind_address: str = '127.0.0.1', port: int = 8080, endpoint: str = '/message', live_endpoint: str = '/live', ready_endpoint: str = '/ready', method: str = 'POST', live_method: str = 'GET', ready_method: str = 'GET', accept_status: int = 201, sleep_time: float = 0.10000000149011612, queue_timeout: int = 5, max_queue_size: int = 1024, num_server_threads: int = 1, max_payload_size: int = 10485760, request_timeout: int = 30, lines: bool = False, stop_after: int = 0, task_type: object = None, task_payload: object = None) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, bind_address: str = '127.0.0.1', port: int = 8080, endpoint: str = '/message', live_endpoint: str = '/live', ready_endpoint: str = '/ready', method: str = 'POST', live_method: str = 'GET', ready_method: str = 'GET', accept_status: int = 201, sleep_time: float = 0.10000000149011612, queue_timeout: int = 5, max_queue_size: int = 1024, num_server_threads: int = 1, max_payload_size: int = 10485760, request_timeout: int = 30, lines: bool = False, stop_after: int = 0, task_type: typing.Any = None, task_payload: typing.Any = None) -> None: + ... class HttpServerMessageMetaSourceStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, bind_address: str = '127.0.0.1', port: int = 8080, endpoint: str = '/message', live_endpoint: str = '/live', ready_endpoint: str = '/ready', method: str = 'POST', live_method: str = 'GET', ready_method: str = 'GET', accept_status: int = 201, sleep_time: float = 0.10000000149011612, queue_timeout: int = 5, max_queue_size: int = 1024, num_server_threads: int = 1, max_payload_size: int = 10485760, request_timeout: int = 30, lines: bool = False, stop_after: int = 0) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, bind_address: str = '127.0.0.1', port: int = 8080, endpoint: str = '/message', live_endpoint: str = '/live', ready_endpoint: str = '/ready', method: str = 'POST', live_method: str = 'GET', ready_method: str = 'GET', accept_status: int = 201, sleep_time: float = 0.10000000149011612, queue_timeout: int = 5, max_queue_size: int = 1024, num_server_threads: int = 1, max_payload_size: int = 10485760, request_timeout: int = 30, lines: bool = False, stop_after: int = 0) -> None: + ... class InferenceClientStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, server_url: str, model_name: str, needs_logits: bool, force_convert_inputs: bool, input_mapping: typing.Dict[str, str] = {}, output_mapping: typing.Dict[str, str] = {}) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, server_url: str, model_name: str, needs_logits: bool, force_convert_inputs: bool, input_mapping: dict[str, str] = {}, output_mapping: dict[str, str] = {}) -> None: + ... class KafkaSourceStage(mrc.core.segment.SegmentObject): @typing.overload - def __init__(self, builder: mrc.core.segment.Builder, name: str, max_batch_size: int, topic: str, batch_timeout_ms: int, config: typing.Dict[str, str], disable_commits: bool = False, disable_pre_filtering: bool = False, stop_after: int = 0, async_commits: bool = True, oauth_callback: typing.Optional[function] = None) -> None: ... + def __init__(self, builder: mrc.core.segment.Builder, name: str, max_batch_size: int, topic: str, batch_timeout_ms: int, config: dict[str, str], disable_commits: bool = False, disable_pre_filtering: bool = False, stop_after: int = 0, async_commits: bool = True, oauth_callback: typing.Callable | None = None) -> None: + ... @typing.overload - def __init__(self, builder: mrc.core.segment.Builder, name: str, max_batch_size: int, topics: typing.List[str], batch_timeout_ms: int, config: typing.Dict[str, str], disable_commits: bool = False, disable_pre_filtering: bool = False, stop_after: int = 0, async_commits: bool = True, oauth_callback: typing.Optional[function] = None) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, max_batch_size: int, topics: list[str], batch_timeout_ms: int, config: dict[str, str], disable_commits: bool = False, disable_pre_filtering: bool = False, stop_after: int = 0, async_commits: bool = True, oauth_callback: typing.Callable | None = None) -> None: + ... class MonitorControlMessageStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, description: str, unit: str = 'messages', text_color: morpheus._lib.common.IndicatorsTextColor = IndicatorsTextColor.cyan, font_style: morpheus._lib.common.IndicatorsFontStyle = IndicatorsFontStyle.bold, determine_count_fn: typing.Optional[typing.Callable[[morpheus._lib.messages.ControlMessage], int]] = None) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, description: str, unit: str = 'messages', text_color: morpheus._lib.common.IndicatorsTextColor = ..., font_style: morpheus._lib.common.IndicatorsFontStyle = ..., determine_count_fn: typing.Callable[[morpheus._lib.messages.ControlMessage], int] | None = None) -> None: + ... class MonitorMessageMetaStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, description: str, unit: str = 'messages', text_color: morpheus._lib.common.IndicatorsTextColor = IndicatorsTextColor.cyan, font_style: morpheus._lib.common.IndicatorsFontStyle = IndicatorsFontStyle.bold, determine_count_fn: typing.Optional[typing.Callable[[morpheus._lib.messages.MessageMeta], int]] = None) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, description: str, unit: str = 'messages', text_color: morpheus._lib.common.IndicatorsTextColor = ..., font_style: morpheus._lib.common.IndicatorsFontStyle = ..., determine_count_fn: typing.Callable[[morpheus._lib.messages.MessageMeta], int] | None = None) -> None: + ... class PreallocateControlMessageStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, needed_columns: typing.List[typing.Tuple[str, morpheus._lib.common.TypeId]]) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, needed_columns: list[tuple[str, morpheus._lib.common.TypeId]]) -> None: + ... class PreallocateMessageMetaStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, needed_columns: typing.List[typing.Tuple[str, morpheus._lib.common.TypeId]]) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, needed_columns: list[tuple[str, morpheus._lib.common.TypeId]]) -> None: + ... class PreprocessFILStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, features: typing.List[str]) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, features: list[str]) -> None: + ... class PreprocessNLPStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, vocab_hash_file: str, sequence_length: int, truncation: bool, do_lower_case: bool, add_special_token: bool, stride: int, column: str) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, vocab_hash_file: str, sequence_length: int, truncation: bool, do_lower_case: bool, add_special_token: bool, stride: int, column: str) -> None: + ... class SerializeStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, include: typing.List[str], exclude: typing.List[str], fixed_columns: bool = True) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, include: list[str], exclude: list[str], fixed_columns: bool = True) -> None: + ... class WriteToFileStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, filename: str, mode: str = 'w', file_type: morpheus._lib.common.FileTypes = FileTypes.Auto, include_index_col: bool = True, flush: bool = False) -> None: ... - pass -__version__ = '25.2.0' + def __init__(self, builder: mrc.core.segment.Builder, name: str, filename: str, mode: str = 'w', file_type: morpheus._lib.common.FileTypes = ..., include_index_col: bool = True, flush: bool = False) -> None: + ... +__version__: str = '25.2.0' diff --git a/python/morpheus_llm/morpheus_llm/_lib/llm/__init__.pyi b/python/morpheus_llm/morpheus_llm/_lib/llm/__init__.pyi index 2f6f52add..a83714dd1 100644 --- a/python/morpheus_llm/morpheus_llm/_lib/llm/__init__.pyi +++ b/python/morpheus_llm/morpheus_llm/_lib/llm/__init__.pyi @@ -1,234 +1,213 @@ """ + ----------------------- .. currentmodule:: morpheus_llm.llm .. autosummary:: :toctree: _generate - """ + +""" from __future__ import annotations -import morpheus_llm._lib.llm -import typing import morpheus._lib.messages -import mrc.core.coro import mrc.core.segment - -__all__ = [ - "InputMap", - "LLMContext", - "LLMEngine", - "LLMEngineStage", - "LLMLambdaNode", - "LLMNode", - "LLMNodeBase", - "LLMNodeRunner", - "LLMTask", - "LLMTaskHandler" -] - - -class InputMap(): +import typing +__all__ = ['InputMap', 'LLMContext', 'LLMEngine', 'LLMEngineStage', 'LLMLambdaNode', 'LLMNode', 'LLMNodeBase', 'LLMNodeRunner', 'LLMTask', 'LLMTaskHandler'] +class InputMap: @typing.overload - def __init__(self) -> None: ... + def __init__(self) -> None: + ... @typing.overload - def __init__(self, external_name: str, internal_name: str) -> None: ... + def __init__(self, external_name: str, internal_name: str) -> None: + ... @property def external_name(self) -> str: """ The name of node that will be mapped to this input. Use a leading '/' to indicate it is a sibling node otherwise it will be treated as a parent node. Can also specify a specific node output such as '/sibling_node/output1' to map the output 'output1' of 'sibling_node' to this input. Can also use a wild card such as '/sibling_node/\*' to match all internal node names - - :type: str """ @external_name.setter def external_name(self, arg0: str) -> None: - """ - The name of node that will be mapped to this input. Use a leading '/' to indicate it is a sibling node otherwise it will be treated as a parent node. Can also specify a specific node output such as '/sibling_node/output1' to map the output 'output1' of 'sibling_node' to this input. Can also use a wild card such as '/sibling_node/\*' to match all internal node names - """ + ... @property def internal_name(self) -> str: """ The internal node name that the external node maps to. Must match an input returned from `get_input_names()` of the desired node. Defaults to '-' which is a placeholder for the default input of the node. Use a wildcard '\*' to match all inputs of the node (Must also use a wild card on the external mapping). - - :type: str """ @internal_name.setter def internal_name(self, arg0: str) -> None: - """ - The internal node name that the external node maps to. Must match an input returned from `get_input_names()` of the desired node. Defaults to '-' which is a placeholder for the default input of the node. Use a wildcard '\*' to match all inputs of the node (Must also use a wild card on the external mapping). - """ - pass -class LLMContext(): + ... +class LLMContext: @typing.overload - def __init__(self) -> None: ... + def __init__(self) -> None: + ... @typing.overload - def __init__(self, prent: LLMContext, name: str, inputs: typing.List[InputMap]) -> None: ... + def __init__(self, prent: LLMContext, name: str, inputs: list[InputMap]) -> None: + ... @typing.overload - def __init__(self, task: LLMTask, message: morpheus._lib.messages.ControlMessage) -> None: ... + def __init__(self, task: LLMTask, message: morpheus._lib.messages.ControlMessage) -> None: + ... @typing.overload - def get_input(self) -> object | None: ... + def get_input(self) -> typing.Any | None: + ... @typing.overload - def get_input(self, node_name: str) -> object | None: ... - def get_inputs(self) -> object | None: ... - def message(self) -> morpheus._lib.messages.ControlMessage: ... - def push(self, name: str, inputs: typing.List[InputMap]) -> LLMContext: ... + def get_input(self, node_name: str) -> typing.Any | None: + ... + def get_inputs(self) -> typing.Any | None: + ... + def message(self) -> morpheus._lib.messages.ControlMessage: + ... + def push(self, name: str, inputs: list[InputMap]) -> LLMContext: + ... @typing.overload - def set_output(self, output_name: str, output: object | None) -> None: ... + def set_output(self, outputs: typing.Any | None) -> None: + ... @typing.overload - def set_output(self, outputs: object | None) -> None: ... - def task(self) -> LLMTask: ... + def set_output(self, output_name: str, output: typing.Any | None) -> None: + ... + def task(self) -> LLMTask: + ... @property def full_name(self) -> str: - """ - :type: str - """ + ... @property - def input_map(self) -> typing.List[InputMap]: - """ - :type: typing.List[InputMap] - """ + def input_map(self) -> list[InputMap]: + ... @property def name(self) -> str: - """ - :type: str - """ + ... @property def parent(self) -> LLMContext: - """ - :type: LLMContext - """ + ... @property - def view_outputs(self) -> object | None: - """ - :type: object | None - """ - pass -class LLMNodeBase(): - def __init__(self) -> None: ... - def execute(self, context: LLMContext) -> typing.Awaitable[LLMContext]: - """ - Execute the current node with the given `context` instance. - - All inputs for the given node should be fetched from the context, typically by calling either - `context.get_inputs` to fetch all inputs as a `dict`, or `context.get_input` to fetch a specific input. - - Similarly the output of the node is written to the context using `context.set_output`. - - Parameters - ---------- - context : `morpheus._lib.llm.LLMContext` - Context instance to use for the execution - """ - def get_input_names(self) -> typing.List[str]: - """ - Get the input names for the node. - - Returns - ------- - list[str] - The input names for the node - """ - pass + def view_outputs(self) -> typing.Any | None: + ... +class LLMEngine(LLMNode): + def __init__(self) -> None: + ... + def add_task_handler(self, inputs: list[InputMap | str | tuple[str, str] | LLMNodeRunner], handler: LLMTaskHandler) -> None: + ... + def run(self, message: morpheus._lib.messages.ControlMessage) -> typing.Awaitable[list[morpheus._lib.messages.ControlMessage]]: + ... class LLMEngineStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, engine: LLMEngine) -> None: ... - pass + def __init__(self, builder: mrc.core.segment.Builder, name: str, engine: LLMEngine) -> None: + ... class LLMLambdaNode(LLMNodeBase): - def __init__(self, fn: function) -> None: ... - def execute(self, context: LLMContext) -> typing.Awaitable[LLMContext]: ... - def get_input_names(self) -> typing.List[str]: ... - pass + def __init__(self, fn: typing.Callable) -> None: + ... + def execute(self, context: LLMContext) -> typing.Awaitable[LLMContext]: + ... + def get_input_names(self) -> list[str]: + ... class LLMNode(LLMNodeBase): - def __init__(self) -> None: ... - def add_node(self, name: str, *, inputs: object = None, node: LLMNodeBase, is_output: bool = False) -> LLMNodeRunner: - """ - Add an LLMNode to the current node. - - Parameters - ---------- - name : str - The name of the node to add - - inputs : list[tuple[str, str]], optional - List of input mappings to use for the node, in the form of `[(external_name, internal_name), ...]` - If unspecified the node's input_names will be used. - - node : LLMNodeBase - The node to add - - is_output : bool, optional - Indicates if the node is an output node, by default False - """ - pass -class LLMEngine(LLMNode, LLMNodeBase): - def __init__(self) -> None: ... - def add_task_handler(self, inputs: typing.List[typing.Union[InputMap, str, typing.Tuple[str, str], LLMNodeRunner]], handler: LLMTaskHandler) -> None: ... - def run(self, message: morpheus._lib.messages.ControlMessage) -> typing.Awaitable[typing.List[morpheus._lib.messages.ControlMessage]]: ... - pass -class LLMNodeRunner(): - def execute(self, context: LLMContext) -> typing.Awaitable[LLMContext]: ... + def __init__(self) -> None: + ... + def add_node(self, name: str, *, inputs: typing.Any = None, node: LLMNodeBase, is_output: bool = False) -> LLMNodeRunner: + """ + Add an LLMNode to the current node. + + Parameters + ---------- + name : str + The name of the node to add + + inputs : list[tuple[str, str]], optional + List of input mappings to use for the node, in the form of `[(external_name, internal_name), ...]` + If unspecified the node's input_names will be used. + + node : LLMNodeBase + The node to add + + is_output : bool, optional + Indicates if the node is an output node, by default False + """ +class LLMNodeBase: + def __init__(self) -> None: + ... + def execute(self, context: LLMContext) -> typing.Awaitable[LLMContext]: + """ + Execute the current node with the given `context` instance. + + All inputs for the given node should be fetched from the context, typically by calling either + `context.get_inputs` to fetch all inputs as a `dict`, or `context.get_input` to fetch a specific input. + + Similarly the output of the node is written to the context using `context.set_output`. + + Parameters + ---------- + context : `morpheus._lib.llm.LLMContext` + Context instance to use for the execution + """ + def get_input_names(self) -> list[str]: + """ + Get the input names for the node. + + Returns + ------- + list[str] + The input names for the node + """ +class LLMNodeRunner: + def execute(self, context: LLMContext) -> typing.Awaitable[LLMContext]: + ... @property - def inputs(self) -> typing.List[InputMap]: - """ - :type: typing.List[InputMap] - """ + def inputs(self) -> list[InputMap]: + ... @property def name(self) -> str: - """ - :type: str - """ + ... @property - def parent_input_names(self) -> typing.List[str]: - """ - :type: typing.List[str] - """ + def parent_input_names(self) -> list[str]: + ... @property - def sibling_input_names(self) -> typing.List[str]: - """ - :type: typing.List[str] - """ - pass -class LLMTask(): - def __getitem__(self, key: str) -> object: ... + def sibling_input_names(self) -> list[str]: + ... +class LLMTask: + def __getitem__(self, key: str) -> typing.Any: + ... @typing.overload - def __init__(self) -> None: ... + def __init__(self) -> None: + ... @typing.overload - def __init__(self, task_type: str, task_dict: dict) -> None: ... - def __len__(self) -> int: ... - def __setitem__(self, key: str, value: object) -> None: ... + def __init__(self, task_type: str, task_dict: dict) -> None: + ... + def __len__(self) -> int: + ... + def __setitem__(self, key: str, value: typing.Any) -> None: + ... @typing.overload - def get(self, key: str) -> object: ... + def get(self, key: str) -> typing.Any: + ... @typing.overload - def get(self, key: str, default_value: object) -> object: ... + def get(self, key: str, default_value: typing.Any) -> typing.Any: + ... @property def task_type(self) -> str: - """ - :type: str - """ - pass -class LLMTaskHandler(): + ... +class LLMTaskHandler: """ Acts as a sink for an `LLMEngine`, emitting results as a `ControlMessage` """ - def __init__(self) -> None: ... - def get_input_names(self) -> typing.List[str]: - """ - Get the input names for the task handler. - - Returns - ------- - list[str] - The input names for the task handler. - """ - def try_handle(self, context: LLMContext) -> typing.Awaitable[typing.Optional[typing.List[morpheus._lib.messages.ControlMessage]]]: - """ - Convert the given `context` into a list of `ControlMessage` instances. - - Parameters - ---------- - context : `morpheus._lib.llm.LLMContext` - Context instance to use for the execution - - Returns - ------- - Task[Optional[list[ControlMessage]]] - """ - pass -__version__ = '25.2.0' + def __init__(self) -> None: + ... + def get_input_names(self) -> list[str]: + """ + Get the input names for the task handler. + + Returns + ------- + list[str] + The input names for the task handler. + """ + def try_handle(self, context: LLMContext) -> typing.Awaitable[list[morpheus._lib.messages.ControlMessage] | None]: + """ + Convert the given `context` into a list of `ControlMessage` instances. + + Parameters + ---------- + context : `morpheus._lib.llm.LLMContext` + Context instance to use for the execution + + Returns + ------- + Task[Optional[list[ControlMessage]]] + """ +__version__: str = '25.2.0' From ace61060c9bb417203aad26707b2a4afbb56452d Mon Sep 17 00:00:00 2001 From: David Gardner Date: Tue, 10 Dec 2024 16:27:26 -0800 Subject: [PATCH 6/9] Remove stub file for cudf_helpers, we weren't exposing any functions to python --- .../morpheus/_lib/cudf_helpers/__init__.pyi | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 python/morpheus/morpheus/_lib/cudf_helpers/__init__.pyi diff --git a/python/morpheus/morpheus/_lib/cudf_helpers/__init__.pyi b/python/morpheus/morpheus/_lib/cudf_helpers/__init__.pyi deleted file mode 100644 index 963a8d786..000000000 --- a/python/morpheus/morpheus/_lib/cudf_helpers/__init__.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from View.MemoryView import __pyx_unpickle_Enum -from __future__ import annotations -import builtins as __builtins__ -import cudf as cudf -from cudf._lib.null_mask import bitmask_allocation_size_bytes -from cudf.core.buffer.exposure_tracked_buffer import ExposureTrackedBuffer -from cudf.core.buffer.spillable_buffer import SpillableBuffer -from cudf.core.buffer.utils import as_buffer -from cudf.core.dtypes import StructDtype -import rmm as rmm -__all__ = ['ExposureTrackedBuffer', 'SpillableBuffer', 'StructDtype', 'as_buffer', 'bitmask_allocation_size_bytes', 'cudf', 'rmm'] -__pyx_capi__: dict # value = {'make_table_from_table_with_metadata': , 'make_table_from_table_info_data': , 'make_table_info_data_from_table': , 'data_from_table_view_indexed': } -__test__: dict = {} From 16de572305c6748a896c5c111df5eb7297b33f53 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Wed, 11 Dec 2024 12:07:22 -0800 Subject: [PATCH 7/9] Updated stubs --- .../rabbitmq_cpp_stage/_lib/rabbitmq_cpp_stage/__init__.pyi | 2 +- python/morpheus/morpheus/_lib/common/__init__.pyi | 4 ++-- python/morpheus/morpheus/_lib/stages/__init__.pyi | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/developer_guide/4_rabbitmq_cpp_stage/src/rabbitmq_cpp_stage/_lib/rabbitmq_cpp_stage/__init__.pyi b/examples/developer_guide/4_rabbitmq_cpp_stage/src/rabbitmq_cpp_stage/_lib/rabbitmq_cpp_stage/__init__.pyi index d64e746cc..a220432cf 100644 --- a/examples/developer_guide/4_rabbitmq_cpp_stage/src/rabbitmq_cpp_stage/_lib/rabbitmq_cpp_stage/__init__.pyi +++ b/examples/developer_guide/4_rabbitmq_cpp_stage/src/rabbitmq_cpp_stage/_lib/rabbitmq_cpp_stage/__init__.pyi @@ -3,5 +3,5 @@ import datetime import mrc.core.segment __all__ = ['RabbitMQSourceStage'] class RabbitMQSourceStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, host: str, exchange: str, exchange_type: str = 'fanout', queue_name: str = '', poll_interval: datetime.timedelta = ...) -> None: + def __init__(self, builder: mrc.core.segment.Builder, name: str, host: str, exchange: str, exchange_type: str = 'fanout', queue_name: str = '', poll_interval: datetime.timedelta = datetime.timedelta(microseconds=100000)) -> None: ... diff --git a/python/morpheus/morpheus/_lib/common/__init__.pyi b/python/morpheus/morpheus/_lib/common/__init__.pyi index 38ff03721..9abf58019 100644 --- a/python/morpheus/morpheus/_lib/common/__init__.pyi +++ b/python/morpheus/morpheus/_lib/common/__init__.pyi @@ -328,12 +328,12 @@ def determine_file_type(filename: str) -> FileTypes: @typing.overload def determine_file_type(filename: os.PathLike) -> FileTypes: ... -def read_file_to_df(filename: str, file_type: FileTypes = ...) -> typing.Any: +def read_file_to_df(filename: str, file_type: FileTypes = FileTypes.Auto) -> typing.Any: ... def typeid_is_fully_supported(arg0: TypeId) -> bool: ... def typeid_to_numpy_str(arg0: TypeId) -> str: ... -def write_df_to_file(df: typing.Any, filename: str, file_type: FileTypes = ..., **kwargs) -> None: +def write_df_to_file(df: typing.Any, filename: str, file_type: FileTypes = FileTypes.Auto, **kwargs) -> None: ... __version__: str = '25.2.0' diff --git a/python/morpheus/morpheus/_lib/stages/__init__.pyi b/python/morpheus/morpheus/_lib/stages/__init__.pyi index 4a21aaf65..c5ea6de1a 100644 --- a/python/morpheus/morpheus/_lib/stages/__init__.pyi +++ b/python/morpheus/morpheus/_lib/stages/__init__.pyi @@ -53,10 +53,10 @@ class KafkaSourceStage(mrc.core.segment.SegmentObject): def __init__(self, builder: mrc.core.segment.Builder, name: str, max_batch_size: int, topics: list[str], batch_timeout_ms: int, config: dict[str, str], disable_commits: bool = False, disable_pre_filtering: bool = False, stop_after: int = 0, async_commits: bool = True, oauth_callback: typing.Callable | None = None) -> None: ... class MonitorControlMessageStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, description: str, unit: str = 'messages', text_color: morpheus._lib.common.IndicatorsTextColor = ..., font_style: morpheus._lib.common.IndicatorsFontStyle = ..., determine_count_fn: typing.Callable[[morpheus._lib.messages.ControlMessage], int] | None = None) -> None: + def __init__(self, builder: mrc.core.segment.Builder, name: str, description: str, unit: str = 'messages', text_color: morpheus._lib.common.IndicatorsTextColor = IndicatorsTextColor.cyan, font_style: morpheus._lib.common.IndicatorsFontStyle = IndicatorsFontStyle.bold, determine_count_fn: typing.Callable[[morpheus._lib.messages.ControlMessage], int] | None = None) -> None: ... class MonitorMessageMetaStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, description: str, unit: str = 'messages', text_color: morpheus._lib.common.IndicatorsTextColor = ..., font_style: morpheus._lib.common.IndicatorsFontStyle = ..., determine_count_fn: typing.Callable[[morpheus._lib.messages.MessageMeta], int] | None = None) -> None: + def __init__(self, builder: mrc.core.segment.Builder, name: str, description: str, unit: str = 'messages', text_color: morpheus._lib.common.IndicatorsTextColor = IndicatorsTextColor.cyan, font_style: morpheus._lib.common.IndicatorsFontStyle = IndicatorsFontStyle.bold, determine_count_fn: typing.Callable[[morpheus._lib.messages.MessageMeta], int] | None = None) -> None: ... class PreallocateControlMessageStage(mrc.core.segment.SegmentObject): def __init__(self, builder: mrc.core.segment.Builder, name: str, needed_columns: list[tuple[str, morpheus._lib.common.TypeId]]) -> None: @@ -74,6 +74,6 @@ class SerializeStage(mrc.core.segment.SegmentObject): def __init__(self, builder: mrc.core.segment.Builder, name: str, include: list[str], exclude: list[str], fixed_columns: bool = True) -> None: ... class WriteToFileStage(mrc.core.segment.SegmentObject): - def __init__(self, builder: mrc.core.segment.Builder, name: str, filename: str, mode: str = 'w', file_type: morpheus._lib.common.FileTypes = ..., include_index_col: bool = True, flush: bool = False) -> None: + def __init__(self, builder: mrc.core.segment.Builder, name: str, filename: str, mode: str = 'w', file_type: morpheus._lib.common.FileTypes = FileTypes.Auto, include_index_col: bool = True, flush: bool = False) -> None: ... __version__: str = '25.2.0' From b9cf9fc5d0fbd8370d049b548e624fb79b3080e4 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Mon, 16 Dec 2024 11:30:14 -0800 Subject: [PATCH 8/9] Fix currentmodule --- external/utilities | 2 +- python/morpheus/morpheus/_lib/messages/__init__.pyi | 2 +- python/morpheus/morpheus/_lib/messages/module.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/external/utilities b/external/utilities index d0bf0272d..916abf105 160000 --- a/external/utilities +++ b/external/utilities @@ -1 +1 @@ -Subproject commit d0bf0272d0ba8e1ebc182bba3cdbc1d6798db97d +Subproject commit 916abf105cb855a84361464311a5c55659e29fef diff --git a/python/morpheus/morpheus/_lib/messages/__init__.pyi b/python/morpheus/morpheus/_lib/messages/__init__.pyi index fbaa17cfc..d523865ae 100644 --- a/python/morpheus/morpheus/_lib/messages/__init__.pyi +++ b/python/morpheus/morpheus/_lib/messages/__init__.pyi @@ -1,7 +1,7 @@ """ ----------------------- - .. currentmodule:: morpheus.messages + .. currentmodule:: morpheus._lib.messages .. autosummary:: :toctree: _generate diff --git a/python/morpheus/morpheus/_lib/messages/module.cpp b/python/morpheus/morpheus/_lib/messages/module.cpp index 992b99e42..ba09c7a24 100644 --- a/python/morpheus/morpheus/_lib/messages/module.cpp +++ b/python/morpheus/morpheus/_lib/messages/module.cpp @@ -119,7 +119,7 @@ PYBIND11_MODULE(messages, _module) { _module.doc() = R"pbdoc( ----------------------- - .. currentmodule:: morpheus.messages + .. currentmodule:: morpheus._lib.messages .. autosummary:: :toctree: _generate From b1163693e7fc6a7eb9cf94aea176efc77057cdcc Mon Sep 17 00:00:00 2001 From: David Gardner Date: Mon, 16 Dec 2024 11:33:02 -0800 Subject: [PATCH 9/9] revert unintended change --- external/utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/utilities b/external/utilities index 916abf105..d0bf0272d 160000 --- a/external/utilities +++ b/external/utilities @@ -1 +1 @@ -Subproject commit 916abf105cb855a84361464311a5c55659e29fef +Subproject commit d0bf0272d0ba8e1ebc182bba3cdbc1d6798db97d