Typing stubs for NVIDIA DeepStream Python Bindings
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.
Versioning
The stub versions matches the versions of pyds. For example, stub version 1.2.2 fits to pyds
version
1.2.2. If any fix has to be applied, the fourth position would be incremented. So the first fix of
1.2.2 results in 1.2.2.1.
Please pin your version directly or limit it upper-wise like:
pyds-stubs>=1.2.2,<1.2.3
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.
Development
Installation of Prerequisites
- Python 3.12
uvandpre-commit(both preferred via pipx)- Python venv (optional, recommended)
pipx install pre-commit uv
pre-commit install
Build wheel
uv build
Generation
The stubs are generated by pybind11-stubgen (2.5.5). Install pyds from nvidia official sources. To generate the stubs execute the following script 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:
- add generic class for
capsulewith information about the class of the object. - remove class
GListand add genericGListclass with information about the class of the data. castfunctions withcapsuledatatype:capsuleis replaced bycapsule[class]whereclassis the target class.numpy.ndarray[float32]: Replace withNDArray[numpy.float32]withfrom numpy.typing import NDArray- Returntype of
eglImageproperty ofNvBufSurfaceMappedAddr:typing.Anyinstead ofcapsule - Returntype of
dataPtrproperty ofNvBufSurfaceParams:typing.Anyinstead ofcapsule - Datatype of
batch_metaofNvDsBaseMeta:NvDsBatchMetainstead of_NvDsBatchMeta - Datatype of
uContextofNvDsBaseMeta:typing.Anyinstead ofcapsule - Datatype of
batch_user_meta_listofNvDsBatchMeta:GList[NvDsUserMeta] | Noneinstead ofGList - Datatype of
frame_meta_listofNvDsBatchMeta:GList[NvDsFrameMeta] | Noneinstead ofGList - Datatype of
meta_mutexofNvDsBatchMeta:GLib.RecMutexinstead of_GRecMutexwithfrom gi.repository import GLib - Datatype of
label_info_listofNvDsClassifierMeta:GList[NvDsLabelInfo] | Noneinstead ofGList - Datatype of
extMsgofNvDsEventMsgMeta:typing.Anyinstead ofcapsule - Datatype of
maskofNvDsFaceObjectWithExt:GList[typing.Any] | Noneinstead ofGList - Datatype of
display_meta_listofNvDsFrameMeta:GList[NvDsDisplayMeta] | Noneinstead ofGList - Datatype of
frame_user_meta_listofNvDsFrameMeta:GList[NvDsUserMeta] | Noneinstead ofGList - Datatype of
obj_meta_listofNvDsFrameMeta:GList[NvDsObjectMeta] | Noneinstead ofGList - Returntype of
bufferproperty ofNvDsInferLayerInfo:typing.Anyinstead ofcapsule - Returntype of
priv_dataproperty ofNvDsInferSegmentationMeta:typing.Anyinstead ofcapsule - Returntype of
out_buf_ptrs_devproperty ofNvDsInferTensorMeta:typing.Anyinstead ofcapsule - Returntype of
out_buf_ptrs_hostproperty ofNvDsInferTensorMeta:typing.Anyinstead ofcapsule - Returntype of
priv_dataproperty ofNvDsInferTensorMeta:typing.Anyinstead ofcapsule - Datatype of
metaofNvDsMeta:Gst.Metainstead of_GstMetawithfrom gi.repository import Gst - Datatype of
meta_dataofNvDsMeta:typing.Anyinstead ofcapsule - Datatype of
user_dataofNvDsMeta:typing.Anyinstead ofcapsule - Add
NvDsMetaListas an alias ofGList[NvDsMeta] | None - Datatype of
empty_listofNvDsMetaPool:NvDsMetaListinstead ofGList - Datatype of
full_listofNvDsMetaPool:NvDsMetaListinstead ofGList - Datatype of
classifier_meta_listofNvDsObjectMeta:GList[NvDsClassifierMeta] | Noneinstead ofGList - Datatype of
obj_user_meta_listofNvDsObjectMeta:GList[NvDsUserMeta] | Noneinstead ofGList - Datatype of
dataofNvDsOpticalFlowMeta:typing.Anyinstead ofcapsule - Datatype of
privofNvDsOpticalFlowMeta:typing.Anyinstead ofcapsule - Datatype of
reservedofNvDsOpticalFlowMeta:typing.Anyinstead ofcapsule - Datatype of
maskofNvDsPersonObjectExt:GList[typing.Any] | Noneinstead ofGList - Datatype of
payloadofNvDsPayload:typing.Anyinstead ofcapsule - Datatype of
user_meta_dataofNvDsUserMeta:typing.Anyinstead ofcapsule - Datatype of
maskofNvDsVehicleObjectExt:GList[typing.Any] | Noneinstead ofGList - Datatype of
textofRectDim:typing.Anyinstead ofcapsule - Rename
dmabuftodmabuf_fdofNvBufSurfaceFromFd - Datatype of
bufferofNvBufSurfaceFromFd:capsule[NvBufSurface]instead ofcapsule - Rename
arg0touser_metaofalloc_nvds_event_msg_meta - Datatype of
bufferoffree_gbuffer:typing.Anyinstead ofcapsule - Datatype of
arg0ofget_detections:typing.Anyinstead ofcapsule - Datatype of
arg0ofget_nvds_LayerInfo:typing.Anyinstead ofcapsule - Datatype of
dataofget_optical_flow_vectors:capsule[NvDsOpticalFlowMeta]instead ofcapsule - Rename
datatoof_metaofget_optical_flow_vectors - Datatype of
ptrofget_ptr:typing.Anyinstead ofcapsule - Datatype of
dataofget_segmentation_masks:capsule[NvDsInferSegmentationMeta]instead ofcapsule - Datatype of
arg0ofglist_get_nvds_Surface_Params:typing.Anyinstead ofcapsule - Datatype of
arg0ofglist_get_nvds_batch_meta:typing.Anyinstead ofcapsule - Datatype of
arg0ofglist_get_nvds_classifier_meta:typing.Anyinstead ofcapsule - Datatype of
arg0ofglist_get_nvds_display_meta:typing.Anyinstead ofcapsule - Datatype of
arg0ofglist_get_nvds_event_msg_meta:typing.Anyinstead ofcapsule - Datatype of
arg0ofglist_get_nvds_frame_meta:typing.Anyinstead ofcapsule - Datatype of
arg0ofglist_get_nvds_label_info:typing.Anyinstead ofcapsule - Datatype of
arg0ofglist_get_nvds_object_meta:typing.Anyinstead ofcapsule - Datatype of
arg0ofglist_get_nvds_person_object:typing.Anyinstead ofcapsule - Datatype of
arg0ofglist_get_nvds_tensor_meta:typing.Anyinstead ofcapsule - Datatype of
arg0ofglist_get_nvds_user_meta:typing.Anyinstead ofcapsule - Datatype of
arg0ofglist_get_nvds_vehicle_object:typing.Anyinstead ofcapsule - Datatype of
bufferofgst_buffer_add_nvds_meta:Gst.Bufferinstead of_GstBuffer - Datatype of
meta_dataofgst_buffer_add_nvds_meta:typing.Anyinstead ofcapsule - Datatype of
user_dataofgst_buffer_add_nvds_meta:typing.Anyinstead ofcapsule - Returntype of
gst_buffer_add_nvds_meta:NvDsMetainstead of_NvDsMeta - Rename
arg0togst_elementofgst_element_send_nvevent_new_stream_reset - Rename
arg1tosource_idofgst_element_send_nvevent_new_stream_reset - Datatype of
dataofnvds_batch_meta_copy_func:capsule[NvDsBatchMeta]instead ofcapsule - Datatype of
user_metaofnvds_batch_meta_copy_func:typing.Anyinstead ofcapsule - Rename
user_metatouser_dataofnvds_batch_meta_copy_func - Returntype of
nvds_batch_meta_copy_func:capsule[NvDsBatchMeta]instead ofcapsule - Datatype of
dataofnvds_batch_meta_release_func:capsule[NvDsBatchMeta]instead ofcapsule - Datatype of
user_dataofnvds_batch_meta_release_func:typing.Anyinstead ofcapsule - Add
NvDsUserMetaListas an alias ofGList[NvDsUserMeta] | None - Datatype of
meta_listofnvds_clear_batch_user_meta_list:NvDsUserMetaListinstead ofGList - Add
NvDisplayMetaListas an alias ofGList[NvDsDisplayMeta] | None - Datatype of
meta_listofnvds_clear_display_meta_list:NvDisplayMetaListinstead ofGList - Add
NvDsFrameMetaListas an alias ofGList[NvDsFrameMeta] | None - Datatype of
meta_listofnvds_clear_frame_meta_list:NvDsFrameMetaListinstead ofGList - Datatype of
meta_listofnvds_clear_frame_user_meta_list:NvDsUserMetaListinstead ofGList - Datatype of
meta_listofnvds_clear_meta_list:NvDsMetaListinstead ofGList - Returntype of
nvds_clear_meta_list:NvDsMetaListinstead ofGList - Add
NvDsObjectMetaListas an alias ofGList[NvDsObjectMeta] | None - Datatype of
meta_listofnvds_clear_obj_meta_list:NvDsObjectMetaListinstead ofGList - Datatype of
meta_listofnvds_clear_obj_user_meta_list:NvDsObjectMetaListinstead ofGList - Datatype of
src_user_meta_listofnvds_copy_batch_user_meta_list:NvDsObjectMetaListinstead ofGList - Datatype of
src_display_metaofnvds_copy_display_meta_list:NvDisplayMetaListinstead ofGList - Rename
src_display_metatosrc_display_meta_listofnvds_copy_display_meta_list - Datatype of
src_frame_meta_listofnvds_copy_frame_meta_list:NvDsFrameMetaListinstead ofGList - Datatype of
src_user_meta_listofnvds_copy_frame_user_meta_list:NvDsUserMetaListinstead ofGList - Datatype of
src_obj_meta_listofnvds_copy_obj_meta_list:NvDsObjectMetaListinstead ofGList - Rename
dst_object_metatodst_frame_metaofnvds_copy_obj_meta_list - Datatype of
frame_meta_listofnvds_get_nth_frame_meta:GList[NvDsFrameMeta]instead ofGList - Datatype of
arg0ofregister_user_copyfunc:typing.Callable[[typing.Any, typing.Any], typing.Any]instead oftyping.Callable[[capsule, capsule], capsule] - Datatype of
arg0ofregister_user_releasefunc:typing.Callable[[typing.Any, typing.Any], None]instead oftyping.Callable[[capsule, capsule], None] - Datatype of
arg1ofset_user_copyfunc:typing.Callable[[typing.Any, typing.Any], typing.Any]instead oftyping.Callable[[capsule, capsule], capsule] - Datatype of
arg1ofset_user_releasefunc:typing.Callable[[typing.Any, typing.Any], None]instead oftyping.Callable[[capsule, capsule], None] - Datatype of
funcofuser_copyfunc:typing.Callable[[typing.Any, typing.Any], typing.Any]instead oftyping.Callable[[capsule, capsule], capsule] - Datatype of
funcofuser_releasefunc:typing.Callable[[typing.Any, typing.Any], None]instead oftyping.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
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 ;)
Metadata
Release files for pyds-stubs 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyds_stubs-1.2.2.tar.gz | 43.9 kB | With provenance | Details for pyds_stubs-1.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyds_stubs-1.2.2-py3-none-any.whl | Python 3 | none | any | Details for pyds_stubs-1.2.2-py3-none-any.whl |
Total release size: 88.7 kB
Release files / pyds_stubs-1.2.2.tar.gz
| Download URL | pyds_stubs-1.2.2.tar.gz |
|---|---|
| Size | 43.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a6bbea564ceab2272b4aa8dfee1672489d6cf6ebcd39c30efc37a780ffb34798
|
|
BLAKE2b-256 checksum How to use checksums |
0abdc3b046c7fb0330f331a1e7f1de43d53ffd0cf0b7304806b7c6e32c98fa84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2025.
Transparency logRelease files / pyds_stubs-1.2.2-py3-none-any.whl
| Download URL | pyds_stubs-1.2.2-py3-none-any.whl |
|---|---|
| Size | 44.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e07b708545bf363b3be56f63d201d59272e33fd07e29b8e4eb1f0e965de0d86c
|
|
BLAKE2b-256 checksum How to use checksums |
71ebf19364f3e7be75b6feb67865046495948015f4b08fdfd693a714310fd85b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2025.
Transparency logSecurity for pyds-stubs 1.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyds_stubs-1.2.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.