Skip to main content

A client library and CLI for interacting with a Hoss server.

Project description

Hoss

Python Client Library

pypi python versions Documentation Status

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

  1. Create a virtualenv using Python 3.6 or later
  2. Run pip install -U hoss-client

Installing the Client Library from source

  1. Create a virtualenv using Python 3.6 or later
  2. Clone this repo
  3. Run pip3 install . to install the hoss-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.

Development

Testing

This library is effectively tested via the Hoss integration test suite. These tests should be run or updated as needed before accepting PRs.

Docs

Docs are automatically built and published via GitHub actions to Read The Docs.

To edit and view locally:

  • Set up a virtualenv using the dependencies in docs/requirements.txt.
  • Install the hoss-client dependencies using something like pip install .
  • Use Makefile to render your changes
    cd docs
    make html
    
  • Then open docs/build/html/index.html in your browser.

Release

To cut a new release, increment the library version in hoss/version.py. Then tag main using the same version. GitHub Actions will automatically update the "stable" docs and push a release to pypi.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hoss-client-0.7.3.tar.gz (33.8 kB view details)

Uploaded Source

Built Distribution

hoss_client-0.7.3-py3-none-any.whl (44.0 kB view details)

Uploaded Python 3

File details

Details for the file hoss-client-0.7.3.tar.gz.

File metadata

  • Download URL: hoss-client-0.7.3.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for hoss-client-0.7.3.tar.gz
Algorithm Hash digest
SHA256 90855a67fbef68f3ef997ee608213cc24408f1dace10487d14be4f1e308aaa6d
MD5 2464120df281af8b79161c3ae6b1454c
BLAKE2b-256 513edc99a8f1052895769fda1d15b423a32622680f595e09bd3e07ccf9ba9482

See more details on using hashes here.

File details

Details for the file hoss_client-0.7.3-py3-none-any.whl.

File metadata

  • Download URL: hoss_client-0.7.3-py3-none-any.whl
  • Upload date:
  • Size: 44.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for hoss_client-0.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 abcf1d13e66bdd6538346fd47f143e6e40c231852d5636e1c12311c38db2ab0a
MD5 71f071c1670c6dfdbd24acc6e1d5d6fe
BLAKE2b-256 5965b22275a948ba116c3d23dad5c127839c3f544ae7e75f11f7f54be6066d59

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page