chemql-python 1.6.0__tar.gz → 1.6.1__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.
- {chemql_python-1.6.0 → chemql_python-1.6.1}/PKG-INFO +4 -3
- {chemql_python-1.6.0 → chemql_python-1.6.1}/README.md +3 -2
- {chemql_python-1.6.0 → chemql_python-1.6.1}/pyproject.toml +1 -1
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/__init__.py +8 -2
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/codecql.py +76 -6
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql_python.egg-info/PKG-INFO +4 -3
- {chemql_python-1.6.0 → chemql_python-1.6.1}/LICENSE +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/setup.cfg +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/__main__.py +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/build.py +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/colors.json +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/data/BondEnergies.json +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/data/MoleculeBonds.json +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/data/Molecules.json +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/data/PeriodicTableJSON.json +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/data/Reactions.json +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/data/THIRD_PARTY_LICENSES/PeriodicTableJSON.txt +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/data/THIRD_PARTY_LICENSES/RHEA.txt +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/html/periodic_table.html +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/stdlib/README.md +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/stdlib/collections.cql +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/stdlib/datetime.cql +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/stdlib/decimal.cql +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/stdlib/fractions.cql +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/stdlib/json.cql +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/stdlib/math/statistics.cql +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/stdlib/math.cql +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/stdlib/pathlib.cql +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/stdlib/random.cql +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql/stdlib/text.cql +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql_python.egg-info/SOURCES.txt +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql_python.egg-info/dependency_links.txt +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql_python.egg-info/entry_points.txt +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql_python.egg-info/requires.txt +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/src/chemql_python.egg-info/top_level.txt +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/tests/test_codecql.py +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/tests/test_external_molecule_lookup.py +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/tests/test_public_api.py +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/tests/test_reactions.py +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/tests/test_stdlib.py +0 -0
- {chemql_python-1.6.0 → chemql_python-1.6.1}/tests/test_structured_types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chemql-python
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.1
|
|
4
4
|
Summary: A chemistry-focused query language and REPL
|
|
5
5
|
Author-email: Mohammad Rakibul Islam <rakibulofficial1017@gmail.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -20,7 +20,7 @@ SQL-inspired syntax, inspect elements and molecules, look up reactions,
|
|
|
20
20
|
balance equations, and combine chemistry queries with Python and shell
|
|
21
21
|
commands.
|
|
22
22
|
|
|
23
|
-
- **Version:** `1.6.
|
|
23
|
+
- **Version:** `1.6.1`
|
|
24
24
|
- **PyPI distribution:** `chemql-python`
|
|
25
25
|
- **Python import / CLI name:** `chemql`
|
|
26
26
|
- **Author:** Mohammad Rakibul Islam
|
|
@@ -148,10 +148,11 @@ exit
|
|
|
148
148
|
|
|
149
149
|
### Terminal editor
|
|
150
150
|
|
|
151
|
-
Install the package, then open a ChemQL file with the `codecql` command
|
|
151
|
+
Install the package, then open a ChemQL file with the `codecql` command or `chemql edit`:
|
|
152
152
|
|
|
153
153
|
``` bash
|
|
154
154
|
codecql script.cql
|
|
155
|
+
chemql edit script.cql # this works too
|
|
155
156
|
```
|
|
156
157
|
|
|
157
158
|
The editor supports syntax highlighting, direct text editing, word movement
|
|
@@ -6,7 +6,7 @@ SQL-inspired syntax, inspect elements and molecules, look up reactions,
|
|
|
6
6
|
balance equations, and combine chemistry queries with Python and shell
|
|
7
7
|
commands.
|
|
8
8
|
|
|
9
|
-
- **Version:** `1.6.
|
|
9
|
+
- **Version:** `1.6.1`
|
|
10
10
|
- **PyPI distribution:** `chemql-python`
|
|
11
11
|
- **Python import / CLI name:** `chemql`
|
|
12
12
|
- **Author:** Mohammad Rakibul Islam
|
|
@@ -134,10 +134,11 @@ exit
|
|
|
134
134
|
|
|
135
135
|
### Terminal editor
|
|
136
136
|
|
|
137
|
-
Install the package, then open a ChemQL file with the `codecql` command
|
|
137
|
+
Install the package, then open a ChemQL file with the `codecql` command or `chemql edit`:
|
|
138
138
|
|
|
139
139
|
``` bash
|
|
140
140
|
codecql script.cql
|
|
141
|
+
chemql edit script.cql # this works too
|
|
141
142
|
```
|
|
142
143
|
|
|
143
144
|
The editor supports syntax highlighting, direct text editing, word movement
|
|
@@ -68,7 +68,7 @@ __all__ = [
|
|
|
68
68
|
"__version__"
|
|
69
69
|
]
|
|
70
70
|
|
|
71
|
-
__version__ = "1.6.
|
|
71
|
+
__version__ = "1.6.1"
|
|
72
72
|
|
|
73
73
|
# Persistent preprocessor/function state for the current ChemQL session.
|
|
74
74
|
DEFINITIONS = {}
|
|
@@ -7437,6 +7437,12 @@ def _init_project(name=None, directory="."):
|
|
|
7437
7437
|
|
|
7438
7438
|
|
|
7439
7439
|
def main(ANSI: bool = True):
|
|
7440
|
+
if len(sys.argv) >= 2 and sys.argv[1] == "edit":
|
|
7441
|
+
from .codecql import main as codecql_main # type: ignore
|
|
7442
|
+
|
|
7443
|
+
sys.argv = ["codecql"] + sys.argv[2:]
|
|
7444
|
+
codecql_main()
|
|
7445
|
+
return
|
|
7440
7446
|
parser = argparse.ArgumentParser(
|
|
7441
7447
|
description=(
|
|
7442
7448
|
"ChemQL query and chemistry language.\n"
|
|
@@ -7586,7 +7592,7 @@ def run_interactive():
|
|
|
7586
7592
|
closer = "]]]" if first == "[[[" else "```"
|
|
7587
7593
|
return not (len(source_lines) > 1 and last == closer)
|
|
7588
7594
|
|
|
7589
|
-
if re.fullmatch(r"(?:(?:static\s+func|func\s+static|func)\s+)" + _DEFINITION_NAME, first, re.IGNORECASE):
|
|
7595
|
+
if re.fullmatch(r"(?:(?:static\s+func|func\s+static|func)\s+)" + _DEFINITION_NAME + "(?:\\." + _DEFINITION_NAME + ")?" , first, re.IGNORECASE):
|
|
7590
7596
|
return last.casefold() != "endfunc"
|
|
7591
7597
|
|
|
7592
7598
|
if re.fullmatch(r"define\s+" + _DEFINITION_NAME + r"\s*\{\s*\}", first):
|
|
@@ -10,7 +10,7 @@ import shutil
|
|
|
10
10
|
import subprocess
|
|
11
11
|
import time
|
|
12
12
|
|
|
13
|
-
VERSION = "0.0.
|
|
13
|
+
VERSION = "0.0.9"
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def _write_system_clipboard(text):
|
|
@@ -357,7 +357,76 @@ def _token_style(kind, value):
|
|
|
357
357
|
return HIGHLIGHT_STYLES[category]
|
|
358
358
|
|
|
359
359
|
|
|
360
|
-
|
|
360
|
+
MANIFEST_TOKEN_RE = re.compile(
|
|
361
|
+
r"(?P<comment>#.*$)"
|
|
362
|
+
r"|(?P<string>'(?:\\.|[^'\\])*'|\"(?:\\.|[^\"\\])*\")"
|
|
363
|
+
r"|(?P<number>(?<![\w.])[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?!\w))"
|
|
364
|
+
r"|(?P<literal>\b(?:true|false|null)\b)"
|
|
365
|
+
r"|(?P<identifier>[A-Za-z_][A-Za-z0-9_-]*)"
|
|
366
|
+
r"|(?P<operator>=)"
|
|
367
|
+
r"|(?P<delimiter>[\[\]{}:,.])",
|
|
368
|
+
re.IGNORECASE,
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
def _apply_manifest_syntax_highlighting(text, filename):
|
|
372
|
+
"""Highlight JSON/TOML package manifests with the editor's existing theme."""
|
|
373
|
+
is_json = os.path.basename(filename).casefold() == "cqlpackage.json"
|
|
374
|
+
is_toml = os.path.basename(filename).casefold() == "cqlpackage.toml"
|
|
375
|
+
if not (is_json or is_toml):
|
|
376
|
+
return None
|
|
377
|
+
|
|
378
|
+
# TOML table headers are clearer when highlighted as a unit.
|
|
379
|
+
stripped = text.lstrip()
|
|
380
|
+
if is_toml and stripped.startswith("[") and stripped.endswith("]"):
|
|
381
|
+
leading = text[:len(text) - len(stripped)]
|
|
382
|
+
return leading + HIGHLIGHT_STYLES["type"] + stripped + RESET
|
|
383
|
+
|
|
384
|
+
parts = []
|
|
385
|
+
last_end = 0
|
|
386
|
+
for match in MANIFEST_TOKEN_RE.finditer(text):
|
|
387
|
+
parts.append(text[last_end:match.start()])
|
|
388
|
+
token = match.group()
|
|
389
|
+
kind = match.lastgroup
|
|
390
|
+
tail = text[match.end():]
|
|
391
|
+
style = ""
|
|
392
|
+
|
|
393
|
+
if kind == "comment" and is_toml:
|
|
394
|
+
style = HIGHLIGHT_STYLES["comment"]
|
|
395
|
+
elif kind == "string":
|
|
396
|
+
next_nonspace = tail.lstrip()[:1]
|
|
397
|
+
if (is_json and next_nonspace == ":") or (is_toml and next_nonspace == "="):
|
|
398
|
+
style = HIGHLIGHT_STYLES["property"]
|
|
399
|
+
else:
|
|
400
|
+
style = HIGHLIGHT_STYLES["string"]
|
|
401
|
+
elif kind == "number":
|
|
402
|
+
style = HIGHLIGHT_STYLES["number"]
|
|
403
|
+
elif kind == "literal":
|
|
404
|
+
# JSON literals are lowercase; TOML booleans are lowercase too.
|
|
405
|
+
style = HIGHLIGHT_STYLES["constant"]
|
|
406
|
+
elif kind == "identifier" and is_toml:
|
|
407
|
+
if tail.lstrip().startswith("="):
|
|
408
|
+
style = HIGHLIGHT_STYLES["property"]
|
|
409
|
+
elif token.casefold() in {"true", "false", "inf", "nan"}:
|
|
410
|
+
style = HIGHLIGHT_STYLES["constant"]
|
|
411
|
+
elif kind == "operator":
|
|
412
|
+
style = HIGHLIGHT_STYLES["operator"]
|
|
413
|
+
elif kind == "delimiter" and token.strip():
|
|
414
|
+
style = HIGHLIGHT_STYLES["delimiter"]
|
|
415
|
+
|
|
416
|
+
if style:
|
|
417
|
+
parts.extend((style, token, RESET))
|
|
418
|
+
else:
|
|
419
|
+
parts.append(token)
|
|
420
|
+
last_end = match.end()
|
|
421
|
+
parts.append(text[last_end:])
|
|
422
|
+
return "".join(parts)
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
def apply_syntax_highlighting(text, filename=None):
|
|
426
|
+
if filename:
|
|
427
|
+
manifest_highlighting = _apply_manifest_syntax_highlighting(text, filename)
|
|
428
|
+
if manifest_highlighting is not None:
|
|
429
|
+
return manifest_highlighting
|
|
361
430
|
parts = []
|
|
362
431
|
last_end = 0
|
|
363
432
|
for match in TOKEN_RE.finditer(text):
|
|
@@ -495,7 +564,7 @@ class Editor:
|
|
|
495
564
|
current = (match_start, match_end) == self.current_search_match
|
|
496
565
|
overlays.append((start, end, "\x1b[7m" if current else "\x1b[43m", 1))
|
|
497
566
|
if not overlays:
|
|
498
|
-
return apply_syntax_highlighting(visible_text)
|
|
567
|
+
return apply_syntax_highlighting(visible_text, self.filename)
|
|
499
568
|
|
|
500
569
|
boundaries = {line_start, line_end}
|
|
501
570
|
for start, end, _, _ in overlays:
|
|
@@ -520,7 +589,7 @@ class Editor:
|
|
|
520
589
|
style = max(active, key=lambda overlay: overlay[3])[2]
|
|
521
590
|
parts.extend((style, segment, RESET))
|
|
522
591
|
else:
|
|
523
|
-
parts.append(apply_syntax_highlighting(segment))
|
|
592
|
+
parts.append(apply_syntax_highlighting(segment, self.filename))
|
|
524
593
|
return "".join(parts)
|
|
525
594
|
|
|
526
595
|
def _keep_cursor_visible(self, height, width, visual_cursor_x):
|
|
@@ -628,8 +697,9 @@ class Editor:
|
|
|
628
697
|
self._insert_newline()
|
|
629
698
|
elif key == "\t":
|
|
630
699
|
self._insert_text("\t")
|
|
631
|
-
elif key and key.isprintable() and "+" not in key:
|
|
632
|
-
#
|
|
700
|
+
elif key and key.isprintable() and (len(key) == 1 or "+" not in key):
|
|
701
|
+
# Single printable characters (including '+') are text; multi-part
|
|
702
|
+
# names such as "alt+delete" are symbolic key events.
|
|
633
703
|
self._insert_text(key)
|
|
634
704
|
if key not in ("\x11",):
|
|
635
705
|
self.quit_requested = False
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chemql-python
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.1
|
|
4
4
|
Summary: A chemistry-focused query language and REPL
|
|
5
5
|
Author-email: Mohammad Rakibul Islam <rakibulofficial1017@gmail.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -20,7 +20,7 @@ SQL-inspired syntax, inspect elements and molecules, look up reactions,
|
|
|
20
20
|
balance equations, and combine chemistry queries with Python and shell
|
|
21
21
|
commands.
|
|
22
22
|
|
|
23
|
-
- **Version:** `1.6.
|
|
23
|
+
- **Version:** `1.6.1`
|
|
24
24
|
- **PyPI distribution:** `chemql-python`
|
|
25
25
|
- **Python import / CLI name:** `chemql`
|
|
26
26
|
- **Author:** Mohammad Rakibul Islam
|
|
@@ -148,10 +148,11 @@ exit
|
|
|
148
148
|
|
|
149
149
|
### Terminal editor
|
|
150
150
|
|
|
151
|
-
Install the package, then open a ChemQL file with the `codecql` command
|
|
151
|
+
Install the package, then open a ChemQL file with the `codecql` command or `chemql edit`:
|
|
152
152
|
|
|
153
153
|
``` bash
|
|
154
154
|
codecql script.cql
|
|
155
|
+
chemql edit script.cql # this works too
|
|
155
156
|
```
|
|
156
157
|
|
|
157
158
|
The editor supports syntax highlighting, direct text editing, word movement
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|