Renga CLI and SDK for Python¶
A Python library for the Renga collaborative data science platform. It lets you perform any action with
renga
command or from withing Python apps - create projects, manage
buckets, track files, run containers, etc.
Renga is currently undergoing a major restructuring effort. For a preview, you can look at the development branch, but keep in mind it is highly volatile.
- NOTE:
renga-python
is the python library for Renga that provides an SDK and a command-line interface (CLI). It does not start the Renga platform itself - for that, refer to the Renga docs on running the platform.
This is an experimental developer preview release.
Installation¶
The latest release is available on PyPI and can be installed using
pip
:
$ pip install renga
The development version can be installed directly from the Git repository:
$ pip install -e git+https://github.com/SwissDataScienceCenter/renga-python.git#egg=renga
For more information about the Renga API see its documentation.
Getting started¶
To instantiate a Renga client from a running notebook on the platform, you
can use from_env()
helper function.
import renga
client = renga.from_env()
You can now upload files to new bucket:
>>> bucket = client.buckets.create('first-bucket')
>>> with bucket.files.open('greeting.txt', 'w') as fp:
... fp.write('hello world')
You can access files from a bucket:
>>> client.buckets.list()[0].files.list()[0].open('r').read()
b'hello world'
For more details and examples have a look at the reference.
Use the Renga command line¶
Interaction with the platform can also take place via the command-line interface (CLI).
First, you need to authenticate with an existing instance of the Renga
platform. The example shows a case when you have the platform running on
localhost
.
$ renga login http://localhost
Username: demo
Password: ****
Access token has been stored in: ...
Following the above example you can create a first bucket and upload a file.
$ export BUCKET_ID=$(renga io buckets create first-bucket)
$ echo "hello world" | renga io buckets $BUCKET_ID upload --name greeting.txt
9876
For more information about using renga, refer to the Renga command line instructions.