Skip to main content

Typing stubs for NVIDIA DeepStream Python Bindings

Project description

Typing stubs for NVIDIA DeepStream Python Bindings

audit.yml license

This project provides type stubs for pyds to improve the support of these important bindings in IDEs.

These are generated by pybind11-stubgen and further post-processed. For the post-processing steps, check out the Post-Processing Chapter

With the usage of this project, you agree to the license terms, found in the License chapter. This project is not affiliated with NVIDIA or the authors and maintainer of the pyds repository. It is the result of the need for type hints for a simpler and more stable implementation of DeepStream pipelines in Python.

Index

Installation

This library can be easily installed with pip:

pip install pyds-stubs

Usage

There is no magic, just only import pyds as you would normally do. This package is intended to be used during the development and can be omitted in runtime environments.

Versioning

The stub versions matches the versions of pyds. For example, stub version 1.1.8 fits to pyds version 1.1.8. If any fix has to be applied, the fourth position would be incremented. So the first fix of 1.1.8 results in 1.1.8.1.

Please pin your version directly or limit it upper-wise like:

pyds-stubs>=1.1.8,<1.1.9

Development

Installation of Prerequisites

pip install -r requirements/dev/requirements.txt
  • Installation of requirements:
pip install -r requirements/library/requirements.txt

Build wheel

python3 -m build

Generation

The stubs are generated by pybind11-stubgen. It is contained in the development requirements. The stubs can be generated with the following command, if it is executed in the environment, where pyds is installed.

pybind11-stubgen pyds

Post-Processing

For correct usage, the generated stubs are post-processed. Following steps are applied:

  • Format with ruff
  • add generic class for capsule with information about the class of the object.
  • remove class GList and add generic GList class with information about the class of the data.
  • cast functions with capsule datatype: capsule is replaced by capsule[class] where class is the target class.
  • GList: change capsule to capsule[typing.Any]
  • array datatype: Replace with numpy.ndarray
  • numpy.ndarray[float32]: Replace with NDArray[numpy.float32] with from numpy.typing import NDArray
  • Datatype of eglImage of NvBufSurfaceMappedAddr: typing.Any instead of capsule
  • Datatype of dataPtr of NvBufSurfaceParams: typing.Any instead of capsule
  • Datatype of batch_meta of NvDsBaseMeta: NvDsBatchMeta instead of _NvDsBatchMeta
  • Datatype of uContext of NvDsBaseMeta: typing.Any instead of capsule
  • Datatype of batch_user_meta_list of NvDsBatchMeta: GList[NvDsUserMeta] instead of GList
  • Datatype of frame_meta_list of NvDsBatchMeta: GList[NvDsFrameMeta] instead of GList
  • Datatype of meta_mutex of NvDsBatchMeta: GLib.RecMutex instead of _GRecMutex with from gi.repository import GLib
  • Datatype of label_info_list of NvDsClassifierMeta: GList[NvDsLabelInfo] instead of GList
  • Datatype of extMsg of NvDsEventMsgMeta: typing.Any instead of capsule
  • Datatype of mask of NvDsFaceObjectWithExt: GList[typing.Any] instead of GList
  • Datatype of display_meta_list of NvDsFrameMeta: GList[NvDsDisplayMeta] instead of GList
  • Datatype of frame_user_meta_list of NvDsFrameMeta: GList[NvDsUserMeta] instead of GList
  • Datatype of obj_meta_list of NvDsFrameMeta: GList[NvDsObjectMeta] instead of GList
  • Datatype of buffer of NvDsInferLayerInfo: typing.Any instead of capsule
  • Returntype of priv_data property of NvDsInferSegmentationMeta: typing.Any instead of capsule
  • Returntype of out_buf_ptrs_dev property of NvDsInferTensorMeta: typing.Any instead of capsule
  • Returntype of out_buf_ptrs_host property of NvDsInferTensorMeta: typing.Any instead of capsule
  • Returntype of priv_data property of NvDsInferTensorMeta: typing.Any instead of capsule
  • Datatype of meta of NvDsMeta: Gst.Meta instead of _GstMeta with from gi.repository import Gst
  • Datatype of meta_data of NvDsMeta: typing.Any instead of capsule
  • Datatype of user_data of NvDsMeta: typing.Any instead of capsule
  • Add NvDsMetaList as an alias of GList[NvDsMeta]
  • Datatype of empty_list of NvDsMetaPool: NvDsMetaList instead of GList
  • Datatype of full_list of NvDsMetaPool: NvDsMetaList instead of GList
  • Datatype of classifier_meta_list of NvDsObjectMeta: GList[NvDsClassifierMeta] instead of GList
  • Datatype of obj_user_meta_list of NvDsObjectMeta: GList[NvDsUserMeta] instead of GList
  • Datatype of data of NvDsOpticalFlowMeta: typing.Any instead of capsule
  • Datatype of priv of NvDsOpticalFlowMeta: typing.Any instead of capsule
  • Datatype of reserved of NvDsOpticalFlowMeta: typing.Any instead of capsule
  • Datatype of mask of NvDsPersonObjectExt: GList[typing.Any] instead of GList
  • Datatype of payload of NvDsPayload: typing.Any instead of capsule
  • Datatype of user_meta_data of NvDsUserMeta: typing.Any instead of capsule
  • Datatype of mask of NvDsVehicleObjectExt: GList[typing.Any] instead of GList
  • Datatype of text of RectDim: typing.Any instead of capsule
  • Datatype of buffer of NvBufSurfaceFromFd: capsule[NvBufSurface] instead of capsule
  • Datatype of buffer of free_gbuffer: typing.Any instead of capsule
  • Datatype of arg0 of get_detections: typing.Any instead of capsule
  • Datatype of arg0 of get_nvds_LayerInfo: typing.Any instead of capsule
  • Datatype of data of get_optical_flow_vectors: capsule[NvDsOpticalFlowMeta] instead of capsule
  • Datatype of ptr of get_ptr: typing.Any instead of capsule
  • Datatype of data of get_segmentation_masks: capsule[NvDsInferSegmentationMeta] instead of capsule
  • Datatype of arg0 of glist_get_nvds_Surface_Params: typing.Any instead of capsule
  • Datatype of arg0 of glist_get_nvds_batch_meta: typing.Any instead of capsule
  • Datatype of arg0 of glist_get_nvds_classifier_meta: typing.Any instead of capsule
  • Datatype of arg0 of glist_get_nvds_display_meta: typing.Any instead of capsule
  • Datatype of arg0 of glist_get_nvds_event_msg_meta: typing.Any instead of capsule
  • Datatype of arg0 of glist_get_nvds_frame_meta: typing.Any instead of capsule
  • Datatype of arg0 of glist_get_nvds_label_info: typing.Any instead of capsule
  • Datatype of arg0 of glist_get_nvds_object_meta: typing.Any instead of capsule
  • Datatype of arg0 of glist_get_nvds_person_object: typing.Any instead of capsule
  • Datatype of arg0 of glist_get_nvds_tensor_meta: typing.Any instead of capsule
  • Datatype of arg0 of glist_get_nvds_user_meta: typing.Any instead of capsule
  • Datatype of arg0 of glist_get_nvds_vehicle_object: typing.Any instead of capsule
  • Datatype of buffer of gst_buffer_add_nvds_meta: Gst.Buffer instead of _GstBuffer
  • Datatype of meta_data of gst_buffer_add_nvds_meta: typing.Any instead of capsule
  • Datatype of user_data of gst_buffer_add_nvds_meta: typing.Any instead of capsule
  • Returntype of gst_buffer_add_nvds_meta: NvDsMeta instead of _NvDsMeta
  • Datatype of data of nvds_batch_meta_copy_func: capsule[NvDsBatchMeta] instead of capsule
  • Datatype of user_data of nvds_batch_meta_copy_func: typing.Any instead of capsule
  • Datatype of data of nvds_batch_meta_release_func: capsule[NvDsBatchMeta] instead of capsule
  • Datatype of meta_list of nvds_clear_batch_user_meta_list: NvDsUserMetaList instead of GList
  • Add NvDisplayMetaList as an alias of GList[NvDsDisplayMeta]
  • Datatype of meta_list of nvds_clear_display_meta_list: NvDisplayMetaList instead of GList
  • Add NvDsFrameMetaList as an alias of GList[NvDsFrameMeta]
  • Datatype of meta_list of nvds_clear_frame_meta_list: NvDsFrameMetaList instead of GList
  • Add NvDsUserMetaList as an alias of GList[NvDsUserMeta]
  • Datatype of meta_list of nvds_clear_frame_user_meta_list: NvDsUserMetaList instead of GList
  • Datatype of meta_list of nvds_clear_meta_list: NvDsMetaList instead of GList
  • Returntype of nvds_clear_meta_list: NvDsMetaList instead of GList
  • Add NvDsObjectMetaList as an alias of GList[NvDsObjectMeta]
  • Datatype of meta_list of nvds_clear_obj_meta_list: NvDsObjectMetaList instead of GList
  • Datatype of meta_list of nvds_clear_obj_user_meta_list: NvDsObjectMetaList instead of GList
  • Datatype of src_user_meta_list of nvds_copy_batch_user_meta_list: NvDsObjectMetaList instead of GList
  • Datatype of src_user_meta_list of nvds_copy_display_meta_list: NvDisplayMetaList instead of GList
  • Datatype of src_user_meta_list of nvds_copy_frame_meta_list: NvDsFrameMetaList instead of GList
  • Datatype of src_user_meta_list of nvds_copy_frame_user_meta_list: NvDsUserMetaList instead of GList
  • Datatype of src_user_meta_list of nvds_copy_obj_meta_list: NvDsObjectMetaList instead of GList
  • Datatype of frame_meta_list of nvds_get_nth_frame_meta: GList[NvDsFrameMeta] instead of GList
  • Datatype of arg0 of register_user_copyfunc: typing.Callable[[typing.Any, typing.Any], typing.Any] instead of typing.Callable[[capsule, capsule], capsule]
  • Datatype of arg0 of register_user_releasefunc: typing.Callable[[typing.Any, typing.Any], None] instead of typing.Callable[[capsule, capsule], None]
  • Datatype of arg1 of set_user_copyfunc: typing.Callable[[typing.Any, typing.Any], typing.Any] instead of typing.Callable[[capsule, capsule], capsule]
  • Datatype of arg1 of set_user_releasefunc: typing.Callable[[typing.Any, typing.Any], None] instead of typing.Callable[[capsule, capsule], None]
  • Datatype of func of user_copyfunc: typing.Callable[[typing.Any, typing.Any], typing.Any] instead of typing.Callable[[capsule, capsule], capsule]
  • Datatype of func of user_releasefunc: typing.Callable[[typing.Any, typing.Any], None] instead of typing.Callable[[capsule, capsule], None]

