chemql-python 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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mohammad Rakibul Islam
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,297 @@
1
+ Metadata-Version: 2.4
2
+ Name: chemql-python
3
+ Version: 0.1.0
4
+ Summary: A chemistry-focused query language and REPL
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: prompt_toolkit>=3.0
9
+ Provides-Extra: test
10
+ Requires-Dist: pytest>=8.0; extra == "test"
11
+ Dynamic: license-file
12
+
13
+ # ChemQL
14
+
15
+ ChemQL is a chemistry-focused query language and REPL for exploring element, molecule, and reaction datasets. It lets you search the built-in chemistry data, filter results with expressions, set reaction conditions, and combine queries with small Python snippets when needed.
16
+
17
+ ## What ChemQL does
18
+
19
+ ChemQL supports:
20
+
21
+ - Searching the built-in `elements`, `molecules`, and `reactions` datasets
22
+ - Filtering by field, comparison operator, pattern matching, and boolean logic
23
+ - Quick lookup commands like `findel`, `findmol`, and `findre`
24
+ - Reaction setup with temperature, pressure, and catalyst configuration
25
+ - Running reactions with `react`
26
+ - Embedding Python in `[ ... ]` blocks and templates in `{{ ... }}`
27
+ - Running from a terminal REPL or executing a command/file from the shell
28
+
29
+ ## Install the library
30
+
31
+ Install from this `chemql/` directory, which contains `pyproject.toml`:
32
+
33
+ ```bash
34
+ cd /path/to/ChemQL/Language/chemql
35
+ python -m pip install -e ".[test]"
36
+ ```
37
+
38
+ This installs the Python package and the `chemql` CLI:
39
+
40
+ ```bash
41
+ chemql -c "search elements name = 'Hydrogen'"
42
+ ```
43
+
44
+ Start the interactive REPL with:
45
+
46
+ ```bash
47
+ python -m chemql
48
+ ```
49
+
50
+ You will see the interactive prompt:
51
+
52
+ ```text
53
+ >>>
54
+ ```
55
+
56
+ Type:
57
+
58
+ ```text
59
+ help
60
+ ```
61
+
62
+ or:
63
+
64
+ ```text
65
+ ?
66
+ ```
67
+
68
+ to display the built-in help.
69
+
70
+ ## Command-line usage
71
+
72
+ You can also execute a single ChemQL command or a file:
73
+
74
+ ```bash
75
+ chemql -c 'search elements name = "Hydrogen"'
76
+ chemql -f examples/script.cql
77
+ ```
78
+
79
+ The Python package is `chemql`. Its query engine, chemistry types, and bundled
80
+ datasets can be imported directly:
81
+
82
+ ```python
83
+ from chemql import execute_query_text
84
+
85
+ result = execute_query_text('search elements name = "Hydrogen"')
86
+ ```
87
+
88
+ ## Core query syntax
89
+
90
+ ### Search a dataset
91
+
92
+ ```text
93
+ search elements
94
+ search molecules
95
+ search reactions
96
+ ```
97
+
98
+ ### Search with filters
99
+
100
+ ```text
101
+ search elements atomic_number > 10 and atomic_number < 20
102
+ search molecules name like "*water*"
103
+ search reactions reaction_type = "combustion"
104
+ ```
105
+
106
+ ### Sort, limit, and count
107
+
108
+ ```text
109
+ search molecules sort molecular_weight desc
110
+ search molecules limit 10
111
+ search molecules count
112
+ ```
113
+
114
+ ### Return selected fields
115
+
116
+ ```text
117
+ search molecules molecular_weight < 20 return name formula molecular_weight
118
+ search reactions reversible = true return name conditions
119
+ ```
120
+
121
+ ### Set the current source
122
+
123
+ ```text
124
+ source elements
125
+ source molecules
126
+ source reactions
127
+ ```
128
+
129
+ ### List available keys
130
+
131
+ ```text
132
+ list all
133
+ ```
134
+
135
+ ## Convenience lookup commands
136
+
137
+ ```text
138
+ findel "He"
139
+ findel "Hydrogen"
140
+
141
+ findmol "H2O"
142
+ findmol "Water"
143
+
144
+ findre "Haber process"
145
+ findre "RHEA:10000" return name equation source
146
+ ```
147
+
148
+ ## Reactions
149
+
150
+ Set reaction conditions before running a reaction:
151
+
152
+ ```text
153
+ set temperature 723K
154
+ set temperature standard
155
+ set pressure 20265000pa
156
+ set pressure room
157
+ set catalysts iron zinc
158
+ add catalyst "Vanadium oxide"
159
+ remove catalyst "Vanadium oxide"
160
+ conditions
161
+ react N2 3H2
162
+ ```
163
+
164
+ Temperature accepts `C`, `F`, or `K`; pressure accepts `Pa`, `N/m^2`, `Nm^-2`, `bar`, or `atm`. The keywords `standard` and `room` are also accepted.
165
+
166
+ ## Operators
167
+
168
+ ChemQL supports these comparison operators:
169
+
170
+ - `=`
171
+ - `>`
172
+ - `<`
173
+ - `>=`
174
+ - `<=`
175
+ - `like`
176
+ - `like!`
177
+ - `has`
178
+
179
+ Boolean logic:
180
+
181
+ ```text
182
+ and
183
+ or
184
+ ```
185
+
186
+ Parentheses may be used to group expressions.
187
+
188
+ ## Result controls
189
+
190
+ ```text
191
+ search molecules first
192
+ search molecules last
193
+ search molecules sort atomic_number desc limit 5
194
+ search molecules count
195
+ ```
196
+
197
+ ## General commands
198
+
199
+ ```text
200
+ list all
201
+ view
202
+ clear
203
+ dump my_session.txt
204
+ help
205
+ exit
206
+ ```
207
+
208
+ `view` opens the periodic table in a browser. `dump` writes recent command history to a file.
209
+
210
+ ## Hybrid Python mode
211
+
212
+ ChemQL can be mixed with Python inside square-bracket blocks:
213
+
214
+ ```text
215
+ [x = 10]
216
+ [print(x)]
217
+ ```
218
+
219
+ Conditional and loop blocks are also supported:
220
+
221
+ ```text
222
+ [for x in range(3)]
223
+ [print(x)]
224
+ [endblock]
225
+
226
+ [if x > 0]
227
+ [print("positive")]
228
+ [else]
229
+ [print("not positive")]
230
+ [endblock]
231
+ ```
232
+
233
+ Embedded ChemQL queries can also be used with double-brace syntax. This executes a query and uses the result as a value in the surrounding Python:
234
+
235
+ ```text
236
+ [print({{ search elements number = 1 }})]
237
+ [for i in {{search elements number <= 10}}]
238
+ [print(i.name)]
239
+ [endblock]
240
+ ```
241
+
242
+ The `{{ ... }}` form is a convenient way to make a query return actual data to Python, rather than only writing a plain query line.
243
+
244
+ ## Line continuation
245
+
246
+ If a line ends with `\`, it continues onto the next line:
247
+
248
+ ```text
249
+ search elements \
250
+ name = "Hydrogen"
251
+ ```
252
+
253
+ This is treated as:
254
+
255
+ ```text
256
+ search elements name = "Hydrogen"
257
+ ```
258
+
259
+ ## Examples
260
+
261
+ ```text
262
+ search elements name = "Hydrogen"
263
+ findel "He"
264
+ findmol "H2O"
265
+
266
+ search molecules molecular_weight < 20 \
267
+ return name formula molecular_weight
268
+
269
+ search elements atomic_number > 10 \
270
+ and atomic_number < 20 \
271
+ sort atomic_number desc \
272
+ limit 5
273
+
274
+ search molecules count
275
+ ```
276
+
277
+ ## Repository layout
278
+
279
+ ```text
280
+ chemql/
281
+ ├── pyproject.toml
282
+ ├── src/
283
+ │ └── chemql/
284
+ │ ├── __init__.py
285
+ │ ├── __main__.py
286
+ │ ├── data/
287
+ │ └── html/
288
+ ├── tests/
289
+ ├── scripts/
290
+ └── examples/
291
+ ```
292
+
293
+ The installable package contains the language implementation and its bundled
294
+ chemical datasets.
295
+
296
+ Created by [Mohammad Rakibul Islam](https://github.com/rakibulofficial1017).
297
+ Source code: [rakibulofficial1017/ChemQL](https://github.com/rakibulofficial1017/ChemQL).
@@ -0,0 +1,285 @@
1
+ # ChemQL
2
+
3
+ ChemQL is a chemistry-focused query language and REPL for exploring element, molecule, and reaction datasets. It lets you search the built-in chemistry data, filter results with expressions, set reaction conditions, and combine queries with small Python snippets when needed.
4
+
5
+ ## What ChemQL does
6
+
7
+ ChemQL supports:
8
+
9
+ - Searching the built-in `elements`, `molecules`, and `reactions` datasets
10
+ - Filtering by field, comparison operator, pattern matching, and boolean logic
11
+ - Quick lookup commands like `findel`, `findmol`, and `findre`
12
+ - Reaction setup with temperature, pressure, and catalyst configuration
13
+ - Running reactions with `react`
14
+ - Embedding Python in `[ ... ]` blocks and templates in `{{ ... }}`
15
+ - Running from a terminal REPL or executing a command/file from the shell
16
+
17
+ ## Install the library
18
+
19
+ Install from this `chemql/` directory, which contains `pyproject.toml`:
20
+
21
+ ```bash
22
+ cd /path/to/ChemQL/Language/chemql
23
+ python -m pip install -e ".[test]"
24
+ ```
25
+
26
+ This installs the Python package and the `chemql` CLI:
27
+
28
+ ```bash
29
+ chemql -c "search elements name = 'Hydrogen'"
30
+ ```
31
+
32
+ Start the interactive REPL with:
33
+
34
+ ```bash
35
+ python -m chemql
36
+ ```
37
+
38
+ You will see the interactive prompt:
39
+
40
+ ```text
41
+ >>>
42
+ ```
43
+
44
+ Type:
45
+
46
+ ```text
47
+ help
48
+ ```
49
+
50
+ or:
51
+
52
+ ```text
53
+ ?
54
+ ```
55
+
56
+ to display the built-in help.
57
+
58
+ ## Command-line usage
59
+
60
+ You can also execute a single ChemQL command or a file:
61
+
62
+ ```bash
63
+ chemql -c 'search elements name = "Hydrogen"'
64
+ chemql -f examples/script.cql
65
+ ```
66
+
67
+ The Python package is `chemql`. Its query engine, chemistry types, and bundled
68
+ datasets can be imported directly:
69
+
70
+ ```python
71
+ from chemql import execute_query_text
72
+
73
+ result = execute_query_text('search elements name = "Hydrogen"')
74
+ ```
75
+
76
+ ## Core query syntax
77
+
78
+ ### Search a dataset
79
+
80
+ ```text
81
+ search elements
82
+ search molecules
83
+ search reactions
84
+ ```
85
+
86
+ ### Search with filters
87
+
88
+ ```text
89
+ search elements atomic_number > 10 and atomic_number < 20
90
+ search molecules name like "*water*"
91
+ search reactions reaction_type = "combustion"
92
+ ```
93
+
94
+ ### Sort, limit, and count
95
+
96
+ ```text
97
+ search molecules sort molecular_weight desc
98
+ search molecules limit 10
99
+ search molecules count
100
+ ```
101
+
102
+ ### Return selected fields
103
+
104
+ ```text
105
+ search molecules molecular_weight < 20 return name formula molecular_weight
106
+ search reactions reversible = true return name conditions
107
+ ```
108
+
109
+ ### Set the current source
110
+
111
+ ```text
112
+ source elements
113
+ source molecules
114
+ source reactions
115
+ ```
116
+
117
+ ### List available keys
118
+
119
+ ```text
120
+ list all
121
+ ```
122
+
123
+ ## Convenience lookup commands
124
+
125
+ ```text
126
+ findel "He"
127
+ findel "Hydrogen"
128
+
129
+ findmol "H2O"
130
+ findmol "Water"
131
+
132
+ findre "Haber process"
133
+ findre "RHEA:10000" return name equation source
134
+ ```
135
+
136
+ ## Reactions
137
+
138
+ Set reaction conditions before running a reaction:
139
+
140
+ ```text
141
+ set temperature 723K
142
+ set temperature standard
143
+ set pressure 20265000pa
144
+ set pressure room
145
+ set catalysts iron zinc
146
+ add catalyst "Vanadium oxide"
147
+ remove catalyst "Vanadium oxide"
148
+ conditions
149
+ react N2 3H2
150
+ ```
151
+
152
+ Temperature accepts `C`, `F`, or `K`; pressure accepts `Pa`, `N/m^2`, `Nm^-2`, `bar`, or `atm`. The keywords `standard` and `room` are also accepted.
153
+
154
+ ## Operators
155
+
156
+ ChemQL supports these comparison operators:
157
+
158
+ - `=`
159
+ - `>`
160
+ - `<`
161
+ - `>=`
162
+ - `<=`
163
+ - `like`
164
+ - `like!`
165
+ - `has`
166
+
167
+ Boolean logic:
168
+
169
+ ```text
170
+ and
171
+ or
172
+ ```
173
+
174
+ Parentheses may be used to group expressions.
175
+
176
+ ## Result controls
177
+
178
+ ```text
179
+ search molecules first
180
+ search molecules last
181
+ search molecules sort atomic_number desc limit 5
182
+ search molecules count
183
+ ```
184
+
185
+ ## General commands
186
+
187
+ ```text
188
+ list all
189
+ view
190
+ clear
191
+ dump my_session.txt
192
+ help
193
+ exit
194
+ ```
195
+
196
+ `view` opens the periodic table in a browser. `dump` writes recent command history to a file.
197
+
198
+ ## Hybrid Python mode
199
+
200
+ ChemQL can be mixed with Python inside square-bracket blocks:
201
+
202
+ ```text
203
+ [x = 10]
204
+ [print(x)]
205
+ ```
206
+
207
+ Conditional and loop blocks are also supported:
208
+
209
+ ```text
210
+ [for x in range(3)]
211
+ [print(x)]
212
+ [endblock]
213
+
214
+ [if x > 0]
215
+ [print("positive")]
216
+ [else]
217
+ [print("not positive")]
218
+ [endblock]
219
+ ```
220
+
221
+ Embedded ChemQL queries can also be used with double-brace syntax. This executes a query and uses the result as a value in the surrounding Python:
222
+
223
+ ```text
224
+ [print({{ search elements number = 1 }})]
225
+ [for i in {{search elements number <= 10}}]
226
+ [print(i.name)]
227
+ [endblock]
228
+ ```
229
+
230
+ The `{{ ... }}` form is a convenient way to make a query return actual data to Python, rather than only writing a plain query line.
231
+
232
+ ## Line continuation
233
+
234
+ If a line ends with `\`, it continues onto the next line:
235
+
236
+ ```text
237
+ search elements \
238
+ name = "Hydrogen"
239
+ ```
240
+
241
+ This is treated as:
242
+
243
+ ```text
244
+ search elements name = "Hydrogen"
245
+ ```
246
+
247
+ ## Examples
248
+
249
+ ```text
250
+ search elements name = "Hydrogen"
251
+ findel "He"
252
+ findmol "H2O"
253
+
254
+ search molecules molecular_weight < 20 \
255
+ return name formula molecular_weight
256
+
257
+ search elements atomic_number > 10 \
258
+ and atomic_number < 20 \
259
+ sort atomic_number desc \
260
+ limit 5
261
+
262
+ search molecules count
263
+ ```
264
+
265
+ ## Repository layout
266
+
267
+ ```text
268
+ chemql/
269
+ ├── pyproject.toml
270
+ ├── src/
271
+ │ └── chemql/
272
+ │ ├── __init__.py
273
+ │ ├── __main__.py
274
+ │ ├── data/
275
+ │ └── html/
276
+ ├── tests/
277
+ ├── scripts/
278
+ └── examples/
279
+ ```
280
+
281
+ The installable package contains the language implementation and its bundled
282
+ chemical datasets.
283
+
284
+ Created by [Mohammad Rakibul Islam](https://github.com/rakibulofficial1017).
285
+ Source code: [rakibulofficial1017/ChemQL](https://github.com/rakibulofficial1017/ChemQL).
@@ -0,0 +1,28 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "chemql-python"
7
+ version = "0.1.0"
8
+ description = "A chemistry-focused query language and REPL"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ dependencies = [
12
+ "prompt_toolkit>=3.0",
13
+ ]
14
+
15
+ [project.optional-dependencies]
16
+ test = ["pytest>=8.0"]
17
+
18
+ [project.scripts]
19
+ chemql = "chemql:main"
20
+
21
+ [tool.setuptools]
22
+ package-dir = {"" = "src"}
23
+
24
+ [tool.setuptools.packages.find]
25
+ where = ["src"]
26
+
27
+ [tool.setuptools.package-data]
28
+ chemql = ["data/*.json", "data/THIRD_PARTY_LICENSES/*.txt", "html/*.html"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+