# gensyn-client
# General Synthesis Service for Electronic Lab Notebooks (ELN)

## Setup

### Python

Recommended:

- [pyenv](https://github.com/pyenv/pyenv) - to manage Python versions
- [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv) - to manage virtual environments

```sh
pyenv install 3.9.10
pyenv virtualenv 3.9.10 gensyn-eln
pyenv local gensyn-eln
pip install --upgrade pip
pip install -r requirements.txt
```

## Running

Ensure Ray is running:

```sh
ray start --head
```

Run the service:

```sh
python src/main.py
```


This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 0.0.1
- Package version: 0.0.2
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
For more information, please visit [http://general-synthesis.com/contact/](http://general-synthesis.com/contact/)

## Requirements.

Python >=3.6

## Installation & Usage
### pip install

If the python package is hosted on a repository, you can install directly using:

```sh
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
```
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)

Then import the package:
```python
import gensyn_client
```

### Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)

Then import the package:
```python
import gensyn_client
```

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

```python

import time
import gensyn_client
from pprint import pprint
from gensyn_client.api import augmentation_api
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = gensyn_client.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: APIKeyHeader
configuration.api_key['APIKeyHeader'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['APIKeyHeader'] = 'Bearer'


# Enter a context with an instance of the API client
with gensyn_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = augmentation_api.AugmentationApi(api_client)
    smiles = "O=C1C2=C(N=CN2C)N(C(=O)N1C)C" # str | A SMILES molecule description
count = 25 # int | The number of random SMILES to generate (optional) (default to 1)
random_type = None # bool, date, datetime, dict, float, int, list, str, none_type | The type of randomization to perform (optional)
isomeric_smiles = True # bool | If True, returns the canonical isomeric SMILES (optional) (default to True)

    try:
        # Randomize Smiles
        api_response = api_instance.randomize_smiles(smiles, count=count, random_type=random_type, isomeric_smiles=isomeric_smiles)
        pprint(api_response)
    except gensyn_client.ApiException as e:
        print("Exception when calling AugmentationApi->randomize_smiles: %s\n" % e)
```

## Documentation for API Endpoints

All URIs are relative to *http://localhost*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AugmentationApi* | [**randomize_smiles**](docs/AugmentationApi.md#randomize_smiles) | **GET** /augmentation/randomize_smiles/{smiles} | Randomize Smiles
*DefaultApi* | [**root**](docs/DefaultApi.md#root) | **GET** / | Root


## Documentation For Models

 - [RandomType](docs/RandomType.md)


## Documentation For Authorization


## APIKeyHeader

- **Type**: API key
- **API key parameter name**: api-key
- **Location**: HTTP header


## Author

info@general-synthesis.com


## Notes for Large OpenAPI documents
If the OpenAPI document is large, imports in gensyn_client.apis and gensyn_client.models may fail with a
RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1:
Use specific imports for apis and models like:
- `from gensyn_client.api.default_api import DefaultApi`
- `from gensyn_client.model.pet import Pet`

Solution 2:
Before importing the package, adjust the maximum recursion limit as shown below:
```
import sys
sys.setrecursionlimit(1500)
import gensyn_client
from gensyn_client.apis import *
from gensyn_client.models import *
```

