chemql-python 1.5.6__tar.gz → 1.5.7__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 (40) hide show
  1. {chemql_python-1.5.6 → chemql_python-1.5.7}/PKG-INFO +2 -2
  2. {chemql_python-1.5.6 → chemql_python-1.5.7}/README.md +1 -1
  3. {chemql_python-1.5.6 → chemql_python-1.5.7}/pyproject.toml +1 -1
  4. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/__init__.py +1 -1
  5. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/codecql.py +34 -16
  6. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql_python.egg-info/PKG-INFO +2 -2
  7. {chemql_python-1.5.6 → chemql_python-1.5.7}/LICENSE +0 -0
  8. {chemql_python-1.5.6 → chemql_python-1.5.7}/setup.cfg +0 -0
  9. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/__main__.py +0 -0
  10. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/colors.json +0 -0
  11. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/data/BondEnergies.json +0 -0
  12. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/data/MoleculeBonds.json +0 -0
  13. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/data/Molecules.json +0 -0
  14. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/data/PeriodicTableJSON.json +0 -0
  15. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/data/Reactions.json +0 -0
  16. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/data/THIRD_PARTY_LICENSES/PeriodicTableJSON.txt +0 -0
  17. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/data/THIRD_PARTY_LICENSES/RHEA.txt +0 -0
  18. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/html/periodic_table.html +0 -0
  19. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/stdlib/README.md +0 -0
  20. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/stdlib/collections.cql +0 -0
  21. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/stdlib/datetime.cql +0 -0
  22. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/stdlib/decimal.cql +0 -0
  23. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/stdlib/fractions.cql +0 -0
  24. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/stdlib/json.cql +0 -0
  25. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/stdlib/math/statistics.cql +0 -0
  26. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/stdlib/math.cql +0 -0
  27. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/stdlib/pathlib.cql +0 -0
  28. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/stdlib/random.cql +0 -0
  29. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql/stdlib/text.cql +0 -0
  30. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql_python.egg-info/SOURCES.txt +0 -0
  31. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql_python.egg-info/dependency_links.txt +0 -0
  32. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql_python.egg-info/entry_points.txt +0 -0
  33. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql_python.egg-info/requires.txt +0 -0
  34. {chemql_python-1.5.6 → chemql_python-1.5.7}/src/chemql_python.egg-info/top_level.txt +0 -0
  35. {chemql_python-1.5.6 → chemql_python-1.5.7}/tests/test_codecql.py +0 -0
  36. {chemql_python-1.5.6 → chemql_python-1.5.7}/tests/test_external_molecule_lookup.py +0 -0
  37. {chemql_python-1.5.6 → chemql_python-1.5.7}/tests/test_public_api.py +0 -0
  38. {chemql_python-1.5.6 → chemql_python-1.5.7}/tests/test_reactions.py +0 -0
  39. {chemql_python-1.5.6 → chemql_python-1.5.7}/tests/test_stdlib.py +0 -0
  40. {chemql_python-1.5.6 → chemql_python-1.5.7}/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.5.6
3
+ Version: 1.5.7
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.5.6`
22
+ - **Version:** `1.5.7`
23
23
  - **PyPI distribution:** `chemql-python`
24
24
  - **Python import / CLI name:** `chemql`
25
25
  - **Author:** Mohammad Rakibul Islam
@@ -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.5.6`
9
+ - **Version:** `1.5.7`
10
10
  - **PyPI distribution:** `chemql-python`
11
11
  - **Python import / CLI name:** `chemql`
12
12
  - **Author:** Mohammad Rakibul Islam
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "chemql-python"
7
- version = "1.5.6"
7
+ version = "1.5.7"
8
8
  authors = [
9
9
  { name = "Mohammad Rakibul Islam", email = "rakibulofficial1017@gmail.com" }
10
10
  ]
@@ -64,7 +64,7 @@ __all__ = [
64
64
  "__version__"
65
65
  ]
66
66
 
67
- __version__ = "1.5.6"
67
+ __version__ = "1.5.7"
68
68
 
69
69
  # Persistent preprocessor/function state for the current ChemQL session.
70
70
  DEFINITIONS = {}
@@ -10,7 +10,7 @@ import shutil
10
10
  import subprocess
11
11
  import time
12
12
 
13
- VERSION = "0.0.6"
13
+ VERSION = "0.0.7"
14
14
 
15
15
 
16
16
  def _write_system_clipboard(text):
@@ -129,7 +129,7 @@ if os.name == 'nt':
129
129
  0x48: "arrow_up", 0x50: "arrow_down",
130
130
  0x4B: "arrow_left", 0x4D: "arrow_right",
131
131
  0x47: "arrow_home", 0x4F: "arrow_end",
132
- 0x53: "delete", 0x73: "ctrl+arrow_left",
132
+ 0x53: "delete", 0x93: "ctrl+delete", 0x73: "ctrl+arrow_left",
133
133
  0x74: "ctrl+arrow_right", 0x8D: "ctrl+arrow_up",
134
134
  0x91: "ctrl+arrow_down", 0x9B: "alt+arrow_left",
