Adapt python wrappings
This MR updates the dependencies for the pybind bindings of the algorithms image_io
video_input
and metadata_map_io
.
Instead of also bringing the pybindings of these classes we introduce ./script/cpp_to_pybind11.py that generates those bindings.
The script was built so that the generated code closely resembles that of the kwiver-v1 taken into account the differences in algorithm API in kwiver-v2.
It also has the advantage of bringing the documentation of the classes from C++ which was previously missing.
Documentation example
>> help(ffmpeg_video_reader)
Help on VideoInput in module kwiver.vital.algo._algos object:
class VideoInput(_algorithm)
| Method resolution order:
| VideoInput
| _algorithm
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __init__(...)
| __init__(self: kwiver.vital.algo._algos.VideoInput) -> None
|
| close(...)
| close(self: kwiver.vital.algo._algos.VideoInput) -> None
|
| \brief Close video stream.
|
| Close the currently opened stream and release resources. Closing
| a stream that is already closed does not cause a problem.
...
A new test was brought from kwiver-v1 python/kwiver/vital/tests/test_image_io.py
that validates that bindings work for image_io
and that we can create a new image_io
implementation from the python side.
Ideally we would like to also bring https://github.com/Kitware/kwiver/blob/master/python/kwiver/vital/tests/test_algorithms_common.py but the we would need to update the test for a newer pytest since it looks like some tests are skipped:
PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_XXX will be ignored
We will do this in a separate MR.
IMPORTING_GUIDE.md
on https://hackmd.io/@9L74IuqXTpe4t4y1HbN-XQ/HywL9UW9p/edit is also updated.