Crux Python Client

A Python library for interacting with the Crux platform.

The aim of this client is to be a Pythonic way to use the Crux API reliably. It covers core functionality, such as uploading and downloading files, but does not cover all API functionality. It isn’t an SDK.

Python 3.6+ is recommended. Python 2.7 and 3.5 are supported but deprecated, with support planned for removal in early-2020 and mid-2020 respectively.

This library is ALPHA. Breaking changes are expected. Pin to a specific version when using this library, and test upgrades thoroughly.

Source code is available on GitHub at github.com/cruxinformatics/crux-python.

Installation

Install a recent version of Python, and a Python dependency and virtual environment manager like pipenv. On macOS run:

brew install python
brew install pipenv

Install crux from PyPI in a virtual environment, and get a shell in that environment:

mkdir -p crux_example
cd crux_example
pipenv install "crux==0.0.21"
pipenv shell

Getting Started

Create a file, like example.py, and use the crux module:

from crux import Crux

conn = Crux()
identity = conn.whoami()
print("I am", identity.email)

Run the script:

HISTCONTROL=ignoreboth
 export CRUX_API_KEY='YOUR_API_KEY'
python3 example.py

See the installation and authentication documentation for details.