License

This project is published under Apache License, Version 2.0 - please comply with it, if you use/modify/distribute it. The license can be found in "LICENSE".

Appendix

Python venv

python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip setuptools

Links

Notice for NVIDIA

I recently (Jun, 2025) saw a discussion on your forum. If there is any official stub support by NVIDIA, this project will be deprecated and publicly archived. I hope to hear from you ;)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyds_stubs-1.1.8.1.tar.gz (40.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyds_stubs-1.1.8.1-py3-none-any.whl (40.7 kB view details)

Uploaded Python 3

File details

Details for the file pyds_stubs-1.1.8.1.tar.gz.

File metadata

  • Download URL: pyds_stubs-1.1.8.1.tar.gz
  • Upload date:
  • Size: 40.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for pyds_stubs-1.1.8.1.tar.gz
Algorithm Hash digest
SHA256 c14390515fac4284239bcd63feeebfffe0c583abc8fa663d86e5c0ef0558d94d
MD5 a73f91d22a11a643c78cd2d9c6c8c3a5
BLAKE2b-256 7df72535452c5528778296d7e9b9c81837fb40b708610ea3b88be4ee1ae00f91

See more details on using hashes here.

File details

Details for the file pyds_stubs-1.1.8.1-py3-none-any.whl.

File metadata

  • Download URL: pyds_stubs-1.1.8.1-py3-none-any.whl
  • Upload date:
  • Size: 40.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for pyds_stubs-1.1.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e7795c4a1d586c3b9ce72d55c3354edd4c7ea8224bbbc7cd5d6e661f9145ed84
MD5 cced0f75ce5cbef300f92b8aa8086264
BLAKE2b-256 d97b41e374ad0ddc60050634b8382d970a29fbb6f1c3b4bbdaa3f2d288bcee1f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page