chemql-python 1.4.2__tar.gz → 1.5.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.4.2/src/chemql_python.egg-info → chemql_python-1.5.1}/PKG-INFO +104 -3
- {chemql_python-1.4.2 → chemql_python-1.5.1}/README.md +103 -2
- {chemql_python-1.4.2 → chemql_python-1.5.1}/pyproject.toml +3 -1
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/__init__.py +279 -46
- chemql_python-1.5.1/src/chemql/codecql.py +477 -0
- chemql_python-1.5.1/src/chemql/colors.json +77 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1/src/chemql_python.egg-info}/PKG-INFO +104 -3
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql_python.egg-info/SOURCES.txt +5 -1
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql_python.egg-info/entry_points.txt +1 -0
- chemql_python-1.5.1/tests/test_codecql.py +23 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/tests/test_public_api.py +1 -1
- chemql_python-1.5.1/tests/test_structured_types.py +181 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/LICENSE +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/setup.cfg +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/__main__.py +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/data/BondEnergies.json +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/data/MoleculeBonds.json +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/data/Molecules.json +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/data/PeriodicTableJSON.json +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/data/Reactions.json +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/data/THIRD_PARTY_LICENSES/PeriodicTableJSON.txt +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/data/THIRD_PARTY_LICENSES/RHEA.txt +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/html/periodic_table.html +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/stdlib/README.md +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/stdlib/collections.cql +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/stdlib/datetime.cql +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/stdlib/decimal.cql +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/stdlib/fractions.cql +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/stdlib/json.cql +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/stdlib/math/statistics.cql +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/stdlib/math.cql +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/stdlib/pathlib.cql +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/stdlib/random.cql +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql/stdlib/text.cql +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql_python.egg-info/dependency_links.txt +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql_python.egg-info/requires.txt +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/src/chemql_python.egg-info/top_level.txt +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/tests/test_external_molecule_lookup.py +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/tests/test_reactions.py +0 -0
- {chemql_python-1.4.2 → chemql_python-1.5.1}/tests/test_stdlib.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chemql-python
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.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
|
|
@@ -19,7 +19,7 @@ SQL-inspired syntax, inspect elements and molecules, look up reactions,
|
|
|
19
19
|
balance equations, and combine chemistry queries with Python and shell
|
|
20
20
|
commands.
|
|
21
21
|
|
|
22
|
-
- **Version:** `1.
|
|
22
|
+
- **Version:** `1.5.1`
|
|
23
23
|
- **PyPI distribution:** `chemql-python`
|
|
24
24
|
- **Python import / CLI name:** `chemql`
|
|
25
25
|
- **Author:** Mohammad Rakibul Islam
|
|
@@ -67,6 +67,9 @@ commands.
|
|
|
67
67
|
matching.
|
|
68
68
|
- Use Python statements, expressions, variables, control flow,
|
|
69
69
|
functions, macros, and structured values.
|
|
70
|
+
- Define enums with automatic or explicit values, and inherit structs
|
|
71
|
+
from structs, records, or Python classes; records can inherit from
|
|
72
|
+
other records.
|
|
70
73
|
- Execute shell commands and multiline shell blocks from the REPL.
|
|
71
74
|
- Export recorded commands and results.
|
|
72
75
|
- Use the command-line interface or import ChemQL from Python.
|
|
@@ -140,6 +143,18 @@ exit
|
|
|
140
143
|
- `list all` shows available sources and fields.
|
|
141
144
|
- `exit` leaves the prompt.
|
|
142
145
|
|
|
146
|
+
### Terminal editor
|
|
147
|
+
|
|
148
|
+
Install the package, then open a ChemQL file with the `codecql` command:
|
|
149
|
+
|
|
150
|
+
``` bash
|
|
151
|
+
codecql script.cql
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The editor supports syntax highlighting, direct text editing, undo (`Ctrl+Z`),
|
|
155
|
+
redo (`Ctrl+Y`), save (`Ctrl+S`), and quit (`Ctrl+Q`). Its syntax and UI
|
|
156
|
+
colors are configurable in the packaged `chemql/colors.json` file.
|
|
157
|
+
|
|
143
158
|
## Query language
|
|
144
159
|
|
|
145
160
|
A typical query starts with `search`, a source, optional conditions, and
|
|
@@ -652,7 +667,8 @@ command lists definitions in the current session.
|
|
|
652
667
|
|
|
653
668
|
## Structs and records
|
|
654
669
|
|
|
655
|
-
ChemQL 1.
|
|
670
|
+
ChemQL 1.5.0 supports enums and inheritance in addition to required fields,
|
|
671
|
+
marked with a trailing `!` or the
|
|
656
672
|
`required` keyword:
|
|
657
673
|
|
|
658
674
|
```text
|
|
@@ -684,6 +700,87 @@ Special methods such as `__add__` are intended for custom behaviour, but
|
|
|
684
700
|
do not assume every Python data-model feature or operator dispatch path
|
|
685
701
|
is fully implemented.
|
|
686
702
|
|
|
703
|
+
### Enums
|
|
704
|
+
|
|
705
|
+
An enum member without an explicit value receives an automatically generated
|
|
706
|
+
integer value. Automatic values continue from the preceding numeric value:
|
|
707
|
+
|
|
708
|
+
```text
|
|
709
|
+
enum Levels
|
|
710
|
+
LOW = 50
|
|
711
|
+
MEDIUM
|
|
712
|
+
HIGH
|
|
713
|
+
endenum
|
|
714
|
+
|
|
715
|
+
let selected = Levels.MEDIUM
|
|
716
|
+
[selected.value] // 51
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
### Inheritance
|
|
720
|
+
|
|
721
|
+
Structs can inherit fields and behavior from another struct, a record, or a
|
|
722
|
+
Python class available in ChemQL's Python globals. Records can inherit only
|
|
723
|
+
from other records:
|
|
724
|
+
|
|
725
|
+
```text
|
|
726
|
+
struct Animal
|
|
727
|
+
name!
|
|
728
|
+
endstruct
|
|
729
|
+
|
|
730
|
+
struct Dog from Animal
|
|
731
|
+
color!
|
|
732
|
+
isSmall = False
|
|
733
|
+
endstruct
|
|
734
|
+
|
|
735
|
+
let pet = Dog{"Rex", "brown"}
|
|
736
|
+
pet.name
|
|
737
|
+
pet.color
|
|
738
|
+
|
|
739
|
+
record Identity
|
|
740
|
+
id
|
|
741
|
+
endrecord
|
|
742
|
+
|
|
743
|
+
record Product from Identity
|
|
744
|
+
name
|
|
745
|
+
endrecord
|
|
746
|
+
|
|
747
|
+
let item = Product{7, "Copper"}
|
|
748
|
+
item.id
|
|
749
|
+
item.name
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
Structs may also extend a Python class defined or imported into the active
|
|
753
|
+
Python namespace. Built-in classes such as `int` can be named directly; a
|
|
754
|
+
bracketed Python expression such as `[int]` is also accepted. Initializer
|
|
755
|
+
parameters from ordinary Python classes become inherited constructor fields,
|
|
756
|
+
and the Python initializer is called when the ChemQL struct is constructed.
|
|
757
|
+
Native value types such as `int` keep their native constructor and value
|
|
758
|
+
behavior:
|
|
759
|
+
|
|
760
|
+
```text
|
|
761
|
+
[[[
|
|
762
|
+
class PythonAnimal:
|
|
763
|
+
def __init__(self, name):
|
|
764
|
+
self.name = name
|
|
765
|
+
]]]
|
|
766
|
+
|
|
767
|
+
struct Pet from PythonAnimal
|
|
768
|
+
species = "unknown"
|
|
769
|
+
endstruct
|
|
770
|
+
|
|
771
|
+
let pet = Pet{"Milo", "cat"}
|
|
772
|
+
pet.name
|
|
773
|
+
pet.species
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
```text
|
|
777
|
+
struct Integer from int
|
|
778
|
+
endstruct
|
|
779
|
+
|
|
780
|
+
let answer = Integer{42}
|
|
781
|
+
[answer + 1] // 43
|
|
782
|
+
```
|
|
783
|
+
|
|
687
784
|
## Namespaces
|
|
688
785
|
|
|
689
786
|
Namespaces group functions, structs, records, and variables. Members are
|
|
@@ -866,6 +963,10 @@ Supported forms include `dump all|good|bad FILE`,
|
|
|
866
963
|
`dump all|good|bad queries FILE`, and `dump all|good|bad results FILE`.
|
|
867
964
|
`good` and `bad` select successful and failed executions respectively.
|
|
868
965
|
|
|
966
|
+
## CLI code editor
|
|
967
|
+
|
|
968
|
+
You can edit code in the terminal using `codecql script.cql` if your script is named `script.cql`
|
|
969
|
+
|
|
869
970
|
## Python API
|
|
870
971
|
|
|
871
972
|
``` python
|
|
@@ -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.
|
|
9
|
+
- **Version:** `1.5.1`
|
|
10
10
|
- **PyPI distribution:** `chemql-python`
|
|
11
11
|
- **Python import / CLI name:** `chemql`
|
|
12
12
|
- **Author:** Mohammad Rakibul Islam
|
|
@@ -54,6 +54,9 @@ commands.
|
|
|
54
54
|
matching.
|
|
55
55
|
- Use Python statements, expressions, variables, control flow,
|
|
56
56
|
functions, macros, and structured values.
|
|
57
|
+
- Define enums with automatic or explicit values, and inherit structs
|
|
58
|
+
from structs, records, or Python classes; records can inherit from
|
|
59
|
+
other records.
|
|
57
60
|
- Execute shell commands and multiline shell blocks from the REPL.
|
|
58
61
|
- Export recorded commands and results.
|
|
59
62
|
- Use the command-line interface or import ChemQL from Python.
|
|
@@ -127,6 +130,18 @@ exit
|
|
|
127
130
|
- `list all` shows available sources and fields.
|
|
128
131
|
- `exit` leaves the prompt.
|
|
129
132
|
|
|
133
|
+
### Terminal editor
|
|
134
|
+
|
|
135
|
+
Install the package, then open a ChemQL file with the `codecql` command:
|
|
136
|
+
|
|
137
|
+
``` bash
|
|
138
|
+
codecql script.cql
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The editor supports syntax highlighting, direct text editing, undo (`Ctrl+Z`),
|
|
142
|
+
redo (`Ctrl+Y`), save (`Ctrl+S`), and quit (`Ctrl+Q`). Its syntax and UI
|
|
143
|
+
colors are configurable in the packaged `chemql/colors.json` file.
|
|
144
|
+
|
|
130
145
|
## Query language
|
|
131
146
|
|
|
132
147
|
A typical query starts with `search`, a source, optional conditions, and
|
|
@@ -639,7 +654,8 @@ command lists definitions in the current session.
|
|
|
639
654
|
|
|
640
655
|
## Structs and records
|
|
641
656
|
|
|
642
|
-
ChemQL 1.
|
|
657
|
+
ChemQL 1.5.0 supports enums and inheritance in addition to required fields,
|
|
658
|
+
marked with a trailing `!` or the
|
|
643
659
|
`required` keyword:
|
|
644
660
|
|
|
645
661
|
```text
|
|
@@ -671,6 +687,87 @@ Special methods such as `__add__` are intended for custom behaviour, but
|
|
|
671
687
|
do not assume every Python data-model feature or operator dispatch path
|
|
672
688
|
is fully implemented.
|
|
673
689
|
|
|
690
|
+
### Enums
|
|
691
|
+
|
|
692
|
+
An enum member without an explicit value receives an automatically generated
|
|
693
|
+
integer value. Automatic values continue from the preceding numeric value:
|
|
694
|
+
|
|
695
|
+
```text
|
|
696
|
+
enum Levels
|
|
697
|
+
LOW = 50
|
|
698
|
+
MEDIUM
|
|
699
|
+
HIGH
|
|
700
|
+
endenum
|
|
701
|
+
|
|
702
|
+
let selected = Levels.MEDIUM
|
|
703
|
+
[selected.value] // 51
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
### Inheritance
|
|
707
|
+
|
|
708
|
+
Structs can inherit fields and behavior from another struct, a record, or a
|
|
709
|
+
Python class available in ChemQL's Python globals. Records can inherit only
|
|
710
|
+
from other records:
|
|
711
|
+
|
|
712
|
+
```text
|
|
713
|
+
struct Animal
|
|
714
|
+
name!
|
|
715
|
+
endstruct
|
|
716
|
+
|
|
717
|
+
struct Dog from Animal
|
|
718
|
+
color!
|
|
719
|
+
isSmall = False
|
|
720
|
+
endstruct
|
|
721
|
+
|
|
722
|
+
let pet = Dog{"Rex", "brown"}
|
|
723
|
+
pet.name
|
|
724
|
+
pet.color
|
|
725
|
+
|
|
726
|
+
record Identity
|
|
727
|
+
id
|
|
728
|
+
endrecord
|
|
729
|
+
|
|
730
|
+
record Product from Identity
|
|
731
|
+
name
|
|
732
|
+
endrecord
|
|
733
|
+
|
|
734
|
+
let item = Product{7, "Copper"}
|
|
735
|
+
item.id
|
|
736
|
+
item.name
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
Structs may also extend a Python class defined or imported into the active
|
|
740
|
+
Python namespace. Built-in classes such as `int` can be named directly; a
|
|
741
|
+
bracketed Python expression such as `[int]` is also accepted. Initializer
|
|
742
|
+
parameters from ordinary Python classes become inherited constructor fields,
|
|
743
|
+
and the Python initializer is called when the ChemQL struct is constructed.
|
|
744
|
+
Native value types such as `int` keep their native constructor and value
|
|
745
|
+
behavior:
|
|
746
|
+
|
|
747
|
+
```text
|
|
748
|
+
[[[
|
|
749
|
+
class PythonAnimal:
|
|
750
|
+
def __init__(self, name):
|
|
751
|
+
self.name = name
|
|
752
|
+
]]]
|
|
753
|
+
|
|
754
|
+
struct Pet from PythonAnimal
|
|
755
|
+
species = "unknown"
|
|
756
|
+
endstruct
|
|
757
|
+
|
|
758
|
+
let pet = Pet{"Milo", "cat"}
|
|
759
|
+
pet.name
|
|
760
|
+
pet.species
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
```text
|
|
764
|
+
struct Integer from int
|
|
765
|
+
endstruct
|
|
766
|
+
|
|
767
|
+
let answer = Integer{42}
|
|
768
|
+
[answer + 1] // 43
|
|
769
|
+
```
|
|
770
|
+
|
|
674
771
|
## Namespaces
|
|
675
772
|
|
|
676
773
|
Namespaces group functions, structs, records, and variables. Members are
|
|
@@ -853,6 +950,10 @@ Supported forms include `dump all|good|bad FILE`,
|
|
|
853
950
|
`dump all|good|bad queries FILE`, and `dump all|good|bad results FILE`.
|
|
854
951
|
`good` and `bad` select successful and failed executions respectively.
|
|
855
952
|
|
|
953
|
+
## CLI code editor
|
|
954
|
+
|
|
955
|
+
You can edit code in the terminal using `codecql script.cql` if your script is named `script.cql`
|
|
956
|
+
|
|
856
957
|
## Python API
|
|
857
958
|
|
|
858
959
|
``` python
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "chemql-python"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.5.1"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name = "Mohammad Rakibul Islam", email = "rakibulofficial1017@gmail.com" }
|
|
10
10
|
]
|
|
@@ -20,6 +20,7 @@ test = ["pytest>=8.0"]
|
|
|
20
20
|
|
|
21
21
|
[project.scripts]
|
|
22
22
|
chemql = "chemql:main"
|
|
23
|
+
codecql = "chemql.codecql:main"
|
|
23
24
|
|
|
24
25
|
[tool.setuptools]
|
|
25
26
|
package-dir = {"" = "src"}
|
|
@@ -29,6 +30,7 @@ where = ["src"]
|
|
|
29
30
|
|
|
30
31
|
[tool.setuptools.package-data]
|
|
31
32
|
chemql = [
|
|
33
|
+
"colors.json",
|
|
32
34
|
"data/*.json",
|
|
33
35
|
"data/THIRD_PARTY_LICENSES/*.txt",
|
|
34
36
|
"html/*.html",
|