mystmd 1.1.39__py3-none-any.whl → 1.1.41__py3-none-any.whl

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.
@@ -1,24 +1,30 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mystmd
3
- Version: 1.1.39
3
+ Version: 1.1.41
4
4
  Summary: Command line tools for MyST Markdown
5
- Home-page: https://github.com/executablebooks/mystmd
6
- Author: Franklin Koch
7
- License: MIT
8
- Keywords: markdown,latex,writing-software,scientific-visualization,pdf-generation,science-research
5
+ Project-URL: Homepage, https://github.com/executablebooks/mystmd
6
+ Project-URL: Bug Tracker, https://github.com/executablebooks/mystmd/issues
7
+ Project-URL: Repository, https://github.com/executablebooks/mystmd.git
8
+ Author-email: Rowan Cockett <rowan@curvenote.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: latex,markdown,pdf-generation,science-research,scientific-visualization,writing-software
9
12
  Classifier: Intended Audience :: Science/Research
10
13
  Classifier: License :: OSI Approved :: MIT License
11
14
  Classifier: Operating System :: OS Independent
12
15
  Classifier: Programming Language :: JavaScript
13
16
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.6
15
- Classifier: Programming Language :: Python :: 3.7
16
17
  Classifier: Programming Language :: Python :: 3.8
17
18
  Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
18
22
  Classifier: Topic :: Scientific/Engineering
19
- Requires-Python: >=3.6
23
+ Requires-Python: >=3.8
24
+ Provides-Extra: execute
25
+ Requires-Dist: ipykernel; extra == 'execute'
26
+ Requires-Dist: jupyter-server; extra == 'execute'
20
27
  Description-Content-Type: text/markdown
21
- License-File: LICENSE
22
28
 
23
29
  # MyST Markdown Command Line Interface, `mystmd`
24
30
 
@@ -63,4 +69,4 @@ conda config --set channel_priority strict
63
69
  conda install mystmd
64
70
  myst init
65
71
  myst build my-doc.md --tex
66
- ```
72
+ ```
@@ -0,0 +1,8 @@
1
+ mystmd_py/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ mystmd_py/main.py,sha256=9gXH26VLfflzPV0t9exVsPynO-kBxUPoJGy4VEf1hNQ,1467
3
+ mystmd_py/myst.cjs,sha256=GZuEh8sqMMcZC0P6EvrOl2GhYRF_pCfIKHKXJNdmH-Y,12634110
4
+ mystmd-1.1.41.dist-info/METADATA,sha256=Qkw3tY0mmz_0GRC2MPH65T_aKs0X2rck60h1aw-xY0M,2969
5
+ mystmd-1.1.41.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
6
+ mystmd-1.1.41.dist-info/entry_points.txt,sha256=eC2ol2gqS2q5E-ktkMrBSvV0tckGUcNGS-c4hEQ-_V4,45
7
+ mystmd-1.1.41.dist-info/licenses/LICENSE,sha256=vgXlcTOVbxYpGiMuE9NqgguIBXAH0hJAktlaxiyZ2wg,1088
8
+ mystmd-1.1.41.dist-info/RECORD,,
@@ -1,5 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: hatchling 1.21.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
-
mystmd_py/main.py CHANGED
@@ -3,43 +3,38 @@ import pathlib
3
3
  import shutil
4
4
  import subprocess
5
5
  import sys
6
-
7
-
8
- NODE_LOCATION = (
9
- shutil.which("node") or shutil.which("node.exe") or shutil.which("node.cmd")
10
- )
11
- PATH_TO_BIN_JS = str((pathlib.Path(__file__).parent / "myst.cjs").resolve())
6
+ import re
12
7
 
13
8
 
14
9
  def main():
10
+ NODE_LOCATION = (
11
+ shutil.which("node") or shutil.which("node.exe") or shutil.which("node.cmd")
12
+ )
13
+ PATH_TO_BIN_JS = (pathlib.Path(__file__).parent / "myst.cjs").resolve()
14
+
15
15
  if not NODE_LOCATION:
16
- sys.exit(
16
+ raise SystemExit(
17
17
  "You must install node >=16 to run MyST\n\n"
18
18
  "We recommend installing the latest LTS release, using your preferred package manager\n"
19
19
  "or following instructions here: https://nodejs.org/en/download"
20
20
  )
21
- node = str(pathlib.Path(NODE_LOCATION).resolve())
22
- version_proc = subprocess.Popen(
23
- [node, "-v"], stdin=subprocess.PIPE, stdout=subprocess.PIPE
24
- )
25
- version_proc.wait()
26
- version = version_proc.communicate()[0].decode()
27
- try:
28
- ["16", "18", "20"].index(version[1:3])
29
- except:
30
- sys.exit(
31
- f"MyST requires node 16, 18, or 20; you are running node {version[1:3]}.\n\n"
21
+ node = pathlib.Path(NODE_LOCATION).resolve()
22
+
23
+ _version = subprocess.run([node, "-v"], capture_output=True, check=True, text=True).stdout
24
+ major_version_match = re.match(r"v(\d+).*", _version)
25
+
26
+ if major_version_match is None:
27
+ raise SystemExit(f"MyST could not determine the version of Node.js: {_version}")
28
+
29
+ major_version = int(major_version_match[1])
30
+ if not (major_version in {16, 18} or major_version >= 20):
31
+ raise SystemExit(
32
+ f"MyST requires node 16, 18, or 20+; you are running node {version[1:3]}.\n\n"
32
33
  "Please update to the latest LTS release, using your preferred package manager\n"
33
34
  "or following instructions here: https://nodejs.org/en/download"
34
35
  )
35
- myst_proc = subprocess.Popen(
36
- [node, PATH_TO_BIN_JS, *sys.argv[1:]],
37
- stdin=sys.stdin,
38
- stdout=sys.stdout,
39
- env={**os.environ, "MYST_LANG": "PYTHON"},
40
- )
41
- sys.exit(myst_proc.wait())
42
-
36
+ os.execve(node, [node.name, PATH_TO_BIN_JS, *sys.argv[1:]], {**os.environ, "MYST_LANG": "PYTHON"})
37
+
43
38
 
44
39
  if __name__ == "__main__":
45
40
  main()