chemql-python 1.3.2__tar.gz → 1.4.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.
Files changed (31) hide show
  1. {chemql_python-1.3.2/src/chemql_python.egg-info → chemql_python-1.4.0}/PKG-INFO +93 -6
  2. {chemql_python-1.3.2 → chemql_python-1.4.0}/README.md +92 -5
  3. {chemql_python-1.3.2 → chemql_python-1.4.0}/pyproject.toml +10 -2
  4. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql/__init__.py +858 -42
  5. chemql_python-1.4.0/src/chemql/stdlib/README.md +40 -0
  6. chemql_python-1.4.0/src/chemql/stdlib/collections.cql +29 -0
  7. chemql_python-1.4.0/src/chemql/stdlib/datetime.cql +32 -0
  8. chemql_python-1.4.0/src/chemql/stdlib/json.cql +14 -0
  9. chemql_python-1.4.0/src/chemql/stdlib/math/statistics.cql +41 -0
  10. chemql_python-1.4.0/src/chemql/stdlib/math.cql +86 -0
  11. chemql_python-1.4.0/src/chemql/stdlib/text.cql +77 -0
  12. {chemql_python-1.3.2 → chemql_python-1.4.0/src/chemql_python.egg-info}/PKG-INFO +93 -6
  13. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql_python.egg-info/SOURCES.txt +7 -0
  14. {chemql_python-1.3.2 → chemql_python-1.4.0}/LICENSE +0 -0
  15. {chemql_python-1.3.2 → chemql_python-1.4.0}/setup.cfg +0 -0
  16. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql/__main__.py +0 -0
  17. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql/data/BondEnergies.json +0 -0
  18. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql/data/MoleculeBonds.json +0 -0
  19. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql/data/Molecules.json +0 -0
  20. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql/data/PeriodicTableJSON.json +0 -0
  21. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql/data/Reactions.json +0 -0
  22. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql/data/THIRD_PARTY_LICENSES/PeriodicTableJSON.txt +0 -0
  23. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql/data/THIRD_PARTY_LICENSES/RHEA.txt +0 -0
  24. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql/html/periodic_table.html +0 -0
  25. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql_python.egg-info/dependency_links.txt +0 -0
  26. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql_python.egg-info/entry_points.txt +0 -0
  27. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql_python.egg-info/requires.txt +0 -0
  28. {chemql_python-1.3.2 → chemql_python-1.4.0}/src/chemql_python.egg-info/top_level.txt +0 -0
  29. {chemql_python-1.3.2 → chemql_python-1.4.0}/tests/test_external_molecule_lookup.py +0 -0
  30. {chemql_python-1.3.2 → chemql_python-1.4.0}/tests/test_public_api.py +0 -0
  31. {chemql_python-1.3.2 → chemql_python-1.4.0}/tests/test_reactions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chemql-python
3
- Version: 1.3.2
3
+ Version: 1.4.0
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.3.2`
22
+ - **Version:** `1.4.0`
23
23
  - **PyPI distribution:** `chemql-python`
24
24
  - **Python import / CLI name:** `chemql`
25
25
  - **Author:** Mohammad Rakibul Islam
@@ -41,6 +41,9 @@ commands.
41
41
  - [Functions, definitions, and
42
42
  macros](#functions-definitions-and-macros)
43
43
  - [Structs and records](#structs-and-records)
44
+ - [Namespaces](#namespaces)
45
+ - [Standard library](#standard-library)
46
+ - [Built-in help](#built-in-help)
44
47
  - [Shell integration and scripting](#shell-integration-and-scripting)
45
48
  - [CLI options and history export](#cli-options-and-history-export)
46
49
  - [Python API](#python-api)
@@ -644,11 +647,9 @@ command lists definitions in the current session.
644
647
 
645
648
  ## Structs and records
646
649
 
647
- ChemQL v1.3.0 includes named structured values, constructors, variables,
648
- and user-defined methods. This area is evolving; test advanced method
649
- dispatch and operator overloading in the exact build you use.
650
+ ChemQL v1.4.0 allows required fields defined by a trailing exclamation mark `!` or the `required` keyword
650
651
 
651
- ``` text
652
+ ```text
652
653
  struct Fruit
653
654
  name
654
655
  price
@@ -658,6 +659,18 @@ let apple = Fruit{name="Apple", price=35}
658
659
  apple
659
660
  apple.name
660
661
  apple.price
662
+ let orange = Fruit{"Orange", 20} // you can use position rather than just keyword arguments
663
+ let banana = Fruit{"Banana", price = 10} // or you can even mix
664
+
665
+ ```
666
+ ```text
667
+ struct Vegetable
668
+ name!
669
+ required weight
670
+ price
671
+ endstruct
672
+
673
+ let apple = Vegetable{name="Carrot"} //this gives an error
661
674
  ```
662
675
 
663
676
  The implementation also supports defining methods on structured types.
@@ -665,6 +678,80 @@ Special methods such as `__add__` are intended for custom behaviour, but
665
678
  do not assume every Python data-model feature or operator dispatch path
666
679
  is fully implemented.
667
680
 
681
+ ## Namespaces
682
+
683
+ Namespaces store functions, structs, records, variables, etc.
684
+
685
+ To declare functions accessible in the global scope you must use the `public` keyword, everything is private by default, you may still add the `private` keyword for fun
686
+ Example
687
+ ```text
688
+ namespace math
689
+ public let PI = 3.14159265358979
690
+ public let E = 2.718281828459045
691
+ public
692
+
693
+
694
+ ```
695
+
696
+ ## Standard library
697
+
698
+ ChemQL loads reusable `.cql` packages with `load`. The loader searches the current
699
+ directory and then the interpreter's adjacent `stdlib/` directory. Preserve the
700
+ folder structure when extracting `chemql_stdlib.zip`.
701
+
702
+ | Package | Purpose |
703
+ | --- | --- |
704
+ | `math` | `PI`, `E`, trigonometry, logarithms, factorial, `gcd`, `lcm`, and more |
705
+ | `math::statistics` | `mean`, `median`, `mode`, `variance`, `stdev`, and quantiles |
706
+ | `text` | String casing, trimming, splitting/joining, substring and regex helpers |
707
+ | `collections` | `unique`, `flatten`, `zip`, `pairwise`, frequency counts, product |
708
+ | `datetime` | Current date/time, ISO dates, timestamps, weekday and date arithmetic |
709
+ | `json` | JSON serialization, pretty serialization, parsing and type inspection |
710
+
711
+ ```chemql
712
+ load math
713
+ math::sqrt{81}
714
+ math::sin{math::radians{30}}
715
+
716
+ load math::statistics
717
+ math::statistics::mean{2, 4, 6}
718
+
719
+ load text
720
+ text::upper{"hello"}
721
+ text::split{"red,green,blue", ","}
722
+ text::regex_findall{"[A-Z][a-z]+", "Water and Sodium Chloride"}
723
+
724
+ load collections
725
+ collections::unique{1, 2, 1, 3}
726
+ collections::frequencies{"red", "blue", "red"}
727
+
728
+ load datetime
729
+ datetime::date{2026, 10, 20}
730
+ datetime::date_add_days{"2026-10-20", 7}
731
+
732
+ load json
733
+ json::loads{"{\"formula\": \"H2O\"}"}
734
+ ```
735
+
736
+ These packages use Python's standard library only; they add no third-party dependencies.
737
+
738
+ ## Built-in help
739
+
740
+ The help system includes a general index and topic/function pages:
741
+
742
+ ```chemql
743
+ help
744
+ help{read_csv}
745
+ help{TooFewArguments}
746
+ help{syntax}
747
+ help{errors}
748
+ help{files}
749
+ help{chemistry}
750
+ ```
751
+
752
+ Use `help{function_name}` for built-in documentation. The ANSI-colored help screen
753
+ also includes a quick reference to the standard-library packages.
754
+
668
755
  ## Shell integration and scripting
669
756
 
670
757
  Backticks execute a command through the host system shell:
@@ -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.3.2`
9
+ - **Version:** `1.4.0`
10
10
  - **PyPI distribution:** `chemql-python`
11
11
  - **Python import / CLI name:** `chemql`
12
12
  - **Author:** Mohammad Rakibul Islam
@@ -28,6 +28,9 @@ commands.
28
28
  - [Functions, definitions, and
29
29
  macros](#functions-definitions-and-macros)
30
30
  - [Structs and records](#structs-and-records)
31
+ - [Namespaces](#namespaces)
32
+ - [Standard library](#standard-library)
33
+ - [Built-in help](#built-in-help)
31
34
  - [Shell integration and scripting](#shell-integration-and-scripting)
32
35
  - [CLI options and history export](#cli-options-and-history-export)
33
36
  - [Python API](#python-api)
@@ -631,11 +634,9 @@ command lists definitions in the current session.
631
634
 
632
635
  ## Structs and records
633
636
 
634
- ChemQL v1.3.0 includes named structured values, constructors, variables,
635
- and user-defined methods. This area is evolving; test advanced method
636
- dispatch and operator overloading in the exact build you use.
637
+ ChemQL v1.4.0 allows required fields defined by a trailing exclamation mark `!` or the `required` keyword
637
638
 
638
- ``` text
639
+ ```text
639
640
  struct Fruit
640
641
  name
641
642
  price
@@ -645,6 +646,18 @@ let apple = Fruit{name="Apple", price=35}
645
646
  apple
646
647
  apple.name
647
648
  apple.price
649
+ let orange = Fruit{"Orange", 20} // you can use position rather than just keyword arguments
650
+ let banana = Fruit{"Banana", price = 10} // or you can even mix
651
+
652
+ ```
653
+ ```text
654
+ struct Vegetable
655
+ name!
656
+ required weight
657
+ price
658
+ endstruct
659
+
660
+ let apple = Vegetable{name="Carrot"} //this gives an error
648
661
  ```
649
662
 
650
663
  The implementation also supports defining methods on structured types.
@@ -652,6 +665,80 @@ Special methods such as `__add__` are intended for custom behaviour, but
652
665
  do not assume every Python data-model feature or operator dispatch path
653
666
  is fully implemented.
654
667
 
668
+ ## Namespaces
669
+
670
+ Namespaces store functions, structs, records, variables, etc.
671
+
672
+ To declare functions accessible in the global scope you must use the `public` keyword, everything is private by default, you may still add the `private` keyword for fun
673
+ Example
674
+ ```text
675
+ namespace math
676
+ public let PI = 3.14159265358979
677
+ public let E = 2.718281828459045
678
+ public
679
+
680
+
681
+ ```
682
+
683
+ ## Standard library
684
+
685
+ ChemQL loads reusable `.cql` packages with `load`. The loader searches the current
686
+ directory and then the interpreter's adjacent `stdlib/` directory. Preserve the
687
+ folder structure when extracting `chemql_stdlib.zip`.
688
+
689
+ | Package | Purpose |
690
+ | --- | --- |
691
+ | `math` | `PI`, `E`, trigonometry, logarithms, factorial, `gcd`, `lcm`, and more |
692
+ | `math::statistics` | `mean`, `median`, `mode`, `variance`, `stdev`, and quantiles |
693
+ | `text` | String casing, trimming, splitting/joining, substring and regex helpers |
694
+ | `collections` | `unique`, `flatten`, `zip`, `pairwise`, frequency counts, product |
695
+ | `datetime` | Current date/time, ISO dates, timestamps, weekday and date arithmetic |
696
+ | `json` | JSON serialization, pretty serialization, parsing and type inspection |
697
+
698
+ ```chemql
699
+ load math
700
+ math::sqrt{81}
701
+ math::sin{math::radians{30}}
702
+
703
+ load math::statistics
704
+ math::statistics::mean{2, 4, 6}
705
+
706
+ load text
707
+ text::upper{"hello"}
708
+ text::split{"red,green,blue", ","}
709
+ text::regex_findall{"[A-Z][a-z]+", "Water and Sodium Chloride"}
710
+
711
+ load collections
712
+ collections::unique{1, 2, 1, 3}
713
+ collections::frequencies{"red", "blue", "red"}
714
+
715
+ load datetime
716
+ datetime::date{2026, 10, 20}
717
+ datetime::date_add_days{"2026-10-20", 7}
718
+
719
+ load json
720
+ json::loads{"{\"formula\": \"H2O\"}"}
721
+ ```
722
+
723
+ These packages use Python's standard library only; they add no third-party dependencies.
724
+
725
+ ## Built-in help
726
+
727
+ The help system includes a general index and topic/function pages:
728
+
729
+ ```chemql
730
+ help
731
+ help{read_csv}
732
+ help{TooFewArguments}
733
+ help{syntax}
734
+ help{errors}
735
+ help{files}
736
+ help{chemistry}
737
+ ```
738
+
739
+ Use `help{function_name}` for built-in documentation. The ANSI-colored help screen
740
+ also includes a quick reference to the standard-library packages.
741
+
655
742
  ## Shell integration and scripting
656
743
 
657
744
  Backticks execute a command through the host system shell:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "chemql-python"
7
- version = "1.3.2"
7
+ version = "1.4.0"
8
8
  authors = [
9
9
  { name = "Mohammad Rakibul Islam", email = "rakibulofficial1017@gmail.com" }
10
10
  ]
@@ -28,4 +28,12 @@ package-dir = {"" = "src"}
28
28
  where = ["src"]
29
29
 
30
30
  [tool.setuptools.package-data]
31
- chemql = ["data/*.json", "data/THIRD_PARTY_LICENSES/*.txt", "html/*.html"]
31
+ chemql = [
32
+ "data/*.json",
33
+ "data/THIRD_PARTY_LICENSES/*.txt",
34
+ "html/*.html",
35
+ "stdlib/**/*.cql",
36
+ "stdlib/*.cql",
37
+ "stdlib/**/*.md",
38
+ "stdlib/*.md",
39
+ ]