Skip to content
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

Merged
merged 3 commits into from
Jul 25, 2018
Merged

Add python client library #474

merged 3 commits into from
Jul 25, 2018

Conversation

tribal-tec
Copy link
Contributor

@tribal-tec tribal-tec commented Jul 25, 2018

  • '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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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 😄

"""
for i in root_object.keys():
enum = None
if 'enum' in root_object.propinfo(i):
Copy link
Contributor

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?

value = class_type(())

# add member and property to target_object
member = '_' + os.path.basename(registry_entry).replace('-', '_')
Copy link
Contributor

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,
Copy link
Contributor

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})
Copy link
Contributor

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.)?

if status.code != HTTP_STATUS_OK:
raise Exception('Cannot obtain version from Brayns')

minimal_version = '0.7.0'
Copy link
Contributor

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?

:raises Exception: if request was not answered within given response_timeout
"""
data = dict()
data['jsonrpc'] = "2.0"
Copy link
Contributor

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"?

@tribal-tec tribal-tec merged commit 0f044be into BlueBrain:master Jul 25, 2018
@tribal-tec tribal-tec deleted the python branch July 25, 2018 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants