PyCule 0.2.2b0__tar.gz → 0.3.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.
pycule-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyCule
3
+ Version: 0.3.0
4
+ Summary: Python wrapper for the MCule Ultimate API
5
+ Home-page: https://github.com/xchem/pycule.git
6
+ Author: Warren Thompson
7
+ Author-email: waztom@gmail.com
8
+ License: MIT
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3.7
13
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: requests>=2.24.0
16
+ Requires-Dist: ratelimit>=2.2.1
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: home-page
23
+ Dynamic: license
24
+ Dynamic: requires-dist
25
+ Dynamic: summary
26
+
27
+ PyCule
28
+ ==============================
29
+ [//]: # (Badges)
30
+ [![PyPI version](https://badge.fury.io/py/PyCule.svg)](https://badge.fury.io/py/PyCule)
31
+
32
+ Wrapper to access the MCule and Enamine APIs
33
+
34
+ ## MCule
35
+
36
+ `MCuleWrapper` talks to the standard [MCule API](https://doc.mcule.com/api)
37
+ (base url `https://mcule.com/api/v1/`). Public endpoints (database files, compound
38
+ details, InChIKey lookup, single query search) work without authentication;
39
+ everything else requires an API access token sent as an `Authorization: Token <token>`
40
+ header. To request a token, email MCule with a summary of your intended use, per
41
+ their docs.
42
+
43
+ ```python
44
+ from pycule import MCuleWrapper
45
+
46
+ mcule = MCuleWrapper(authorisation_token="your-mcule-token")
47
+
48
+ mcule.databasefiles()
49
+ mcule.compounddetails("Mcule-1234567")
50
+ mcule.inchikeylookup("IHHITLNORGKBTP-UHFFFAOYSA-N")
51
+ mcule.singlequerysearch("CCO")
52
+
53
+ # Protected endpoints (require a valid token).
54
+ mcule.compoundavailability("Mcule-1234567")
55
+ mcule.compoundprices("Mcule-1234567")
56
+ mcule.compoundpricesamount("Mcule-1234567", amount=10)
57
+ mcule.multiplequeriessearch(["Mcule-1234567", "CCO"])
58
+ mcule.multiplequerieswithavailability(["Mcule-1234567", "CCO"])
59
+ mcule.similaritysearch("CCO", limit=5, threshold=0.7)
60
+ mcule.substructuresearch("CCO")
61
+ ```
62
+
63
+ Documented rate limits:
64
+
65
+ | | Burst | Sustained |
66
+ | --- | --- | --- |
67
+ | Anonymous (no token) | 10/min | 100/day |
68
+ | Authenticated (with token) | 20/min | 200/hour |
69
+
70
+ The [Compound list details](https://doc.mcule.com/api#compound_list_details1) and
71
+ [Quote Request](https://doc.mcule.com/api#quote_request1) (`POST`) endpoints have their
72
+ own, stricter limits — see the docs for details. On a 429 response, check the
73
+ `Retry-After` header/body before retrying.
74
+
75
+ ## MCule ULTIMATE
76
+
77
+ `UltimateMCuleWrapper` talks to the separate
78
+ [MCule ULTIMATE API](https://doc.mcule.com/doku.php?id=ultimate-api) (base url
79
+ `https://ultimateapp.mcule.com/api/v1/`), which searches MCule's larger
80
+ make-on-demand "Ultimate" compound space. It requires its own access token
81
+ (also requested from MCule by email) and is **not** interchangeable with a
82
+ standard MCule API token.
83
+
84
+ ```python
85
+ from pycule import UltimateMCuleWrapper
86
+
87
+ ultimate = UltimateMCuleWrapper(authorisation_token="your-ultimate-token")
88
+
89
+ ultimate.exact_search("CCO")
90
+ ultimate.similarity_search("CCO", limit=5, sim_threshold=0.7)
91
+ ultimate.substructure_search("CCO", limit=5)
92
+ ultimate.price_search_multi(["IHHITLNORGKBTP-UHFFFAOYSA-N"], amounts=[10])
93
+ ultimate.quote_request_multi(
94
+ ["IHHITLNORGKBTP-UHFFFAOYSA-N"], amounts=[10], delivery_country="GB"
95
+ )
96
+ ```
97
+
98
+ Documented rate limits:
99
+
100
+ | | Per minute | Per day |
101
+ | --- | --- | --- |
102
+ | Anonymous (no token) | 10 | 100 |
103
+ | Authenticated (with token) | 100 | 1000 |
104
+
105
+ ## Enamine
106
+
107
+ `EnamineWrapper` talks to the current [EnamineStore API](https://enaminestore.com/documentation)
108
+ (JWT-based auth, `/api/v2` endpoints). Authentication, token refresh and HTTP 429
109
+ (rate limit) retries with backoff are all handled transparently.
110
+
111
+ ```python
112
+ from pycule import EnamineWrapper
113
+
114
+ enamine = EnamineWrapper(email="you@example.com", password="your-password")
115
+
116
+ # Exact-match searches (synchronous). Accept a single identifier or a list -
117
+ # lists are automatically split into batches of `batch_size` (default 2000,
118
+ # Enamine's documented recommendation for the Code Search endpoint).
119
+ enamine.compoundidsearch(["EN300-17264", "EN300-456830", "Z234859494"])
120
+ enamine.cassearch(["110-86-1", "91-17-8"], catalog="building-blocks")
121
+ enamine.mfcdsearch(["MFCD00011732"], catalog="building-blocks")
122
+
123
+ # Exact SMILES search (asynchronous "delayed result", polled to completion).
124
+ enamine.exactsearch(["C=1C=CN=CC1", "CC(N)=O"], catalog="building-blocks")
125
+
126
+ # Substructure/similarity searches only accept a single query SMILES per call.
127
+ enamine.substructuresearch("CC(N)=O", catalog="building-blocks")
128
+ enamine.similaritysearch("CC(N)=O", catalog="building-blocks", similarity_value=0.8)
129
+ ```
130
+
131
+ Valid `catalog` values: `"building-blocks"`, `"screening-compounds"`,
132
+ `"made-building-blocks"`, `"real"`, `"bioactive-compounds"`.
133
+
134
+ Enamine does not currently publish its API rate limits. Rather than guessing,
135
+ requests are retried with exponential backoff when an HTTP 429 is received; once
136
+ the real limits are known, this can be tightened up in
137
+ [`pycule/decorators.py`](pycule/decorators.py).
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyCule
3
+ Version: 0.3.0
4
+ Summary: Python wrapper for the MCule Ultimate API
5
+ Home-page: https://github.com/xchem/pycule.git
6
+ Author: Warren Thompson
7
+ Author-email: waztom@gmail.com
8
+ License: MIT
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3.7
13
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: requests>=2.24.0
16
+ Requires-Dist: ratelimit>=2.2.1
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: home-page
23
+ Dynamic: license
24
+ Dynamic: requires-dist
25
+ Dynamic: summary
26
+
27
+ PyCule
28
+ ==============================
29
+ [//]: # (Badges)
30
+ [![PyPI version](https://badge.fury.io/py/PyCule.svg)](https://badge.fury.io/py/PyCule)
31
+
32
+ Wrapper to access the MCule and Enamine APIs
33
+
34
+ ## MCule
35
+
36
+ `MCuleWrapper` talks to the standard [MCule API](https://doc.mcule.com/api)
37
+ (base url `https://mcule.com/api/v1/`). Public endpoints (database files, compound
38
+ details, InChIKey lookup, single query search) work without authentication;
39
+ everything else requires an API access token sent as an `Authorization: Token <token>`
40
+ header. To request a token, email MCule with a summary of your intended use, per
41
+ their docs.
42
+
43
+ ```python
44
+ from pycule import MCuleWrapper
45
+
46
+ mcule = MCuleWrapper(authorisation_token="your-mcule-token")
47
+
48
+ mcule.databasefiles()
49
+ mcule.compounddetails("Mcule-1234567")
50
+ mcule.inchikeylookup("IHHITLNORGKBTP-UHFFFAOYSA-N")
51
+ mcule.singlequerysearch("CCO")
52
+
53
+ # Protected endpoints (require a valid token).
54
+ mcule.compoundavailability("Mcule-1234567")
55
+ mcule.compoundprices("Mcule-1234567")
56
+ mcule.compoundpricesamount("Mcule-1234567", amount=10)
57
+ mcule.multiplequeriessearch(["Mcule-1234567", "CCO"])
58
+ mcule.multiplequerieswithavailability(["Mcule-1234567", "CCO"])
59
+ mcule.similaritysearch("CCO", limit=5, threshold=0.7)
60
+ mcule.substructuresearch("CCO")
61
+ ```
62
+
63
+ Documented rate limits:
64
+
65
+ | | Burst | Sustained |
66
+ | --- | --- | --- |
67
+ | Anonymous (no token) | 10/min | 100/day |
68
+ | Authenticated (with token) | 20/min | 200/hour |
69
+
70
+ The [Compound list details](https://doc.mcule.com/api#compound_list_details1) and
71
+ [Quote Request](https://doc.mcule.com/api#quote_request1) (`POST`) endpoints have their
72
+ own, stricter limits — see the docs for details. On a 429 response, check the
73
+ `Retry-After` header/body before retrying.
74
+
75
+ ## MCule ULTIMATE
76
+
77
+ `UltimateMCuleWrapper` talks to the separate
78
+ [MCule ULTIMATE API](https://doc.mcule.com/doku.php?id=ultimate-api) (base url
79
+ `https://ultimateapp.mcule.com/api/v1/`), which searches MCule's larger
80
+ make-on-demand "Ultimate" compound space. It requires its own access token
81
+ (also requested from MCule by email) and is **not** interchangeable with a
82
+ standard MCule API token.
83
+
84
+ ```python
85
+ from pycule import UltimateMCuleWrapper
86
+
87
+ ultimate = UltimateMCuleWrapper(authorisation_token="your-ultimate-token")
88
+
89
+ ultimate.exact_search("CCO")
90
+ ultimate.similarity_search("CCO", limit=5, sim_threshold=0.7)
91
+ ultimate.substructure_search("CCO", limit=5)
92
+ ultimate.price_search_multi(["IHHITLNORGKBTP-UHFFFAOYSA-N"], amounts=[10])
93
+ ultimate.quote_request_multi(
94
+ ["IHHITLNORGKBTP-UHFFFAOYSA-N"], amounts=[10], delivery_country="GB"
95
+ )
96
+ ```
97
+
98
+ Documented rate limits:
99
+
100
+ | | Per minute | Per day |
101
+ | --- | --- | --- |
102
+ | Anonymous (no token) | 10 | 100 |
103
+ | Authenticated (with token) | 100 | 1000 |
104
+
105
+ ## Enamine
106
+
107
+ `EnamineWrapper` talks to the current [EnamineStore API](https://enaminestore.com/documentation)
108
+ (JWT-based auth, `/api/v2` endpoints). Authentication, token refresh and HTTP 429
109
+ (rate limit) retries with backoff are all handled transparently.
110
+
111
+ ```python
112
+ from pycule import EnamineWrapper
113
+
114
+ enamine = EnamineWrapper(email="you@example.com", password="your-password")
115
+
116
+ # Exact-match searches (synchronous). Accept a single identifier or a list -
117
+ # lists are automatically split into batches of `batch_size` (default 2000,
118
+ # Enamine's documented recommendation for the Code Search endpoint).
119
+ enamine.compoundidsearch(["EN300-17264", "EN300-456830", "Z234859494"])
120
+ enamine.cassearch(["110-86-1", "91-17-8"], catalog="building-blocks")
121
+ enamine.mfcdsearch(["MFCD00011732"], catalog="building-blocks")
122
+
123
+ # Exact SMILES search (asynchronous "delayed result", polled to completion).
124
+ enamine.exactsearch(["C=1C=CN=CC1", "CC(N)=O"], catalog="building-blocks")
125
+
126
+ # Substructure/similarity searches only accept a single query SMILES per call.
127
+ enamine.substructuresearch("CC(N)=O", catalog="building-blocks")
128
+ enamine.similaritysearch("CC(N)=O", catalog="building-blocks", similarity_value=0.8)
129
+ ```
130
+
131
+ Valid `catalog` values: `"building-blocks"`, `"screening-compounds"`,
132
+ `"made-building-blocks"`, `"real"`, `"bioactive-compounds"`.
133
+
134
+ Enamine does not currently publish its API rate limits. Rather than guessing,
135
+ requests are retried with exponential backoff when an HTTP 429 is received; once
136
+ the real limits are known, this can be tightened up in
137
+ [`pycule/decorators.py`](pycule/decorators.py).
@@ -10,4 +10,6 @@ pycule/__init__.py
10
10
  pycule/callbacks.py
11
11
  pycule/core.py
12
12
  pycule/decorators.py
13
- pycule/urls.py
13
+ pycule/urls.py
14
+ tests/test_enamine.py
15
+ tests/test_ultimate_mcule.py
pycule-0.3.0/README.md ADDED
@@ -0,0 +1,111 @@
1
+ PyCule
2
+ ==============================
3
+ [//]: # (Badges)
4
+ [![PyPI version](https://badge.fury.io/py/PyCule.svg)](https://badge.fury.io/py/PyCule)
5
+
6
+ Wrapper to access the MCule and Enamine APIs
7
+
8
+ ## MCule
9
+
10
+ `MCuleWrapper` talks to the standard [MCule API](https://doc.mcule.com/api)
11
+ (base url `https://mcule.com/api/v1/`). Public endpoints (database files, compound
12
+ details, InChIKey lookup, single query search) work without authentication;
13
+ everything else requires an API access token sent as an `Authorization: Token <token>`
14
+ header. To request a token, email MCule with a summary of your intended use, per
15
+ their docs.
16
+
17
+ ```python
18
+ from pycule import MCuleWrapper
19
+
20
+ mcule = MCuleWrapper(authorisation_token="your-mcule-token")
21
+
22
+ mcule.databasefiles()
23
+ mcule.compounddetails("Mcule-1234567")
24
+ mcule.inchikeylookup("IHHITLNORGKBTP-UHFFFAOYSA-N")
25
+ mcule.singlequerysearch("CCO")
26
+
27
+ # Protected endpoints (require a valid token).
28
+ mcule.compoundavailability("Mcule-1234567")
29
+ mcule.compoundprices("Mcule-1234567")
30
+ mcule.compoundpricesamount("Mcule-1234567", amount=10)
31
+ mcule.multiplequeriessearch(["Mcule-1234567", "CCO"])
32
+ mcule.multiplequerieswithavailability(["Mcule-1234567", "CCO"])
33
+ mcule.similaritysearch("CCO", limit=5, threshold=0.7)
34
+ mcule.substructuresearch("CCO")
35
+ ```
36
+
37
+ Documented rate limits:
38
+
39
+ | | Burst | Sustained |
40
+ | --- | --- | --- |
41
+ | Anonymous (no token) | 10/min | 100/day |
42
+ | Authenticated (with token) | 20/min | 200/hour |
43
+
44
+ The [Compound list details](https://doc.mcule.com/api#compound_list_details1) and
45
+ [Quote Request](https://doc.mcule.com/api#quote_request1) (`POST`) endpoints have their
46
+ own, stricter limits — see the docs for details. On a 429 response, check the
47
+ `Retry-After` header/body before retrying.
48
+
49
+ ## MCule ULTIMATE
50
+
51
+ `UltimateMCuleWrapper` talks to the separate
52
+ [MCule ULTIMATE API](https://doc.mcule.com/doku.php?id=ultimate-api) (base url
53
+ `https://ultimateapp.mcule.com/api/v1/`), which searches MCule's larger
54
+ make-on-demand "Ultimate" compound space. It requires its own access token
55
+ (also requested from MCule by email) and is **not** interchangeable with a
56
+ standard MCule API token.
57
+
58
+ ```python
59
+ from pycule import UltimateMCuleWrapper
60
+
61
+ ultimate = UltimateMCuleWrapper(authorisation_token="your-ultimate-token")
62
+
63
+ ultimate.exact_search("CCO")
64
+ ultimate.similarity_search("CCO", limit=5, sim_threshold=0.7)
65
+ ultimate.substructure_search("CCO", limit=5)
66
+ ultimate.price_search_multi(["IHHITLNORGKBTP-UHFFFAOYSA-N"], amounts=[10])
67
+ ultimate.quote_request_multi(
68
+ ["IHHITLNORGKBTP-UHFFFAOYSA-N"], amounts=[10], delivery_country="GB"
69
+ )
70
+ ```
71
+
72
+ Documented rate limits:
73
+
74
+ | | Per minute | Per day |
75
+ | --- | --- | --- |
76
+ | Anonymous (no token) | 10 | 100 |
77
+ | Authenticated (with token) | 100 | 1000 |
78
+
79
+ ## Enamine
80
+
81
+ `EnamineWrapper` talks to the current [EnamineStore API](https://enaminestore.com/documentation)
82
+ (JWT-based auth, `/api/v2` endpoints). Authentication, token refresh and HTTP 429
83
+ (rate limit) retries with backoff are all handled transparently.
84
+
85
+ ```python
86
+ from pycule import EnamineWrapper
87
+
88
+ enamine = EnamineWrapper(email="you@example.com", password="your-password")
89
+
90
+ # Exact-match searches (synchronous). Accept a single identifier or a list -
91
+ # lists are automatically split into batches of `batch_size` (default 2000,
92
+ # Enamine's documented recommendation for the Code Search endpoint).
93
+ enamine.compoundidsearch(["EN300-17264", "EN300-456830", "Z234859494"])
94
+ enamine.cassearch(["110-86-1", "91-17-8"], catalog="building-blocks")
95
+ enamine.mfcdsearch(["MFCD00011732"], catalog="building-blocks")
96
+
97
+ # Exact SMILES search (asynchronous "delayed result", polled to completion).
98
+ enamine.exactsearch(["C=1C=CN=CC1", "CC(N)=O"], catalog="building-blocks")
99
+
100
+ # Substructure/similarity searches only accept a single query SMILES per call.
101
+ enamine.substructuresearch("CC(N)=O", catalog="building-blocks")
102
+ enamine.similaritysearch("CC(N)=O", catalog="building-blocks", similarity_value=0.8)
103
+ ```
104
+
105
+ Valid `catalog` values: `"building-blocks"`, `"screening-compounds"`,
106
+ `"made-building-blocks"`, `"real"`, `"bioactive-compounds"`.
107
+
108
+ Enamine does not currently publish its API rate limits. Rather than guessing,
109
+ requests are retried with exponential backoff when an HTTP 429 is received; once
110
+ the real limits are known, this can be tightened up in
111
+ [`pycule/decorators.py`](pycule/decorators.py).
@@ -0,0 +1,5 @@
1
+ """Pycule initialization."""
2
+ __name__ = "Pycule"
3
+ __version__ = "v0.3.0"
4
+
5
+ from .core import EnamineWrapper, MCuleWrapper, UltimateMCuleWrapper