slivka-client


Nameslivka-client JSON
Version 1.2.1b1 PyPI version JSON
download
home_pagehttps://github.com/bartongroup/slivka-python-client
SummaryA Python client for Slivka services
upload_time2024-10-23 14:56:08
maintainerStuart MacGowan
docs_urlNone
authorMateusz Warowny
requires_python>=3.6
licenseNone
keywords slivka client bioinformatics computational biology rest api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Slivka Python Client

[![PyPI version](https://badge.fury.io/py/slivka-client.svg)](https://badge.fury.io/py/slivka-client)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)

Slivka Python client is a convenience wrapper around the popular [requests](https://requests.readthedocs.io/en/latest/) library. It provides an interface for communicating with the Slivka REST API using Python.

## Features

- Programmatic access to Slivka API with simple objects.
- Command-line interface.
- Interactive widgets for Jupyter notebooks.

---

## Installation

The easiest way to install the Slivka client is via `pip` from PyPI:

```bash
pip install slivka-client
```

Alternatively, if you prefer to use the conda package manager, you can install it from the Slivka channel:

```bash
conda install -c slivka slivka-client
```

To install it from the source code, clone the Git repository to your machine and run:

```bash
python setup.py install
```

---

## Getting Started

After installing the Slivka client, you can begin by importing it and connecting to a Slivka server:

```python
import slivka_client

# Replace with your actual server URL
client = slivka_client.SlivkaClient("https://your-slivka-server-url/")
```

You can verify the connection by checking the server version:

```python
print(client.version)
```

---

## Usage

### Accessing Services

To retrieve the list of available services from the Slivka server:

```python
services = client.services
```

Each element in the list is a `Service` object containing details such as the service's `id`, `name`, and `description`.

To access a specific service by its ID, use:

```python
service = client.get_service('example_service_id')
# Or
service = client['example_service_id']
```

---

### Starting Jobs

Once you've selected the desired service, you can submit jobs using the `submit_job()` method. This requires providing parameters in the form of dictionaries.

Here’s an example of submitting a job:

```python
data = {
    'param0': 13,
    'param1': 'foobar'
}

files = {
    'input0': open("input-file.txt", "rb"),
    'input1': b"data data data data\n"
}

job = service.submit_job(data=data, files=files)
```

This method returns a `Job` object that allows you to monitor the status and retrieve results.

### Polling Jobs and Retrieving Results

You can check the status of a submitted job using:

```python
print(job.status)
```

To retrieve the results:

```python
for result in job.results:
    result.dump("output_file.txt")
```

### File Handling

The `File` object provides a convenient way to download results:

```python
result = job.results[0]
result.dump("output_file.txt")
```

The `File` object properties include:

- **url**: Location of the resource.
- **content_url**: Location of the file content.
- **id**: Identifier of the file (can be used as input for other jobs).
- **job_id**: ID of the job this file is a result of.
- **path**: Real path and name of the file.
- **label**: Name describing the file.
- **media_type**: Media type of the file.

---

## Command-Line Interface (CLI)

The `slivka-cli` command-line tool allows for interaction with the Slivka API without writing Python scripts.

To get started:

```bash
slivka-cli --help
```

This will provide you with usage instructions and available commands.

---

## License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

---

## Support

If you have any questions or need assistance, please open an issue on our [GitHub repository](https://github.com/bartongroup/slivka-python-client/issues).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bartongroup/slivka-python-client",
    "name": "slivka-client",
    "maintainer": "Stuart MacGowan",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "smacgowan@dundee.ac.uk",
    "keywords": "slivka, client, bioinformatics, computational biology, REST API",
    "author": "Mateusz Warowny",
    "author_email": "m.m.z.warowny@dundee.ac.uk",
    "download_url": "https://files.pythonhosted.org/packages/8b/1c/fd4737f2f57e8edd201e2ca80410744e262ebad43a158f4d599f7a511905/slivka_client-1.2.1b1.tar.gz",
    "platform": null,
    "description": "\n# Slivka Python Client\n\n[![PyPI version](https://badge.fury.io/py/slivka-client.svg)](https://badge.fury.io/py/slivka-client)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)\n\nSlivka Python client is a convenience wrapper around the popular [requests](https://requests.readthedocs.io/en/latest/) library. It provides an interface for communicating with the Slivka REST API using Python.\n\n## Features\n\n- Programmatic access to Slivka API with simple objects.\n- Command-line interface.\n- Interactive widgets for Jupyter notebooks.\n\n---\n\n## Installation\n\nThe easiest way to install the Slivka client is via `pip` from PyPI:\n\n```bash\npip install slivka-client\n```\n\nAlternatively, if you prefer to use the conda package manager, you can install it from the Slivka channel:\n\n```bash\nconda install -c slivka slivka-client\n```\n\nTo install it from the source code, clone the Git repository to your machine and run:\n\n```bash\npython setup.py install\n```\n\n---\n\n## Getting Started\n\nAfter installing the Slivka client, you can begin by importing it and connecting to a Slivka server:\n\n```python\nimport slivka_client\n\n# Replace with your actual server URL\nclient = slivka_client.SlivkaClient(\"https://your-slivka-server-url/\")\n```\n\nYou can verify the connection by checking the server version:\n\n```python\nprint(client.version)\n```\n\n---\n\n## Usage\n\n### Accessing Services\n\nTo retrieve the list of available services from the Slivka server:\n\n```python\nservices = client.services\n```\n\nEach element in the list is a `Service` object containing details such as the service's `id`, `name`, and `description`.\n\nTo access a specific service by its ID, use:\n\n```python\nservice = client.get_service('example_service_id')\n# Or\nservice = client['example_service_id']\n```\n\n---\n\n### Starting Jobs\n\nOnce you've selected the desired service, you can submit jobs using the `submit_job()` method. This requires providing parameters in the form of dictionaries.\n\nHere\u2019s an example of submitting a job:\n\n```python\ndata = {\n    'param0': 13,\n    'param1': 'foobar'\n}\n\nfiles = {\n    'input0': open(\"input-file.txt\", \"rb\"),\n    'input1': b\"data data data data\\n\"\n}\n\njob = service.submit_job(data=data, files=files)\n```\n\nThis method returns a `Job` object that allows you to monitor the status and retrieve results.\n\n### Polling Jobs and Retrieving Results\n\nYou can check the status of a submitted job using:\n\n```python\nprint(job.status)\n```\n\nTo retrieve the results:\n\n```python\nfor result in job.results:\n    result.dump(\"output_file.txt\")\n```\n\n### File Handling\n\nThe `File` object provides a convenient way to download results:\n\n```python\nresult = job.results[0]\nresult.dump(\"output_file.txt\")\n```\n\nThe `File` object properties include:\n\n- **url**: Location of the resource.\n- **content_url**: Location of the file content.\n- **id**: Identifier of the file (can be used as input for other jobs).\n- **job_id**: ID of the job this file is a result of.\n- **path**: Real path and name of the file.\n- **label**: Name describing the file.\n- **media_type**: Media type of the file.\n\n---\n\n## Command-Line Interface (CLI)\n\nThe `slivka-cli` command-line tool allows for interaction with the Slivka API without writing Python scripts.\n\nTo get started:\n\n```bash\nslivka-cli --help\n```\n\nThis will provide you with usage instructions and available commands.\n\n---\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## Support\n\nIf you have any questions or need assistance, please open an issue on our [GitHub repository](https://github.com/bartongroup/slivka-python-client/issues).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python client for Slivka services",
    "version": "1.2.1b1",
    "project_urls": {
        "Documentation": "https://github.com/bartongroup/slivka-python-client#readme",
        "Homepage": "https://github.com/bartongroup/slivka-python-client",
        "Organization": "https://www.compbio.dundee.ac.uk/drsasp.html",
        "Source": "https://github.com/bartongroup/slivka-python-client",
        "Tracker": "https://github.com/bartongroup/slivka-python-client/issues"
    },
    "split_keywords": [
        "slivka",
        " client",
        " bioinformatics",
        " computational biology",
        " rest api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed8dda36a30ac163eec5298d738fa7e38692fab3e79b8bf2459320ebacfd27ff",
                "md5": "3cf22548dea3e7d1e4020da4e055e95b",
                "sha256": "6b56475206af75c299f251d6240a9346b22b0c80a6cccc5ed843b351662e3596"
            },
            "downloads": -1,
            "filename": "slivka_client-1.2.1b1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3cf22548dea3e7d1e4020da4e055e95b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 15395,
            "upload_time": "2024-10-23T14:56:06",
            "upload_time_iso_8601": "2024-10-23T14:56:06.117053Z",
            "url": "https://files.pythonhosted.org/packages/ed/8d/da36a30ac163eec5298d738fa7e38692fab3e79b8bf2459320ebacfd27ff/slivka_client-1.2.1b1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8b1cfd4737f2f57e8edd201e2ca80410744e262ebad43a158f4d599f7a511905",
                "md5": "1ea5f6c4b8dae5aeb5b69e405e54bac6",
                "sha256": "4a4556f94ee6e97dc214a5cf10daa6d91ca8344d77acc3f2b0d19d8fee777ee0"
            },
            "downloads": -1,
            "filename": "slivka_client-1.2.1b1.tar.gz",
            "has_sig": false,
            "md5_digest": "1ea5f6c4b8dae5aeb5b69e405e54bac6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 15409,
            "upload_time": "2024-10-23T14:56:08",
            "upload_time_iso_8601": "2024-10-23T14:56:08.298803Z",
            "url": "https://files.pythonhosted.org/packages/8b/1c/fd4737f2f57e8edd201e2ca80410744e262ebad43a158f4d599f7a511905/slivka_client-1.2.1b1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-23 14:56:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bartongroup",
    "github_project": "slivka-python-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "slivka-client"
}
        
Elapsed time: 0.38135s