Closed aaravm closed 3 weeks ago
This pull request adds Python bindings for the GA4GH SDK, focusing on creating structs like Configuration, Transport, ServiceInfo, TES, and adding tests for these bindings. The implementation uses maturin for building Python extensions and pytest for testing. The changes include modifications to the Rust TES client, addition of Python bindings, and creation of Python tests and documentation.
classDiagram
class TES {
+Configuration config
+Result<Service, Box<dyn std::error::Error>> service
+Transport transport
+new(config: &Configuration) Result<Self, Box<dyn std::error::Error>>
+create(task: TesTask) Result<Task, Box<dyn std::error::Error>>
+get(view: &str, id: &str) Result<TesTask, Box<dyn std::error::Error>>
+list_tasks(params: Option<ListTasksParams>) Result<TesListTasksResponse, Box<dyn std::error::Error>>
}
class Task {
+String id
+Transport transport
+new(id: String, transport: Transport) Self
+status() Result<TesState, Box<dyn std::error::Error>>
+cancel() Result<serde_json::Value, Box<dyn std::error::Error>>
}
TES --> Task
TES --> Transport
TES --> Configuration
TES --> Service
Task --> Transport
class PyTES {
+TES inner
+new(config: &PyConfiguration) PyResult<Self>
+create(task: &PyTesTask) PyResult<PyTask>
+get(view: &str, id: &str) PyResult<PyTesTask>
}
class PyTask {
+Task inner
+new(id: String, transport: &PyTransport) PyResult<Self>
+status() PyResult<String>
+cancel() PyResult<String>
}
PyTES --> TES
PyTask --> Task
class PyConfiguration {
+Configuration inner
+new(base_path: String) PyResult<Self>
+set_base_path(base_path: String) PyResult<()>
+get_base_path() String
}
class PyTransport {
+Transport inner
+new(py_config: &PyConfiguration) PyResult<Self>
+get(endpoint: String, params: Option<String>) PyResult<String>
+post(endpoint: String, data: Option<String>) PyResult<String>
+put(endpoint: String, data: String) PyResult<String>
+delete(endpoint: String) PyResult<String>
}
PyConfiguration --> Configuration
PyTransport --> Transport
Change | Details | Files |
---|---|---|
Implemented Python bindings for GA4GH SDK structs |
|
python/src/lib.rs |
Modified TES client implementation in Rust |
|
lib/src/clients/tes/mod.rs lib/src/clients/tes/model.rs |
Added Python tests for the new bindings |
|
python/tests/test_all.py python/tests/__init__.py |
Added documentation and build instructions for Python bindings |
|
python/README.md |
@Xforsa thanks for reviewing!
Adding python bindings for creating structs: Configuration, Transport, ServiceInfo, TES, and adding tests for testing the python bindings. This is done using maturin and pytest, inspired from https://github.com/vemonet/nanopub-rs
Summary by Sourcery
Add Python bindings for the GA4GH SDK using PyO3, enabling interaction with GA4GH services from Python. Implement a Rust module for the TES API, providing task management functionalities. Include comprehensive tests for both the Python bindings and the Rust TES client.
New Features:
Enhancements:
Documentation:
Tests: