jupyter-server / jupyter_server

The backend—i.e. core services, APIs, and REST endpoints—to Jupyter web applications.
https://jupyter-server.readthedocs.io
BSD 3-Clause "New" or "Revised" License
465 stars 279 forks source link

Strawman API Docs #1419

Open bollwyvl opened 2 months ago

bollwyvl commented 2 months ago

references

code changes

alternatives

assessment

screens

note screen
basic image
build-a-GET image
GOT image
400% image

:bell: @Zsailer @tonyfast

bollwyvl commented 2 months ago

@meeseeksdev tag enhancement

lumberbot-app[bot] commented 2 months ago

Awww, sorry bollwyvl you do not seem to be allowed to do that, please ask a repository maintainer.

bollwyvl commented 2 months ago

@blink1073 add the enhancement label 1 minute ago

I knew it! All the bots are just more Steves! :heart: :guitar:

bollwyvl commented 2 months ago

Locally, it looks like the 1.4mb slug of JS doubles the size of the wheel:

383kb jupyter_server-2.14.0-py3-none-any.whl
792kb jupyter_server-2.15.0.dev0-py3-none-any.whl

That's... not actually as bad as I expected for a full, robust, and extremely useful app, but still pretty heavy.

It's possible that size could be further tightened up, but would likely require hundreds of megabytes of node_modules to get a more purposeful build. I didn't even follow redocly down this far, but imagine it's substantially larger on both fronts (and semi-shady).

I'll mark this ready for review, but am still not convinced it should be added to core, and will let others weigh in before going any further. For example:

But really... extensions should be able to extend the spec via the existing conf.dmechanism, and reference existing schema parts, and both extensions and core should be able to declaratively hide parts of the docs based on auth resources. And it should all be l10n-aware.

All of this points to complexity that would be better handled in an extension, and even if jupyter_server:

bollwyvl commented 1 month ago

During the jupyter servers and kernels call last week, @vidartf raised the question of exposing additional openapi specs. This points to another potential use case, where an extension (or otherwise wrapped service, e.g. via jupyter-server-proxy) has an existing contract and would like it to be exposed via some mechanism, e.g. dropdown in the /apidocs page:

             :(). jupyter

[Jupyter Server       v]
| Other Extension      |
| Wrapped Appplication |

This could probably be deep linked via some GET param, e.g. /api/apidocs/?spec=/api/app1/swagger.yml.

This doesn't handle the case where an extension overloads an existing route (perhaps by adding some new fields or metadata).

Another thought: currently docs/ is unclaimed. I've very much wanted to see a well-known location on disk (e.g. $PREFIX/share/jupyter/docs which would allow other kinds of documentation to be hosted and, critically, made available via indexed search, and docs/api might be a very nice place indeed to start that process. I'm currently unaware of a broadly-used way to describe "there's some interactive documentation at this relative URL," which seems like an important starting point to making this useful and discoverable.