comrak 0.0.1__tar.gz → 0.0.2__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.

Potentially problematic release.


This version of comrak might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: comrak
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Classifier: Intended Audience :: Developers
5
5
  Classifier: License :: OSI Approved :: MIT License
6
6
  Classifier: Programming Language :: Rust
@@ -15,7 +15,10 @@ Classifier: Programming Language :: Python :: 3.13
15
15
  Classifier: Programming Language :: Python :: 3.9
16
16
  Requires-Dist: maturin[patchelf]>=1.8.2 ; extra == 'dev'
17
17
  Requires-Dist: pre-commit>=4.1.0 ; extra == 'dev'
18
+ Requires-Dist: markdown>=3.7 ; extra == 'bench'
19
+ Requires-Dist: markdown2>=2.5.3 ; extra == 'bench'
18
20
  Provides-Extra: dev
21
+ Provides-Extra: bench
19
22
  Summary: Python bindings for the Comrak Rust library, a fast CommonMark/GFM parser
20
23
  Keywords: markdown,html,rust,commonmark,gfm,parser
21
24
  Author-email: Louis Maddox <louismmx@gmail.com>
@@ -51,6 +54,13 @@ pip install comrak
51
54
 
52
55
  Fast Markdown to HTML parser in Rust, shipped for Python via PyO3.
53
56
 
57
+ ## Benchmarks
58
+
59
+ Tested with small (8 lines) and medium (1200 lines) markdown strings
60
+
61
+ - vs. [markdown](https://pypi.org/project/markdown): 15x faster (S/M)
62
+ - vs. [markdown2](https://pypi.org/project/markdown2): 20x (S) - 60x (M) faster
63
+
54
64
  ## Contributing
55
65
 
56
66
  Maintained by [lmmx](https://github.com/lmmx). Contributions welcome!
@@ -24,6 +24,13 @@ pip install comrak
24
24
 
25
25
  Fast Markdown to HTML parser in Rust, shipped for Python via PyO3.
26
26
 
27
+ ## Benchmarks
28
+
29
+ Tested with small (8 lines) and medium (1200 lines) markdown strings
30
+
31
+ - vs. [markdown](https://pypi.org/project/markdown): 15x faster (S/M)
32
+ - vs. [markdown2](https://pypi.org/project/markdown2): 20x (S) - 60x (M) faster
33
+
27
34
  ## Contributing
28
35
 
29
36
  Maintained by [lmmx](https://github.com/lmmx). Contributions welcome!
@@ -0,0 +1,53 @@
1
+ ## Small string (8 lines)
2
+
3
+ Source: `hello_world_x1000`
4
+
5
+ ```sh
6
+ bash run_small_benchmark.sh
7
+ ```
8
+
9
+ ```
10
+ Benchmark 1: baseline
11
+ Time (mean ± σ): 42.2 ms ± 0.9 ms [User: 34.0 ms, System: 7.7 ms]
12
+ Range (min … max): 40.6 ms … 46.0 ms 68 runs
13
+
14
+ Benchmark 2: markdown
15
+ Time (mean ± σ): 854.2 ms ± 4.9 ms [User: 833.7 ms, System: 20.0 ms]
16
+ Range (min … max): 844.5 ms … 861.0 ms 10 runs
17
+
18
+ Benchmark 3: markdown2
19
+ Time (mean ± σ): 608.1 ms ± 6.0 ms [User: 586.7 ms, System: 16.0 ms]
20
+ Range (min … max): 601.5 ms … 619.7 ms 10 runs
21
+
22
+ Summary
23
+ 'baseline' ran
24
+ 14.42 ± 0.34 times faster than 'markdown2'
25
+ 20.26 ± 0.46 times faster than 'markdown'
26
+ ```
27
+
28
+ ## Medium file (1200 lines)
29
+
30
+ Source: `awesome_python_readme_x1000`
31
+
32
+ ```sh
33
+ bash run_medium_benchmark.sh
34
+ ```
35
+
36
+ ```
37
+ Benchmark 1: baseline
38
+ Time (mean ± σ): 126.1 ms ± 1.7 ms [User: 110.7 ms, System: 14.9 ms]
39
+ Range (min … max): 123.0 ms … 129.8 ms 23 runs
40
+
41
+ Benchmark 2: markdown
42
+ Time (mean ± σ): 2.070 s ± 0.010 s [User: 2.034 s, System: 0.028 s]
43
+ Range (min … max): 2.054 s … 2.084 s 10 runs
44
+
45
+ Benchmark 3: markdown2
46
+ Time (mean ± σ): 7.205 s ± 0.041 s [User: 7.160 s, System: 0.024 s]
47
+ Range (min … max): 7.149 s … 7.299 s 10 runs
48
+
49
+ Summary
50
+ 'baseline' ran
51
+ 16.42 ± 0.24 times faster than 'markdown'
52
+ 57.14 ± 0.84 times faster than 'markdown2
53
+ ```
@@ -0,0 +1,15 @@
1
+ from pathlib import Path
2
+
3
+ import comrak
4
+
5
+ MARKDOWN_TEXT = (Path(__file__).parent / "README.md").read_text()
6
+
7
+
8
+ def main():
9
+ N = 10
10
+ for _ in range(N):
11
+ _ = comrak.render_markdown(MARKDOWN_TEXT)
12
+
13
+
14
+ if __name__ == "__main__":
15
+ main()
@@ -0,0 +1,15 @@
1
+ from pathlib import Path
2
+
3
+ import markdown2
4
+
5
+ MARKDOWN_TEXT = (Path(__file__).parent / "README.md").read_text()
6
+
7
+
8
+ def main():
9
+ N = 10
10
+ for _ in range(N):
11
+ _ = markdown2.markdown(MARKDOWN_TEXT)
12
+
13
+
14
+ if __name__ == "__main__":
15
+ main()
@@ -0,0 +1,15 @@
1
+ from pathlib import Path
2
+
3
+ import markdown
4
+
5
+ MARKDOWN_TEXT = (Path(__file__).parent / "README.md").read_text()
6
+
7
+
8
+ def main():
9
+ N = 10
10
+ for _ in range(N):
11
+ _ = markdown.markdown(MARKDOWN_TEXT)
12
+
13
+
14
+ if __name__ == "__main__":
15
+ main()
@@ -0,0 +1,22 @@
1
+ import comrak
2
+
3
+ MARKDOWN_TEXT = """
4
+ # Example
5
+
6
+ This is **bold** text with [a link](https://example.com).
7
+ And some list:
8
+ - item1
9
+ - item2
10
+
11
+ The end.
12
+ """
13
+
14
+
15
+ def main():
16
+ N = 1000
17
+ for _ in range(N):
18
+ _ = comrak.render_markdown(MARKDOWN_TEXT)
19
+
20
+
21
+ if __name__ == "__main__":
22
+ main()
@@ -0,0 +1,22 @@
1
+ import markdown2
2
+
3
+ MARKDOWN_TEXT = """
4
+ # Example
5
+
6
+ This is **bold** text with [a link](https://example.com).
7
+ And some list:
8
+ - item1
9
+ - item2
10
+
11
+ The end.
12
+ """
13
+
14
+
15
+ def main():
16
+ N = 1000
17
+ for _ in range(N):
18
+ _ = markdown2.markdown(MARKDOWN_TEXT)
19
+
20
+
21
+ if __name__ == "__main__":
22
+ main()
@@ -0,0 +1,22 @@
1
+ import markdown
2
+
3
+ MARKDOWN_TEXT = """
4
+ # Example
5
+
6
+ This is **bold** text with [a link](https://example.com).
7
+ And some list:
8
+ - item1
9
+ - item2
10
+
11
+ The end.
12
+ """
13
+
14
+
15
+ def main():
16
+ N = 1000
17
+ for _ in range(N):
18
+ _ = markdown.markdown(MARKDOWN_TEXT)
19
+
20
+
21
+ if __name__ == "__main__":
22
+ main()
@@ -0,0 +1,10 @@
1
+ (
2
+ cd awesome_python_readme_x1000 && \
3
+ curl -sOL https://raw.githubusercontent.com/vinta/awesome-python/master/README.md && \
4
+ hyperfine \
5
+ 'python comrak_bench.py' -n baseline \
6
+ 'python markdown_bench.py' -n markdown \
7
+ 'python markdown2_bench.py' -n markdown2 \
8
+ --warmup 5
9
+ rm README.md
10
+ )
@@ -0,0 +1,8 @@
1
+ (
2
+ cd hello_world_x1000 && \
3
+ hyperfine \
4
+ 'python comrak_bench.py' -n baseline \
5
+ 'python markdown_bench.py' -n markdown \
6
+ 'python markdown2_bench.py' -n markdown2 \
7
+ --warmup 5
8
+ )
@@ -0,0 +1,62 @@
1
+ [build-system]
2
+ requires = [
3
+ "maturin>=1.8,<2.0",
4
+ ]
5
+ build-backend = "maturin"
6
+
7
+ [project]
8
+ name = "comrak"
9
+ description = "Python bindings for the Comrak Rust library, a fast CommonMark/GFM parser"
10
+ classifiers = [
11
+ "Intended Audience :: Developers",
12
+ "License :: OSI Approved :: MIT License",
13
+ "Programming Language :: Rust",
14
+ "Programming Language :: Python :: Implementation :: CPython",
15
+ "Programming Language :: Python :: Implementation :: PyPy",
16
+ "Operating System :: OS Independent",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Programming Language :: Python :: 3.9",
23
+ ]
24
+ dynamic = [
25
+ "version",
26
+ ]
27
+ authors = [
28
+ { email = "louismmx@gmail.com", name = "Louis Maddox" },
29
+ ]
30
+ keywords = [
31
+ "markdown",
32
+ "html",
33
+ "rust",
34
+ "commonmark",
35
+ "gfm",
36
+ "parser",
37
+ ]
38
+ readme = "README.md"
39
+ requires-python = ">=3.9"
40
+ version = "0.0.2"
41
+
42
+ [project.license]
43
+ text = "MIT"
44
+
45
+ [project.optional-dependencies]
46
+ dev = [
47
+ "maturin[patchelf]>=1.8.2",
48
+ "pre-commit>=4.1.0",
49
+ ]
50
+ bench = [
51
+ "markdown>=3.7",
52
+ "markdown2>=2.5.3",
53
+ ]
54
+
55
+ [project.urls]
56
+ Homepage = "https://github.com/lmmx/comrak"
57
+ Repository = "https://github.com/lmmx/comrak.git"
58
+
59
+ [tool.maturin]
60
+ features = [
61
+ "pyo3/extension-module",
62
+ ]
@@ -15,6 +15,10 @@ name = "comrak"
15
15
  source = { editable = "." }
16
16
 
17
17
  [package.optional-dependencies]
18
+ bench = [
19
+ { name = "markdown" },
20
+ { name = "markdown2" },
21
+ ]
18
22
  dev = [
19
23
  { name = "maturin", extra = ["patchelf"] },
20
24
  { name = "pre-commit" },
@@ -22,6 +26,8 @@ dev = [
22
26
 
23
27
  [package.metadata]
24
28
  requires-dist = [
29
+ { name = "markdown", marker = "extra == 'bench'", specifier = ">=3.7" },
30
+ { name = "markdown2", marker = "extra == 'bench'", specifier = ">=2.5.3" },
25
31
  { name = "maturin", extras = ["patchelf"], marker = "extra == 'dev'", specifier = ">=1.8.2" },
26
32
  { name = "pre-commit", marker = "extra == 'dev'", specifier = ">=4.1.0" },
27
33
  ]
@@ -53,6 +59,39 @@ wheels = [
53
59
  { url = "https://files.pythonhosted.org/packages/03/00/1fd4a117c6c93f2dcc5b7edaeaf53ea45332ef966429be566ca16c2beb94/identify-2.6.7-py2.py3-none-any.whl", hash = "sha256:155931cb617a401807b09ecec6635d6c692d180090a1cedca8ef7d58ba5b6aa0", size = 99097 },
54
60
  ]
55
61
 
62
+ [[package]]
63
+ name = "importlib-metadata"
64
+ version = "8.6.1"
65
+ source = { registry = "https://pypi.org/simple" }
66
+ dependencies = [
67
+ { name = "zipp" },
68
+ ]
69
+ sdist = { url = "https://files.pythonhosted.org/packages/33/08/c1395a292bb23fd03bdf572a1357c5a733d3eecbab877641ceacab23db6e/importlib_metadata-8.6.1.tar.gz", hash = "sha256:310b41d755445d74569f993ccfc22838295d9fe005425094fad953d7f15c8580", size = 55767 }
70
+ wheels = [
71
+ { url = "https://files.pythonhosted.org/packages/79/9d/0fb148dc4d6fa4a7dd1d8378168d9b4cd8d4560a6fbf6f0121c5fc34eb68/importlib_metadata-8.6.1-py3-none-any.whl", hash = "sha256:02a89390c1e15fdfdc0d7c6b25cb3e62650d0494005c97d6f148bf5b9787525e", size = 26971 },
72
+ ]
73
+
74
+ [[package]]
75
+ name = "markdown"
76
+ version = "3.7"
77
+ source = { registry = "https://pypi.org/simple" }
78
+ dependencies = [
79
+ { name = "importlib-metadata", marker = "python_full_version < '3.10'" },
80
+ ]
81
+ sdist = { url = "https://files.pythonhosted.org/packages/54/28/3af612670f82f4c056911fbbbb42760255801b3068c48de792d354ff4472/markdown-3.7.tar.gz", hash = "sha256:2ae2471477cfd02dbbf038d5d9bc226d40def84b4fe2986e49b59b6b472bbed2", size = 357086 }
82
+ wheels = [
83
+ { url = "https://files.pythonhosted.org/packages/3f/08/83871f3c50fc983b88547c196d11cf8c3340e37c32d2e9d6152abe2c61f7/Markdown-3.7-py3-none-any.whl", hash = "sha256:7eb6df5690b81a1d7942992c97fad2938e956e79df20cbc6186e9c3a77b1c803", size = 106349 },
84
+ ]
85
+
86
+ [[package]]
87
+ name = "markdown2"
88
+ version = "2.5.3"
89
+ source = { registry = "https://pypi.org/simple" }
90
+ sdist = { url = "https://files.pythonhosted.org/packages/44/52/d7dcc6284d59edb8301b8400435fbb4926a9b0f13a12b5cbaf3a4a54bb7b/markdown2-2.5.3.tar.gz", hash = "sha256:4d502953a4633408b0ab3ec503c5d6984d1b14307e32b325ec7d16ea57524895", size = 141676 }
91
+ wheels = [
92
+ { url = "https://files.pythonhosted.org/packages/84/37/0a13c83ccf5365b8e08ea572dfbc04b8cb87cadd359b2451a567f5248878/markdown2-2.5.3-py3-none-any.whl", hash = "sha256:a8ebb7e84b8519c37bf7382b3db600f1798a22c245bfd754a1f87ca8d7ea63b3", size = 48550 },
93
+ ]
94
+
56
95
  [[package]]
57
96
  name = "maturin"
58
97
  version = "1.8.2"
@@ -234,3 +273,12 @@ sdist = { url = "https://files.pythonhosted.org/packages/f1/88/dacc875dd54a8acad
234
273
  wheels = [
235
274
  { url = "https://files.pythonhosted.org/packages/93/fa/849483d56773ae29740ae70043ad88e068f98a6401aa819b5d6bee604683/virtualenv-20.29.2-py3-none-any.whl", hash = "sha256:febddfc3d1ea571bdb1dc0f98d7b45d24def7428214d4fb73cc486c9568cce6a", size = 4301478 },
236
275
  ]
276
+
277
+ [[package]]
278
+ name = "zipp"
279
+ version = "3.21.0"
280
+ source = { registry = "https://pypi.org/simple" }
281
+ sdist = { url = "https://files.pythonhosted.org/packages/3f/50/bad581df71744867e9468ebd0bcd6505de3b275e06f202c2cb016e3ff56f/zipp-3.21.0.tar.gz", hash = "sha256:2c9958f6430a2040341a52eb608ed6dd93ef4392e02ffe219417c1b28b5dd1f4", size = 24545 }
282
+ wheels = [
283
+ { url = "https://files.pythonhosted.org/packages/b7/1a/7e4798e9339adc931158c9d69ecc34f5e6791489d469f5e50ec15e35f458/zipp-3.21.0-py3-none-any.whl", hash = "sha256:ac1bbe05fd2991f160ebce24ffbac5f6d11d83dc90891255885223d42b3cd931", size = 9630 },
284
+ ]
@@ -1,51 +0,0 @@
1
- [build-system]
2
- requires = ["maturin>=1.8,<2.0"]
3
- build-backend = "maturin"
4
-
5
- [project]
6
- name = "comrak"
7
- description = "Python bindings for the Comrak Rust library, a fast CommonMark/GFM parser"
8
- classifiers = [
9
- "Intended Audience :: Developers",
10
- "License :: OSI Approved :: MIT License",
11
- "Programming Language :: Rust",
12
- "Programming Language :: Python :: Implementation :: CPython",
13
- "Programming Language :: Python :: Implementation :: PyPy",
14
- "Operating System :: OS Independent",
15
- "Programming Language :: Python :: 3",
16
- "Programming Language :: Python :: 3.10",
17
- "Programming Language :: Python :: 3.11",
18
- "Programming Language :: Python :: 3.12",
19
- "Programming Language :: Python :: 3.13",
20
- "Programming Language :: Python :: 3.9"
21
- ]
22
- dynamic = ["version"]
23
- authors = [
24
- {email = "louismmx@gmail.com", name = "Louis Maddox"}
25
- ]
26
- keywords = [
27
- "markdown",
28
- "html",
29
- "rust",
30
- "commonmark",
31
- "gfm",
32
- "parser"
33
- ]
34
- license = {text = "MIT"}
35
- readme = "README.md"
36
- requires-python = ">=3.9"
37
- version = "0.0.1"
38
-
39
- [project.optional-dependencies]
40
- dev = [
41
- "maturin[patchelf]>=1.8.2",
42
- "pre-commit>=4.1.0"
43
- ]
44
-
45
- [project.urls]
46
- # Documentation = "https://comrak.vercel.app/"
47
- Homepage = "https://github.com/lmmx/comrak"
48
- Repository = "https://github.com/lmmx/comrak.git"
49
-
50
- [tool.maturin]
51
- features = ["pyo3/extension-module"]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes