OpenHexa SDK
Project description
OpenHexa Python SDK
The OpenHexa Python SDK is a tool that helps you write code for the OpenHexa platform.
It is particularly useful to write OpenHexa data pipelines, but can also be used in the OpenHexa notebooks environment.
Writing data pipelines
TBC
Using the SDK in the notebooks environment
TBC
Running the examples
Clone the repo and install the dependencies, including the ones required to run the examples:
git checkout https://github.com/BLSQ/openhexa-sdk-python.git
pip install ".[examples]"
Run a pipeline:
cd examples/pipelines/logistic_stats
python pipeline.py -c '{"deg":"qfxEYY9xAl6","periods":["2022Q1","2022Q2"]}'
Or using a config file:
cd examples/pipelines/logistic_stats
python pipeline.py -f example_conf.json
Using the CLI
Now that your pipeline is functional, you can push it to the OpenHexa backend so that it can run online.
As code and data are organized with workspaces, the first think to do is to activate a workspace using the CLI.
Using the OpenHexa interface, chose a workspace, click on the "Pipelines" section and then on the "Create" call-to-action at the top-right of the header. You will find ready-to use instructions on how to activate the workspace, as well as the API token you need to use.
The command looks as follows:
openhexa workspaces add <workspace_slug>
You can then push your pipeline:
openhexa pipelines push <pipeline_directory>
Development & testing
Development setup
Install the SDK in editable mode:
python -m venv venv # Create a virtual environment for this project
source venv/bin/activate # Activate the venv
pip install -r requirements.txt
pip install -e ".[dev]" # Necessary to be able to run the openhexa CLI
Using a local installation of the OpenHexa backend to run pipelines
openhexa config set_url http://localhost:8000
Notes: you can monitor the status of your pipelines using http://localhost:8000/pipelines/status
Running the tests
Run the tests using pytest:
pytest
Publishing the pipelines image
The docker image openhexa-pipelines
is still build and published manually. Follow the steps below to publish a new docker image.
cd openhexa-sdk-python
python -m build .
mv dist/*.whl docker/
cd docker
docker build -t openhexa-pipelines .
docker tag openhexa-pipelines blsq/openhexa-pipelines:latest
docker push blsq/openhexa-pipelines:latest
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 openhexa.sdk-0.1.2.tar.gz
.
File metadata
- Download URL: openhexa.sdk-0.1.2.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48e091b688c6d04acd08461c755c7ea65282e810d88f2bfb986335e957b35e46 |
|
MD5 | 0e3dc930b3af4a76e15ca0ef45413449 |
|
BLAKE2b-256 | c03e9b2060cdd89e72a0d4d7c9dcf3c6734c0f5492db7bbd7a1d7978d83412d0 |
File details
Details for the file openhexa.sdk-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: openhexa.sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 22.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a299843d14ab7c7d81020ca7c8ce07d8c8430c9656e68dd31414244982c39859 |
|
MD5 | b15b7c2bc5eebc8489ea40d09e455c37 |
|
BLAKE2b-256 | 6e030b21bf18ef6ad547c9bb60e17c472687e67454b38d3059605bf665141ee0 |