DesignSafe API
Project description
DesignSafe API (dapi)
dapi is a library that simplifies the process of submitting, running, and monitoring TAPIS v3 jobs on DesignSafe via Jupyter Notebooks.
Features
Jobs
-
Get TAPIS v3 templates for jobs: No need to fiddle with complex API requests.
dapiabstracts away the complexities. -
Seamless Integration with DesignSafe Jupyter Notebooks: Launch DesignSafe applications directly from the Jupyter environment.
Database
Connects to SQL databases on DesignSafe:
| Database | dbname | env_prefix |
|---|---|---|
| NGL | ngl |
NGL_ |
| Earthake Recovery | eq |
EQ_ |
| Vp | vp |
VP_ |
Define the following environment variables:
{env_prefix}DB_USER
{env_prefix}DB_PASSWORD
{env_prefix}DB_HOST
{env_prefix}DB_PORT
For e.g., to add the environment variable NGL_DB_USER edit ~/.bashrc, ~/.zshrc, or a similar shell-specific configuration file for the current user and add export NGL_DB_USER="dspublic".
Installation
Install dapi via pip
pip3 install dapi
To install the current development version of the library use:
pip install git+https://github.com/DesignSafe-CI/dapi.git --quiet
Example usage:
Storing credentials
Dapi uses the Tapis v3 SDK to authenticate with the DesignSafe API. To store your credentials, create a .env file in the root of your project with the following content:
DESIGNSAFE_USERNAME=<your_designsafe_username>
DESIGNSAFE_PASSWORD=<your_designsafe_password>
Jobs
-
Jupyter Notebook Templates using dapi.
-
View dapi API doc
Install the latest version of dapi and restart the kernel (Kernel >> Restart Kernel):
# Remove any previous installations
!pip uninstall dapi -y
# Install
!pip install dapi --quiet
- Import
dapilibrary
import dapi
- To list all functions in
dapi
dir(dapi)
Database
from dapi.db import DSDatabase
db = DSDatabase("ngl")
sql = 'SELECT * FROM SITE'
df = db.read_sql(sql)
print(df)
# Optionally, close the database connection when done
db.close()
Support
For any questions, issues, or feedback submit an issue
Development
To develop or test the library locally. Install Poetry. In the current repository run the following commands
poetry shell
poetry install
poetry build
To run the unit test
poetry run pytest -v
License
dapi is licensed under the MIT License.
Authors
- Krishna Kumar, University of Texas at Austin
- Prof. Pedro Arduino, University of Washington
- Prof. Scott Brandenberg, University of California Los Angeles
Documentation
View dapi API doc
Running documentation locally
To serve the MkDocs documentation locally:
poetry install
poetry run mkdocs serve
This will start a local server at http://127.0.0.1:8000/dapi/ where you can view the documentation.
API docs
To generate API docs:
pdoc --html --output-dir api-docs dapi --force
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dapi-0.4.5.tar.gz.
File metadata
- Download URL: dapi-0.4.5.tar.gz
- Upload date:
- Size: 37.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4054d47c2b31a54f03ba5dd0b997ae73cff2183415b2067120c44fb6b5f3aee
|
|
| MD5 |
a95503c9f6120c7068df74fd31cc42e5
|
|
| BLAKE2b-256 |
439e928310ae7d994d9fecdbbd82da9c1e943587e753ebed023906e670e9a718
|
Provenance
The following attestation bundles were made for dapi-0.4.5.tar.gz:
Publisher:
pypi.yml on DesignSafe-CI/dapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dapi-0.4.5.tar.gz -
Subject digest:
b4054d47c2b31a54f03ba5dd0b997ae73cff2183415b2067120c44fb6b5f3aee - Sigstore transparency entry: 234167698
- Sigstore integration time:
-
Permalink:
DesignSafe-CI/dapi@3a52d7b52f879c1476cecfe91a1c6498419a7af9 -
Branch / Tag:
refs/tags/v0.4.5 - Owner: https://github.com/DesignSafe-CI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@3a52d7b52f879c1476cecfe91a1c6498419a7af9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dapi-0.4.5-py3-none-any.whl.
File metadata
- Download URL: dapi-0.4.5-py3-none-any.whl
- Upload date:
- Size: 42.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3e49314bfd4f981dce5b723f07e347acd8f7355801b61f780bfedfaef20e7fd
|
|
| MD5 |
03796747e6bbf05d3804c05f1e63ab1b
|
|
| BLAKE2b-256 |
071ea99b08d4b0f2c283e9d2b6a1746c5bd58d21f6a39fda854d741746ff9850
|
Provenance
The following attestation bundles were made for dapi-0.4.5-py3-none-any.whl:
Publisher:
pypi.yml on DesignSafe-CI/dapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dapi-0.4.5-py3-none-any.whl -
Subject digest:
d3e49314bfd4f981dce5b723f07e347acd8f7355801b61f780bfedfaef20e7fd - Sigstore transparency entry: 234167699
- Sigstore integration time:
-
Permalink:
DesignSafe-CI/dapi@3a52d7b52f879c1476cecfe91a1c6498419a7af9 -
Branch / Tag:
refs/tags/v0.4.5 - Owner: https://github.com/DesignSafe-CI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@3a52d7b52f879c1476cecfe91a1c6498419a7af9 -
Trigger Event:
push
-
Statement type: