-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add Python client implementation #1199
Conversation
Clean up python client, implement arrow loading, skip testing table size in remove tests for now
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.
Thanks for the PR! Looks great and is a super useful addition! There is a small bug I think with table names, but I will take care of fixing these in a cleanup PR.
|
||
self.send(msg) | ||
|
||
def table(self, data, index=None, limit=None, name=str(random())): |
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.
The default argument to name
here is evaluated once when the method is created, so all proxy tables will have the same name.
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.
yup - that is a silly mistake on my part
from .view_api import view as make_view | ||
|
||
|
||
def table(client, data, index=None, limit=None, name=str(random())): |
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.
Same, and also it's probably a good idea to just make name
a required arg here as this table
is private to the library.
def remove_port(self): | ||
return self._async_queue("remove_port", "table_method") | ||
|
||
def compute(self): |
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.
Unrelated - but I think we can deprecate this "feature flag" - its implementation returns true for JS and Python
@@ -4,226 +4,4 @@ | |||
# | |||
# This file is part of the Perspective library, distributed under the terms of | |||
# the Apache License 2.0. The full license can be found in the LICENSE file. |
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.
Empty file
@@ -15,11 +15,13 @@ def test_remove_all(self): | |||
tbl = Table([{"a": "abc", "b": 123}], index="a") | |||
tbl.remove(["abc"]) | |||
assert tbl.view().to_records() == [] | |||
# assert tbl.size() == 0 |
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.
Only adds commented blocks
Also - I believe the FOSSA check is either malfunctioning or has recently received an update to its detection criteria. This PR specifically does not introduce dependencies, so if there are legitimate failures, they are pre-existing regardless. Thus, I'm going to override this check. |
This PR introduces
PerspectiveClient
, which mimics the Javascript client implementation by offering a fully async (asyncio
oryield
-based) API on top of the coreTable
andView
public API. This is useful for testingperspective-python
servers, as it offers programmatic access to Perspective's public API in Python.PerspectiveTornadoClient
is an implementation of the client API that allows users to open up remoteTable
s andView
s on aperspective-python
server, and treat them as if they were objects in the client runtime using eitherawait
oryield
.The interface is extremely simple, using
async
andawait
:or
yield
-based coroutines: