-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pybind11-stubgen errors #261
Comments
While I appreciate the effort, I don't think there is any error to be fixed, hence I am just going to close this. Here are my reasonings:
Sorry this might not be what you want to hear. Personally I would reject large changes of mostly cosmetic nature, simply because of the substantial time it requires to check that the changes are indeed all cosmetic. cc @kyamagu |
Btw, there is a still-open issue #133 along the same direction. The main difference is that this issue seems to suggest substantially re-formatting existing code, which I would somewhat oppose unless there is a good reason. |
Surely the changes to the code are too big to review, but the current documentation does have the issues I mentioned above, that is C++ type names in the docstring. Maybe I could try to resolve that without reformatting the code a lot. |
Perhaps that was a rushed response - on 2nd thought while I agree that the issues you pointed out are real and could benefit from some work, it remains a issue that large and mostly automated changes would take substantial time checking. To the extent that the amount of effort in checking may be almost the same as one of us (the known reliable contributors) running the auto-tool and doing it ourselves. So I would say, a pull of this nature should be accompanied by a detailed description of the procedure of how to (independently) arriving at the proposed change? And ideally, none of the steps should be "editing files by hand". Would that be a better answer? I.e. one of us will still be "independently" trying to arrive at the same changes, the only difference being that you are credited as the author of the change. This is assuming that most/all of the changes are auto-generated in nature. If it is about adjusting current code manually to fit auto-tools, my original comment stands. |
@MeetWq Thanks for identifying the cause and a fix for C++ type name issues. @HinTak While code reformatting can be a lot, I don't see much functionality change in @MeetWq 's proposal. Perhaps the process can be mostly automated as you point out. Another concern is the conflict with the current @HinTak 's development fork. |
I have split off the first item as #262 . The 2nd item is included in #258 ; some of the 3rd items will disappear as api comes and goes. I think there are simple improvement possible for #262, but the bulk of it is due to classes having methods involving and inter-dependent on each other, Canvas vs surface, image vs pixmap, etc, so those few files will need splitting into declarations and methods and large re-arrangements... |
I'm trying to generate type stubs using
pybind11-stubgen
. However there are many errors in the generation process. Following the error message, I made some changes to the code: https://github.com/MeetWq/skia-python/tree/fix/pybind11My changes mainly involve the following two aspects:
split pybind declarations and definitions
According to the document of pybind11, docstrings are generated at the time of the declaration, e.g. when
.def(...)
is called. At this point parameter and return types should be known to pybind11. By spliting thepy::class_
constructors and.def(...)
definitions, some C++ type names in the docstring were replaced:before:
after:
manually specify preview of default arguments
According to the document of pybind11, the “preview” of the default argument in the function signature is generated using the object’s
__repr__
method. If not available, the signature may not be very helpful. We can manually specify the human-readable preview of the default argument using thearg_v
notation:before:
after:
With the above changes, most of the errors that occurred during the execution of
pybind11-stubgen
have been resolved, but there are still some remaining errors:Since I'm not familiar with either
pybind11
orskia
, I'm not sure how to fix them. The above errors show some problems inskia-python
, such asskgpu::MutableTextureState
is not defined withpy::class_
.Can you help with these errors? Should I contribute these changes to the repository?
The text was updated successfully, but these errors were encountered: