-
Notifications
You must be signed in to change notification settings - Fork 47
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 library #474
Conversation
tribal-tec
commented
Jul 25, 2018
•
edited
Loading
edited
- 'building', testing and deployment on PyPI via travis-ci
- documentation hosting on readthedocs
* 'building', testing and deployment on PyPI via travis-ci * documentation hosting on readthedocs
.idea/ | ||
brayns.egg-info/ | ||
.installed | ||
pycodestyle.txt |
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.
Don't we want to keep these code style settings so we're consistent on any machine a dev would work on?
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.
That's the output file telling you about code style violations. The settings are in setup.cfg and in pylintrc.
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.
Ok, the names were misleading 😄
python/brayns/api_generator.py
Outdated
""" | ||
for i in root_object.keys(): | ||
enum = None | ||
if 'enum' in root_object.propinfo(i): |
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.
root_object.propinfo(i)
is used more than a couple of times, maybe put it in a var?
python/brayns/api_generator.py
Outdated
value = class_type(()) | ||
|
||
# add member and property to target_object | ||
member = '_' + os.path.basename(registry_entry).replace('-', '_') |
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.
.replace('-', '_')
is used more than a couple of times, make a fn?
# pylint: disable=E1101 | ||
version = 'unknown' | ||
if self.version: | ||
version = '.'.join(str(x) for x in [self.version.major, self.version.minor, |
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.
Semver should be <major>.<minor>.<patch>
, the revision should probably be separate.
""" | ||
args = locals() | ||
del args['self'] | ||
result = self.snapshot(response_timeout=None, **{k: v for k, v in args.items() if v}) |
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.
I imagine .snapshot()
is one of the dynamically generated fns. If that's the case, could this .image()
fn accept all that the snapshot would (renderer, etc.)?
python/brayns/client.py
Outdated
if status.code != HTTP_STATUS_OK: | ||
raise Exception('Cannot obtain version from Brayns') | ||
|
||
minimal_version = '0.7.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.
Maybe we could keep this min version in the same version file where we have the python version for the lib?
python/brayns/rpcclient.py
Outdated
:raises Exception: if request was not answered within given response_timeout | ||
""" | ||
data = dict() | ||
data['jsonrpc'] = "2.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.
Make a var for the rpc version JSON_RPC_VERSION = "2.0"
?