Metadata-Version: 2.1
Name: primehub-python-sdk
Version: 0.1.0
Summary: PrimeHub Python SDK
Home-page: https://github.com/InfuseAI/primehub-python-sdk
Author: qrtt1
Author-email: qrtt1@infuseai.io
License: UNKNOWN
Project-URL: Bug Tracker, https://github.com/InfuseAI/primehub/issues
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 2 - Pre-Alpha
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Provides-Extra: dev
License-File: LICENSE

# PrimeHub Python SDK

PrimeHub Python SDK provides a python library to communicate with PrimeHub API

## Installation

Install the SDK from source code

```
git clone https://github.com/InfuseAI/primehub-python-sdk.git
cd primehub-python-sdk
pip install -e .[dev]
```

Verify it with `primehub` command:

```bash
Usage:
  primehub <command>

Available Commands:
  config               Update the settings of PrimeHub SDK
  datasets             Get a dataset or list datasets
  files                List and download shared files
  group                Get a group or list groups
  images               Get a image or list images
  info                 Display the user information and the selected group information
  instancetypes        Get an instance types of list instance types
  jobs                 Get a job or list jobs
  me                   Show user account
  notebooks            Get notebooks logs
  schedules            Get a schedule or list schedules

Options:
  -h, --help           Show the help

Global Options:
  --config CONFIG      the path of the config file
  --endpoint ENDPOINT  the endpoint to the PrimeHub GraphQL URL
  --token TOKEN        API Token generated from PrimeHub Console
  --group GROUP        override the active group
```

## Configuration

PrimeHub Python SDK needs the `~/.primehub/config.json` to connect to your PrimeHub API server.

```json
{
  "api-token": "<api-token>",
  "endpoint": "https://<primehub-server-domain>/api/graphql",
  "group": {
    "name": "<the-name-of-current-group>"
  }
}
```

* api-token and endpoint: please generate your own api-token and get the endpoint from the PrimeHub Console
* group: the name of a group. If the SDK did a group-context aware query, the group name would be used. It would raise an exception when the group was not available.

The configuration could verify by `me`：

```
$ primehub me | jq .
{
  "id": "a932f38d-cca7-4846-5566-b2958949e7c9",
  "username": "jovyan",
  "firstName": "",
  "lastName": "",
  "email": "jovyan@infuseai.io,
  "isAdmin": true
}
```

