-
Notifications
You must be signed in to change notification settings - Fork 514
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
Improve API docs #2196
Comments
ways in which sdk api docs differ from arroyo off the top of my head:
about the |
@untitaker Trying to wrap my head around the class CaptureEventArgs(object):
def __init__(
self,
event, # type: Event
hint=None, # type: Optional[str]
# (...)
fingerprint=None, # type: Optional[List[str]]
):
# type: (...) -> None
pass
# old capture_event
def _capture_event(*args, **kwargs):
# type: (...) -> Optional[str]
return Hub.current.capture_event(*args, **kwargs)
# new capture_event
if TYPE_CHECKING:
class capture_event(CaptureEventArgs):
pass
else:
capture_event = (lambda: _capture_event)() But not sure now how to get this into the api docs correctly. It doesn't show up on its own, I can explicitly tell it to document the Also still figuring out how to also share the |
ah yeah. i forgot about that. i think i might have just lived with it back then for get_options. I think it might be possible to re-bind
even if sphinx picks that up as a function to document, now the return type will be wrong :( |
Dunno if we can make the return type work. You can just add |
Nevermind, TIL |
I believe you can do this:
|
Updated above example to be self-contained -- you also have to make |
Actually I think it might be good enough to re-bind
|
Was able to get both autocompletion and Sphinx working with a variation of your last idea: from functools import partial
if TYPE_CHECKING:
capture_event = partial(Hub.capture_event, None)
else:
def capture_event(*args, **kwargs):
return Hub.current.capture_event(*args, **kwargs) Without the Thanks for the help, much appreciated! |
hideous, i love it |
Problem Statement
Our API docs are in desperate need of some love, e.g.:
**kwargs
without any further explanation, so people have to dive into the code themselves (Top-level API should list possible args/kwargs explicitly #2199) Allow (some) autocompletion for top-level API #2213Solution Brainstorm
See also:
The text was updated successfully, but these errors were encountered: