superbio 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- superbio-0.1.0/MANIFEST.in +3 -0
- superbio-0.1.0/PKG-INFO +173 -0
- superbio-0.1.0/README.md +153 -0
- superbio-0.1.0/pyproject.toml +4 -0
- superbio-0.1.0/requirements.txt +6 -0
- superbio-0.1.0/setup.cfg +4 -0
- superbio-0.1.0/setup.py +40 -0
- superbio-0.1.0/superbio/__init__.py +1 -0
- superbio-0.1.0/superbio/auth.py +33 -0
- superbio-0.1.0/superbio/client.py +490 -0
- superbio-0.1.0/superbio/endpoints.py +0 -0
- superbio-0.1.0/superbio/exceptions.py +0 -0
- superbio-0.1.0/superbio/utils.py +63 -0
- superbio-0.1.0/superbio.egg-info/PKG-INFO +173 -0
- superbio-0.1.0/superbio.egg-info/SOURCES.txt +21 -0
- superbio-0.1.0/superbio.egg-info/dependency_links.txt +1 -0
- superbio-0.1.0/superbio.egg-info/requires.txt +8 -0
- superbio-0.1.0/superbio.egg-info/top_level.txt +2 -0
- superbio-0.1.0/tests/__init__.py +1 -0
- superbio-0.1.0/tests/conftest.py +49 -0
- superbio-0.1.0/tests/test_auth.py +123 -0
- superbio-0.1.0/tests/test_client.py +227 -0
- superbio-0.1.0/tests/test_utils.py +126 -0
superbio-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: superbio
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for the Superbio API
|
|
5
|
+
Home-page: https://github.com/Superbio-ai/superbioAPI
|
|
6
|
+
Author: Superbio
|
|
7
|
+
Author-email: dmason@superbio.ai
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Requires-Python: >=3.7
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
|
|
21
|
+
# Superbio Python Client
|
|
22
|
+
|
|
23
|
+
Official Python client for the [Superbio](https://app.superbio.ai) platform API. Access bioinformatics tools and AI models programmatically.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
```bash
|
|
27
|
+
pip install superbio
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
```python
|
|
32
|
+
from superbio import Client
|
|
33
|
+
|
|
34
|
+
# Initialize client
|
|
35
|
+
client = Client("your@email.com", "your_password")
|
|
36
|
+
|
|
37
|
+
# List available apps
|
|
38
|
+
apps = client.get_app_list()
|
|
39
|
+
|
|
40
|
+
# Get app parameters
|
|
41
|
+
app_params = client.get_app_parameters("app_id")
|
|
42
|
+
|
|
43
|
+
# Submit a job with local files
|
|
44
|
+
job = client.post_job(
|
|
45
|
+
app_id="app_id",
|
|
46
|
+
running_mode="cpu",
|
|
47
|
+
config={"param": "value"},
|
|
48
|
+
local_files={"file_key": "path/to/file"}
|
|
49
|
+
)
|
|
50
|
+
```
|
|
51
|
+
## Submit a job with S3 files
|
|
52
|
+
```python
|
|
53
|
+
job = client.post_job(
|
|
54
|
+
app_id="app_id",
|
|
55
|
+
running_mode="cpu",
|
|
56
|
+
config={"param": "value"},
|
|
57
|
+
remote_file_source_data={
|
|
58
|
+
"file_key": [{
|
|
59
|
+
"protocol": "s3",
|
|
60
|
+
"credentials": {
|
|
61
|
+
"aws_access_key_id": "YOUR_ACCESS_KEY",
|
|
62
|
+
"aws_secret_access_key": "YOUR_SECRET_KEY"
|
|
63
|
+
},
|
|
64
|
+
"path": "bucket/path/to/file.csv"
|
|
65
|
+
}]
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
```
|
|
69
|
+
Check job status
|
|
70
|
+
```python
|
|
71
|
+
status = client.get_job_status("job_id")
|
|
72
|
+
```
|
|
73
|
+
Download results
|
|
74
|
+
```python
|
|
75
|
+
client.download_job_results("job_id", "output_directory")
|
|
76
|
+
```
|
|
77
|
+
## Features
|
|
78
|
+
|
|
79
|
+
- Browse and search available bioinformatics applications
|
|
80
|
+
- Get detailed app configurations and parameters
|
|
81
|
+
- Submit computational jobs with:
|
|
82
|
+
- Local files
|
|
83
|
+
- Remote files (S3)
|
|
84
|
+
- Files from Superbio DataHub
|
|
85
|
+
- Monitor job status and progress
|
|
86
|
+
- Download and manage results
|
|
87
|
+
- Track credit balances and usage
|
|
88
|
+
|
|
89
|
+
## Authentication
|
|
90
|
+
|
|
91
|
+
You must first create an account at [app.superbio.ai](https://app.superbio.ai). Your email and password from the platform will be used to authenticate API requests.
|
|
92
|
+
|
|
93
|
+
<!-- ## Documentation
|
|
94
|
+
|
|
95
|
+
For complete API documentation and examples, visit [docs.superbio.ai](https://docs.superbio.ai). -->
|
|
96
|
+
|
|
97
|
+
## Examples
|
|
98
|
+
|
|
99
|
+
### Working with Apps
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
# Get list of all apps
|
|
103
|
+
apps = client.get_app_list()
|
|
104
|
+
|
|
105
|
+
# List apps with pagination and search
|
|
106
|
+
apps = client.get_app_list(
|
|
107
|
+
hits_per_page=10, # (optional) Number of results per page
|
|
108
|
+
page=1, # (optional) Page number
|
|
109
|
+
search_string="genomics" # (optional)Search by keyword
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
# Get app details and parameters
|
|
113
|
+
app_config = client.get_app_parameters("app_id")
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Job Management
|
|
117
|
+
```python
|
|
118
|
+
# List jobs with filters
|
|
119
|
+
jobs = client.get_jobs(
|
|
120
|
+
hits_per_page=100, # (optional) Number of jobs per page
|
|
121
|
+
page=1, # (optional) Page number
|
|
122
|
+
status="running", # (optional) Filter by status: "running", "completed", "failed", etc.
|
|
123
|
+
date_from="01/01/2024", # (optional) Filter by start date (dd/mm/yyyy)
|
|
124
|
+
date_to="31/01/2024", # Filter by end date (dd/mm/yyyy)
|
|
125
|
+
search_string="analysis" # Search job titles
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
# Download specific result files
|
|
129
|
+
client.download_job_result_file(
|
|
130
|
+
job_id="job_id",
|
|
131
|
+
file_path="path/to/result.csv", # Path of file in job results
|
|
132
|
+
output_dir="output_dir", # Local directory to save file
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
# Download all results
|
|
136
|
+
client.download_all_job_results(
|
|
137
|
+
job_id="job_id",
|
|
138
|
+
output_dir="output_dir", # Local directory to save files
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
# Delete a job
|
|
142
|
+
client.delete_job("job_id")
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Credit Management
|
|
146
|
+
```python
|
|
147
|
+
# Get credit balances and usage info
|
|
148
|
+
balances = client.get_balances()
|
|
149
|
+
# Returns:
|
|
150
|
+
# {
|
|
151
|
+
# "balances": {
|
|
152
|
+
# "available_credits": 6000,
|
|
153
|
+
# "credits": 6000,
|
|
154
|
+
# "runs_left": 400,
|
|
155
|
+
# "total_runs": 400,
|
|
156
|
+
# "runtime_left": 72000.0,
|
|
157
|
+
# "total_runtime": 72000,
|
|
158
|
+
# "runs_reset_time": "Feb 28 2025, 23:08:05",
|
|
159
|
+
# "runtime_reset_time": "Feb 28 2025, 23:08:05",
|
|
160
|
+
# "tier": "free_organisation"
|
|
161
|
+
# }
|
|
162
|
+
# }
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Support
|
|
166
|
+
|
|
167
|
+
For support, contact dmason@superbio.ai.
|
|
168
|
+
<!-- For support, contact dmason@superbio.ai or visit our [documentation](https://docs.superbio.ai). -->
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
<!-- ## License
|
|
172
|
+
|
|
173
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. -->
|
superbio-0.1.0/README.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Superbio Python Client
|
|
2
|
+
|
|
3
|
+
Official Python client for the [Superbio](https://app.superbio.ai) platform API. Access bioinformatics tools and AI models programmatically.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
```bash
|
|
7
|
+
pip install superbio
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
```python
|
|
12
|
+
from superbio import Client
|
|
13
|
+
|
|
14
|
+
# Initialize client
|
|
15
|
+
client = Client("your@email.com", "your_password")
|
|
16
|
+
|
|
17
|
+
# List available apps
|
|
18
|
+
apps = client.get_app_list()
|
|
19
|
+
|
|
20
|
+
# Get app parameters
|
|
21
|
+
app_params = client.get_app_parameters("app_id")
|
|
22
|
+
|
|
23
|
+
# Submit a job with local files
|
|
24
|
+
job = client.post_job(
|
|
25
|
+
app_id="app_id",
|
|
26
|
+
running_mode="cpu",
|
|
27
|
+
config={"param": "value"},
|
|
28
|
+
local_files={"file_key": "path/to/file"}
|
|
29
|
+
)
|
|
30
|
+
```
|
|
31
|
+
## Submit a job with S3 files
|
|
32
|
+
```python
|
|
33
|
+
job = client.post_job(
|
|
34
|
+
app_id="app_id",
|
|
35
|
+
running_mode="cpu",
|
|
36
|
+
config={"param": "value"},
|
|
37
|
+
remote_file_source_data={
|
|
38
|
+
"file_key": [{
|
|
39
|
+
"protocol": "s3",
|
|
40
|
+
"credentials": {
|
|
41
|
+
"aws_access_key_id": "YOUR_ACCESS_KEY",
|
|
42
|
+
"aws_secret_access_key": "YOUR_SECRET_KEY"
|
|
43
|
+
},
|
|
44
|
+
"path": "bucket/path/to/file.csv"
|
|
45
|
+
}]
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
```
|
|
49
|
+
Check job status
|
|
50
|
+
```python
|
|
51
|
+
status = client.get_job_status("job_id")
|
|
52
|
+
```
|
|
53
|
+
Download results
|
|
54
|
+
```python
|
|
55
|
+
client.download_job_results("job_id", "output_directory")
|
|
56
|
+
```
|
|
57
|
+
## Features
|
|
58
|
+
|
|
59
|
+
- Browse and search available bioinformatics applications
|
|
60
|
+
- Get detailed app configurations and parameters
|
|
61
|
+
- Submit computational jobs with:
|
|
62
|
+
- Local files
|
|
63
|
+
- Remote files (S3)
|
|
64
|
+
- Files from Superbio DataHub
|
|
65
|
+
- Monitor job status and progress
|
|
66
|
+
- Download and manage results
|
|
67
|
+
- Track credit balances and usage
|
|
68
|
+
|
|
69
|
+
## Authentication
|
|
70
|
+
|
|
71
|
+
You must first create an account at [app.superbio.ai](https://app.superbio.ai). Your email and password from the platform will be used to authenticate API requests.
|
|
72
|
+
|
|
73
|
+
<!-- ## Documentation
|
|
74
|
+
|
|
75
|
+
For complete API documentation and examples, visit [docs.superbio.ai](https://docs.superbio.ai). -->
|
|
76
|
+
|
|
77
|
+
## Examples
|
|
78
|
+
|
|
79
|
+
### Working with Apps
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
# Get list of all apps
|
|
83
|
+
apps = client.get_app_list()
|
|
84
|
+
|
|
85
|
+
# List apps with pagination and search
|
|
86
|
+
apps = client.get_app_list(
|
|
87
|
+
hits_per_page=10, # (optional) Number of results per page
|
|
88
|
+
page=1, # (optional) Page number
|
|
89
|
+
search_string="genomics" # (optional)Search by keyword
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
# Get app details and parameters
|
|
93
|
+
app_config = client.get_app_parameters("app_id")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Job Management
|
|
97
|
+
```python
|
|
98
|
+
# List jobs with filters
|
|
99
|
+
jobs = client.get_jobs(
|
|
100
|
+
hits_per_page=100, # (optional) Number of jobs per page
|
|
101
|
+
page=1, # (optional) Page number
|
|
102
|
+
status="running", # (optional) Filter by status: "running", "completed", "failed", etc.
|
|
103
|
+
date_from="01/01/2024", # (optional) Filter by start date (dd/mm/yyyy)
|
|
104
|
+
date_to="31/01/2024", # Filter by end date (dd/mm/yyyy)
|
|
105
|
+
search_string="analysis" # Search job titles
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
# Download specific result files
|
|
109
|
+
client.download_job_result_file(
|
|
110
|
+
job_id="job_id",
|
|
111
|
+
file_path="path/to/result.csv", # Path of file in job results
|
|
112
|
+
output_dir="output_dir", # Local directory to save file
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# Download all results
|
|
116
|
+
client.download_all_job_results(
|
|
117
|
+
job_id="job_id",
|
|
118
|
+
output_dir="output_dir", # Local directory to save files
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
# Delete a job
|
|
122
|
+
client.delete_job("job_id")
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Credit Management
|
|
126
|
+
```python
|
|
127
|
+
# Get credit balances and usage info
|
|
128
|
+
balances = client.get_balances()
|
|
129
|
+
# Returns:
|
|
130
|
+
# {
|
|
131
|
+
# "balances": {
|
|
132
|
+
# "available_credits": 6000,
|
|
133
|
+
# "credits": 6000,
|
|
134
|
+
# "runs_left": 400,
|
|
135
|
+
# "total_runs": 400,
|
|
136
|
+
# "runtime_left": 72000.0,
|
|
137
|
+
# "total_runtime": 72000,
|
|
138
|
+
# "runs_reset_time": "Feb 28 2025, 23:08:05",
|
|
139
|
+
# "runtime_reset_time": "Feb 28 2025, 23:08:05",
|
|
140
|
+
# "tier": "free_organisation"
|
|
141
|
+
# }
|
|
142
|
+
# }
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Support
|
|
146
|
+
|
|
147
|
+
For support, contact dmason@superbio.ai.
|
|
148
|
+
<!-- For support, contact dmason@superbio.ai or visit our [documentation](https://docs.superbio.ai). -->
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
<!-- ## License
|
|
152
|
+
|
|
153
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. -->
|
superbio-0.1.0/setup.cfg
ADDED
superbio-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r", encoding="utf-8") as fh:
|
|
4
|
+
long_description = fh.read()
|
|
5
|
+
|
|
6
|
+
setup(
|
|
7
|
+
name="superbio",
|
|
8
|
+
version="0.1.0",
|
|
9
|
+
author="Superbio",
|
|
10
|
+
author_email="dmason@superbio.ai",
|
|
11
|
+
description="Python client for the Superbio API",
|
|
12
|
+
long_description=long_description,
|
|
13
|
+
long_description_content_type="text/markdown",
|
|
14
|
+
url="https://github.com/Superbio-ai/superbioAPI",
|
|
15
|
+
packages=find_packages(),
|
|
16
|
+
classifiers=[
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.7",
|
|
23
|
+
"Programming Language :: Python :: 3.8",
|
|
24
|
+
"Programming Language :: Python :: 3.9",
|
|
25
|
+
"Programming Language :: Python :: 3.10",
|
|
26
|
+
],
|
|
27
|
+
python_requires=">=3.7",
|
|
28
|
+
install_requires=[
|
|
29
|
+
"requests>=2.25.0",
|
|
30
|
+
"requests-toolbelt>=0.9.1"
|
|
31
|
+
],
|
|
32
|
+
extras_require={
|
|
33
|
+
"dev": [
|
|
34
|
+
"pytest>=7.0.0",
|
|
35
|
+
"pytest-mock>=3.10.0",
|
|
36
|
+
"requests-mock>=1.10.0",
|
|
37
|
+
"coverage>=7.0.0"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .client import Client
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AuthManager:
|
|
5
|
+
def __init__(self, base_url, email, password, token=None, user_id=None):
|
|
6
|
+
self.base_url = base_url
|
|
7
|
+
self.email = email
|
|
8
|
+
self.password = password
|
|
9
|
+
self.token = token
|
|
10
|
+
self.user_id = user_id
|
|
11
|
+
self.login()
|
|
12
|
+
|
|
13
|
+
def login(self):
|
|
14
|
+
try:
|
|
15
|
+
response = requests.post(
|
|
16
|
+
f"{self.base_url}/login", json={"email": self.email, "password": self.password}
|
|
17
|
+
)
|
|
18
|
+
response.raise_for_status()
|
|
19
|
+
response_json = response.json()
|
|
20
|
+
|
|
21
|
+
# Check for required fields in response
|
|
22
|
+
if not response_json.get("access_token") or not response_json.get("id"):
|
|
23
|
+
raise PermissionError(
|
|
24
|
+
"Invalid response from server. Missing required authentication fields.")
|
|
25
|
+
|
|
26
|
+
self.token = response_json["access_token"]
|
|
27
|
+
self.user_id = response_json["id"]
|
|
28
|
+
|
|
29
|
+
except requests.exceptions.HTTPError as e:
|
|
30
|
+
if hasattr(e, 'response') and e.response is not None and e.response.status_code == 401:
|
|
31
|
+
raise PermissionError(
|
|
32
|
+
"Authentication failed. Please check your credentials or refresh your token.") from e
|
|
33
|
+
raise # Re-raise other HTTP errors
|