-
Notifications
You must be signed in to change notification settings - Fork 7
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
python wrapper (and missing docstrings via juliacall ) #274
Comments
I think this is a fundamental limitation of |
That's right; it is a limitation of If you want to get the docstring you can use the
I think the only options around this are:
#2 is best for longevity but requires the |
I think we should definitely start by trying to do option 2. I'm not sure that option 1 would be worth the ongoing maintenance. Is programmatically setting docstrings in python easy? A quick internet search says that you can just set |
You can set it programmatically. I tried option 2 yesterday but the JuliaCall/PythonCall interoperability made it a total maze to find where Python functions get wrapped. I started adding print statements just to understand how things were being called, and I quickly encountered segmentation faults. That made my motivation drop. |
Are you sure you can set it programmatically?
(See also JuliaPy/PythonCall.jl#468. Andy I know you will have seen this, but linking for the record.) |
You can in Python, but when I saw that response I realised why you can't do it through JuliaCall. Here's a pure Python proof: def f(x):
return x**2
f.__doc__ = "Return x to the power 2" Then
I might get some terminology here wrong, but the effect is the same: The reason why they say it can't be done through JuliaCall is because they aren't actually creating instances of functions, they are using the same class type just to point to all the Julia functions. If they were actually adding Python functions for each Julia function then you could set the docstring with each function. But instead they are just filling up the Python namespace with the functions available, not actually the functions themselves. Addendum: I don't see any reason why it would have to be done the way that they have done it. Or any reason why you couldn't just create Python functions on-the-fly for each Julia equivalent, but presumably there is a reason they did it the way they did. |
octofitterpy is a good example of a wrapper similar to what we are talking about. (Seen on Julia slack.) |
Would be great to have for newcomers who don't necessarily know how to dig into the code yet.
Current docstring info when using Korg in python via juliacall (0.9.15):
The text was updated successfully, but these errors were encountered: