onepot 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.
onepot-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,71 @@
1
+ Metadata-Version: 2.3
2
+ Name: onepot
3
+ Version: 0.1.0
4
+ Summary: Python client for the onepot API
5
+ Requires-Dist: httpx==0.28.1
6
+ Requires-Python: >=3.11
7
+ Description-Content-Type: text/markdown
8
+
9
+ # onepot-api
10
+
11
+ Python client for the onepot API.
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ uv add onepot
17
+ # or
18
+ pip install onepot
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```python
24
+ from onepot import Client
25
+
26
+ client = Client(api_key="your-api-key")
27
+
28
+ response = client.search(
29
+ smiles_list=["Cc1c(C(=O)Nc2ccc(N3CC(C)OC(C)C3)nc2)cccc1-c1ccc(OC(F)(F)F)cc1", ...],
30
+ max_results=10,
31
+ include_chemistry_risk_score=True,
32
+ )
33
+ ```
34
+
35
+ ## Pricing
36
+
37
+ Credits are charged per SMILES in the query:
38
+
39
+ | Option | Credits per SMILES |
40
+ |--------|-------------------|
41
+ | Base search | 1 |
42
+ | `include_chemistry_risk=True` | 5 |
43
+ | `include_chemistry_risk_score=True` | 10 |
44
+
45
+ ## Response Format
46
+
47
+ ```python
48
+ {
49
+ "queries": [
50
+ {
51
+ "query_smiles": "Cc1c(C(=O)Nc2ccc(N3CC(C)OC(C)C3)nc2)cccc1-c1ccc(OC(F)(F)F)cc1",
52
+ "query_inchikey": "VZZJRYRQSPEMTK-CALCHBBNSA-N",
53
+ "results": [
54
+ {
55
+ "smiles": "CCO",
56
+ "inchikey": "VZZJRYRQSPEMTK-CALCHBBNSA-N",
57
+ "similarity": 1.0,
58
+ "supplier_risk": "medium",
59
+ "price_usd": 250,
60
+ "chemistry_risk": "medium", # if include_chemistry_risk=True
61
+ "chemistry_risk_score": 0.5 # if include_chemistry_risk_score=True
62
+ },
63
+ ...
64
+ ]
65
+ },
66
+ ...
67
+ ],
68
+ "credits_used": 10,
69
+ "credits_remaining": 990
70
+ }
71
+ ```
onepot-0.1.0/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # onepot-api
2
+
3
+ Python client for the onepot API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ uv add onepot
9
+ # or
10
+ pip install onepot
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```python
16
+ from onepot import Client
17
+
18
+ client = Client(api_key="your-api-key")
19
+
20
+ response = client.search(
21
+ smiles_list=["Cc1c(C(=O)Nc2ccc(N3CC(C)OC(C)C3)nc2)cccc1-c1ccc(OC(F)(F)F)cc1", ...],
22
+ max_results=10,
23
+ include_chemistry_risk_score=True,
24
+ )
25
+ ```
26
+
27
+ ## Pricing
28
+
29
+ Credits are charged per SMILES in the query:
30
+
31
+ | Option | Credits per SMILES |
32
+ |--------|-------------------|
33
+ | Base search | 1 |
34
+ | `include_chemistry_risk=True` | 5 |
35
+ | `include_chemistry_risk_score=True` | 10 |
36
+
37
+ ## Response Format
38
+
39
+ ```python
40
+ {
41
+ "queries": [
42
+ {
43
+ "query_smiles": "Cc1c(C(=O)Nc2ccc(N3CC(C)OC(C)C3)nc2)cccc1-c1ccc(OC(F)(F)F)cc1",
44
+ "query_inchikey": "VZZJRYRQSPEMTK-CALCHBBNSA-N",
45
+ "results": [
46
+ {
47
+ "smiles": "CCO",
48
+ "inchikey": "VZZJRYRQSPEMTK-CALCHBBNSA-N",
49
+ "similarity": 1.0,
50
+ "supplier_risk": "medium",
51
+ "price_usd": 250,
52
+ "chemistry_risk": "medium", # if include_chemistry_risk=True
53
+ "chemistry_risk_score": 0.5 # if include_chemistry_risk_score=True
54
+ },
55
+ ...
56
+ ]
57
+ },
58
+ ...
59
+ ],
60
+ "credits_used": 10,
61
+ "credits_remaining": 990
62
+ }
63
+ ```
@@ -0,0 +1,11 @@
1
+ [project]
2
+ name = "onepot"
3
+ version = "0.1.0"
4
+ description = "Python client for the onepot API"
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ dependencies = ["httpx==0.28.1"]
8
+
9
+ [build-system]
10
+ requires = ["uv_build"]
11
+ build-backend = "uv_build"
@@ -0,0 +1,3 @@
1
+ from .client import Client
2
+
3
+ __all__ = ["Client"]
@@ -0,0 +1,55 @@
1
+ import httpx
2
+
3
+
4
+ class Client:
5
+ def __init__(self, api_key: str):
6
+ self.api_key = api_key
7
+ self.base_url = "https://api.onepot.ai"
8
+ self.client = httpx.Client(
9
+ headers={"X-API-Key": api_key},
10
+ timeout=240.0,
11
+ follow_redirects=True,
12
+ )
13
+
14
+ def search(
15
+ self,
16
+ smiles_list: list[str],
17
+ max_results: int = 100,
18
+ substructure_search: bool = False,
19
+ max_depth: int = 1,
20
+ include_chemistry_risk: bool = False,
21
+ include_chemistry_risk_score: bool = False,
22
+ ):
23
+ """Search for purchasable analogs of the given molecules.
24
+
25
+ Args:
26
+ smiles_list: List of SMILES strings to search.
27
+ max_results: Maximum results per query (default 100).
28
+ substructure_search: Match substructures instead of similarity.
29
+ max_depth: Synthesis depth (currently only 1 supported).
30
+ include_chemistry_risk: Include chemistry_risk field (low/medium/high).
31
+ include_chemistry_risk_score: Include raw probability score (0-1).
32
+
33
+ Returns:
34
+ Dict with:
35
+ - queries: List of query results, each containing query_smiles, query_inchikey,
36
+ and results (list of {smiles, inchikey, similarity, supplier_risk, price_usd,
37
+ and optionally chemistry_risk/chemistry_risk_score}).
38
+ - credits_used: Number of credits consumed.
39
+ - credits_remaining: Remaining credit balance.
40
+ """
41
+ resp = self.client.post(
42
+ f"{self.base_url}/v1/search",
43
+ json={
44
+ "smiles_list": smiles_list,
45
+ "max_results": max_results,
46
+ "substructure_search": substructure_search,
47
+ "max_depth": max_depth,
48
+ "include_chemistry_risk": include_chemistry_risk,
49
+ "include_chemistry_risk_score": include_chemistry_risk_score,
50
+ },
51
+ )
52
+ if not resp.is_success:
53
+ print(f"Error {resp.status_code}: {resp.text}")
54
+ resp.raise_for_status()
55
+ return resp.json()
File without changes