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
feat: draco server (#394) #403
Conversation
old approach led to local errors
essentially a nice wrapper around the API of a `Draco` instance
the bug in `pytype` is confirmed in google/pytype#1105
Points to discussEndpointsCurrently, all public methods of DeploymentI was thinking about creating a simple Dockerfile to facilitate the deployment. Should we push the created image to an image registry, or do we just focus on having a server instance up and running on some infrastructure and we can skip DevOps overengineering? API Docs and Custom ErrorsAs soon as we finalize which endpoints we support for now, I would invest some more time into extending the OpenAPI docs as well as creating some more custom errors to indicate common API TestingFor now, I just used Serializing Clingo SymbolsFor now, I added a very primitive serialization logic for def clingo_symbol_to_jsonable_symbol(symbol: clingo.Symbol) -> ClingoSymbol:
return {"type": symbol.type.name, "value": str(symbol)} What do you think, what other attributes of |
@@ -79,3 +79,8 @@ clean: | |||
@find . -type d -name '*pytest_cache*' -exec rm -rf {} + | |||
@find . -type f -name "*.py[co]" -exec rm -rf {} + | |||
@find . -type d -name '*.ipynb_checkpoints' -exec rm -r {} + | |||
|
|||
.PHONY: serve | |||
serve: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can someone run the server if they install Draco via pip? We should document that.
Routers can be declared and registered to the API flexibly, allowing sensible defaults and extensibility from the outside.
The server can be started via `python -m draco.server`
It was not possible to build `jupyter-book` otherwise. Kept getting the error `sphinx-togglebutton 0.3.2 requires wheel, which is not installed`
Excluded unreachable lines from coverage. Endpoints defined in `_register` are tested, however they are not included in the coverage report, probably due to the dynamic way how they are declared.
Hey @domoritz! As soon as we finalize the endpoints and their signatures (that is, what is the JSON input we expect from users) I'll create detailed docs about the server in jupyter-book. You can explore the current state of the server through the OpenAPI UI by executing Feel free to suggest changes to the endpoints if you think that different input-output behaviour would lead to a better UX/DX. The server is highly extensible and pretty easy to modify. We (and users installing draco via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. I love how I can try this online at http://127.0.0.1:8000/docs/. I will merge this but it would be good to add some docs to the website as well to tell people how to use the server.
Thanks for the review, I opened #422 for docs. |
Goals
Adds a FastAPI submodule inside the
draco
module to expose the main features of Draco through REST endpoints. I implemented a basic layered architecture (model - service - controller) to provide reasonable testability and extensibility.Notes
make serve
. OpenAPI docs are accessible through http://localhost:8000/docs.closes #394