135
135
  0x9D: "alt+arrow_right",
@@ -455,7 +455,7 @@ class Editor:
455
455
  if self.search_active
456
456
  else self.message or (
457
457
  "Ctrl+S Save Ctrl+Z Undo Ctrl+Y Redo Ctrl+Q Quit "
458
- "Ctrl+F Search Ctrl+T Terminal Ctrl+Backspace/Delete Word"
458
+ "Ctrl+F Search Ctrl+T Terminal Ctrl+R Run ChemQL Ctrl+Backspace/Delete Word"
459
459
  )
460
460
  )
461
461
  output.extend((DIM, footer[:cols].ljust(cols), RESET))
@@ -529,7 +529,9 @@ class Editor:
529
529
  return self._handle_search_key(key)
530
530
  if key in ("\x14", "ctrl+t"):
531
531
  self._run_split_terminal()
532
- self.message = "Terminal closed"
532
+ return False
533
+ if key in ("\x12", "ctrl+r"):
534
+ self._run_split_terminal(run_chemql=True)
533
535
  return False
534
536
  if key in ("\x06", "ctrl+f"):
535
537
  self._open_search()
@@ -627,44 +629,58 @@ class Editor:
627
629
  self.cursor_x = min(self.cursor_x, len(self.lines[self.cursor_y]))
628
630
  return False
629
631
 
630
- def _run_split_terminal(self):
631
- """Open a shell in a manageable split pane where the platform allows it.
632
+ def _run_split_terminal(self, run_chemql=False):
633
+ """Open a shell; Ctrl+R also runs ChemQL on this file's absolute path."""
634
+ command = None
635
+ if run_chemql:
636
+ # Run the current buffer rather than stale on-disk contents.
637
+ if self.dirty:
638
+ self.save_file()
639
+ if self.dirty:
640
+ return
641
+ absolute_path = os.path.abspath(self.filename)
642
+ if os.name == "nt":
643
+ command = "chemql -f " + subprocess.list2cmdline([absolute_path])
644
+ else:
645
+ import shlex
646
+ command = "chemql -f " + shlex.quote(absolute_path)
632
647
 
633
- POSIX uses a PTY in the lower part of the current terminal. Ctrl+T or
634
- Esc returns to the editor; Ctrl+Up/Down resizes the shell pane. Window
635
- resize events are forwarded to the shell PTY. Windows Terminal owns
636
- its split panes, so on Windows its pane is independently resizable and
637
- closing the shell returns focus to the editor pane.
638
- """
639
648
  if os.name == "nt":
640
649
  shell = os.environ.get("COMSPEC", "cmd.exe")
641
650
  wt = shutil.which("wt.exe") or shutil.which("wt")
642
651
 
643
652
  if wt and os.environ.get("WT_SESSION"):
644
653
  try:
645
- subprocess.Popen([
654
+ args = [
646
655
  wt, "-w", "0", "split-pane", "-V",
647
656
  "--size", "0.35", "--title", "ChemQL Terminal",
648
657
  shell, "/K",
649
- ])
658
+ ]
659
+ if command:
660
+ args.append(command)
661
+ subprocess.Popen(args)
650
662
  except OSError as error:
651
663
  self.message = f"Could not open Windows Terminal pane: {error}"
652
664
  else:
653
665
  self.message = (
666
+ "ChemQL running in Windows Terminal pane" if command else
654
667
  "Terminal opened in a Windows Terminal pane; resize it with "
655
668
  "Alt+Shift+Plus/Minus or drag the divider. Exit the shell to close it."
656
669
  )
657
670
  return
658
671
 
659
672
  try:
673
+ args = [shell]
674
+ if command:
675
+ args.extend(["/K", command])
660
676
  subprocess.Popen(
661
- [shell],
677
+ args,
662
678
  creationflags=getattr(subprocess, "CREATE_NEW_CONSOLE", 0),
663
679
  )
664
680
  except OSError as error:
665
681
  self.message = f"Could not open terminal: {error}"
666
682
  else:
667
- self.message = "Terminal opened in a separate console window"
683
+ self.message = "ChemQL running in a separate console" if command else "Terminal opened in a separate console window"
668
684
  return
669
685
 
670
686
  stdin_fd = sys.stdin.fileno()
@@ -728,6 +744,8 @@ class Editor:
728
744
  struct.pack("HHHH", pane_height, cols, 0, 0),
729
745
  )
730
746
  tty.setraw(stdin_fd)
747
+ if command:
748
+ os.write(master_fd, command.encode("utf-8") + b"\n")
731
749
  sys.stdout.write(f"\x1b[{pane_top};{rows}r\x1b[?6h\x1b[1;1H")
732
750
  sys.stdout.flush()
733
751
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chemql-python
3
- Version: 1.5.6
3
+ Version: 1.5.7
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.5.6`
22
+ - **Version:** `1.5.7`
23
23
  - **PyPI distribution:** `chemql-python`
24
24
  - **Python import / CLI name:** `chemql`
25
25
  - **Author:** Mohammad Rakibul Islam
File without changes
File without changes