A client library and CLI for interacting with a Hoss server.
Project description
Python Client Library
The Hoss client library provides Python bindings for interacting with a Hoss server and the data stored within it.
Installing the Client Library from pypi
- Create a virtualenv using Python 3.6 or later
- Run
pip install -U hoss-client
Installing the Client Library from source
- Create a virtualenv using Python 3.6 or later
- Clone this repo
- Run
pip3 install .
to install thehoss-client
library
Getting Started
Once you have access to a Hoss server, you must create a personal access token to interact with the API. Log in and navigate to the "personal access token" page using the drop down menu in the top right corner. Then create a new personal access token.
Set the HOSS_PAT
environmental variable to this token before using the client library (e.g. export HOSS_PAT=hp_mytoken
).
The client library will automatically (via the AuthService
class) handle getting a JWT as needed and check of the JWT has expired (and get a new JWT when that happens).
Then you can connect to the server and get started:
import hoss
import os
server = hoss.connect('https://hoss.my-domain.com')
CLI Interface
The Hoss client library also provides a CLI when installed. Run hoss -h
in your virtualenv to see available commands
The primary function currently provided by the CLI is an upload tool. This tool currently is optimized to upload a directory of medium to large files.
The the directory that you provide will be created in the specified dataset and all files that do not match the optional skip regex will be uploaded.
Files that already exist in the destination will not be uploaded again. Remember, you must set the HOSS_PAT
env var before running the tool.
hoss upload <dataset name> <absolute path to the upload dir>
You can optionally write metadata key-value pairs using the -m flag (i.e -m subject_id=123). Multiple -m optional args are supported.
You can optionally filter out files to upload using a regex string with the --skip arg.
You can specify the endpoint (defaults to localhost) using the --endpoint arg.
Examples
There are examples available in the client/examples
directory. In particular, the client/examples/notebooks
directory contains useful example Jupyter notebooks.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hoss-client-0.6.2.tar.gz
.
File metadata
- Download URL: hoss-client-0.6.2.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 094b555982fa12d42b38933d7c68a483f0864dfdede2ac64225c2f3a1d14c41c |
|
MD5 | 76769a9db38374e66baa47dde565dde1 |
|
BLAKE2b-256 | 766b98b1e8af8fc21cfd70f0637c961bb645cb06b2bd647f7e6032dd942a0735 |
File details
Details for the file hoss_client-0.6.2-py3-none-any.whl
.
File metadata
- Download URL: hoss_client-0.6.2-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46f528d54270cd5a572e6787270f2ffaccbfc1d0ce55f704de73c8a2730cf73a |
|
MD5 | 32bc20492d3aed8926d0c57ad0478fb2 |
|
BLAKE2b-256 | ebe4d76381885c17d9a6910020fdf692e3773e4633ca3a8dcb5de075e91d166a |