py-tes 🐍
py-tes is a library for interacting with servers implementing the GA4GH Task Execution Schema.
Quick Start ⚡
| TES version | py-tes version + branch | Example Notebook (Coming soon!) |
|---|---|---|
| 1.1 | 1.1.x (master) | |
| 1.0 | 1.0.0 (release/v1.0) |
Install 🌀
Install py-tes from PyPI and run it in your script:
➜ pip install py-tes
Quick Start ⚡
import tes
import json
# Define task
task = tes.Task(
executors=[
tes.Executor(
image="alpine",
command=["echo", "hello"]
)
]
)
# Create client
cli = tes.HTTPClient("http://localhost:8000", timeout=5)
# Create and run task
task_id = cli.create_task(task)
cli.wait(task_id, timeout=5)
# Fetch task info
task_info = cli.get_task(task_id, view="BASIC")
j = json.loads(task_info.as_json())
# Pretty print task info
print(json.dumps(j, indent=2))
How to...
Makes use of the objects above...
...export a model to a dictionary
task_dict = task.as_dict(drop_empty=False)
task_dict contents:
{'id': None, 'state': None, 'name': None, 'description': None, 'inputs': None, 'outputs': None, 'resources': None, 'executors': [{'image': 'alpine', 'command': ['echo', 'hello'], 'workdir': None, 'stdin': None, 'stdout': None, 'stderr': None, 'env': None}], 'volumes': None, 'tags': None, 'logs': None, 'creation_time': None}
...export a model to JSON
task_json = task.as_json() # also accepts `drop_empty` arg
task_json contents:
{"executors": [{"image": "alpine", "command": ["echo", "hello"]}]}
...pretty print a model
print(task.as_json(indent=3)) # keyword args are passed to `json.dumps()`
Output:
{
"executors": [
{
"image": "alpine",
"command": ["echo", "hello"]
}
]
}
...access a specific task from the task list
specific_task = tasks_list.tasks[5]
specific_task contents:
Task(id='393K43', state='COMPLETE', name=None, description=None, inputs=None, outputs=None, resources=None, executors=None, volumes=None, tags=None, logs=None, creation_time=None)
...iterate over task list items
for t in tasks_list[:3]:
print(t.as_json(indent=3))
Output:
{
"id": "task_A2GFS4",
"state": "RUNNING"
}
{
"id": "task_O8G1PZ",
"state": "CANCELED"
}
{
"id": "task_W246I6",
"state": "COMPLETE"
}
...instantiate a model from a JSON representation
task_from_json = tes.client.unmarshal(task_json, tes.Task)
task_from_json contents:
Task(id=None, state=None, name=None, description=None, inputs=None, outputs=None, resources=None, executors=[Executor(image='alpine', command=['echo', 'hello'], workdir=None, stdin=None, stdout=None, stderr=None, env=None)], volumes=None, tags=None, logs=None, creation_time=None)
Which is equivalent to task:
print(task_from_json == task)
Output:
True
Credits
This project would not be possible without our collaborators at the University of Basel, Microsoft Research and AI, and the The GA4GH Cloud Workstream Team — thank you! 🙌
Additional Resources 📚
-
ga4gh-sdk: Generic SDK and CLI for GA4GH API services
-
GA4GH TES: Main page for the Task Execution Schema — a standardized schema and API for describing batch execution tasks.
-
TES GitHub: Source repo for the Task Execution Schema
-
Awesome TES: A curated list of awesome GA4GH TES projects and programs
Metadata
Release files for py-tes 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_tes-1.1.4.tar.gz | 16.5 kB | Without provenance | Details for py_tes-1.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_tes-1.1.4-py3-none-any.whl | Python 3 | none | any | Details for py_tes-1.1.4-py3-none-any.whl |
Total release size: 28.8 kB
Release files / py_tes-1.1.4.tar.gz
| Download URL | py_tes-1.1.4.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d461d9f38227092bb831f7df4cdb1b4e316ead40dfae0b4d922190e7814abc84
|
|
BLAKE2b-256 checksum How to use checksums |
9a04190004e77dc12ba5b030c66ff961dccb0924456e4aed0183e970d751bddc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Release files / py_tes-1.1.4-py3-none-any.whl
| Download URL | py_tes-1.1.4-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c79fdcf1baff7b563034a4f9389b420e5ec7ef6fe7e01d09c875f1014742af8a
|
|
BLAKE2b-256 checksum How to use checksums |
7adbedf027f22ec0aea129cbe0e36120e3a92a39a6e32b6d5e5beb4421b3e9ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Security for py-tes 1.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.