NVIDIA / cuda-python

CUDA Python Low-level Bindings
https://nvidia.github.io/cuda-python/
Other
811 stars 63 forks source link

I think the code written in python needs Doctests #8

Closed gullsherhussain closed 2 years ago

gullsherhussain commented 2 years ago

In order to prevent errors, a continuous tested system and make an efficient architecture for CUDA API to run smoothly there is a need for Doctests for the python function

You can avoid crashes, bugs, and the result would be an efficient system

References are :

https://dev.to/perigk/doctests-the-shy-giant-of-testing-modules-3g74 https://pymotw.com/2/doctest/

vzhurba01 commented 2 years ago

Thank you for the suggestion. I can see this working well for some APIs that require a few pre-requisite steps to return a meaningful value.

Right now there's some awkwardness in trying to adopt this since:

  1. Many APIs need multiple pre-requisite calls, may not be the best solution for most
  2. We now use Sphinx Autodocs. While there is a doctest extension, I'm not sure how hard it is to make them interact
  3. Docs for Sphinx is heavily influenced by the CUDA header docs. Ideally we both "Pythonify" the docs while keeping it based off those headers.

I'll keep this issue open and revisit this suggestion in the future.