edwh-editorjs 2.3.2__tar.gz → 2.5.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.
- {edwh_editorjs-2.3.2 → edwh_editorjs-2.5.0}/.gitignore +1 -0
- {edwh_editorjs-2.3.2 → edwh_editorjs-2.5.0}/CHANGELOG.md +16 -0
- {edwh_editorjs-2.3.2 → edwh_editorjs-2.5.0}/PKG-INFO +2 -1
- edwh_editorjs-2.5.0/editorjs/__about__.py +1 -0
- {edwh_editorjs-2.3.2 → edwh_editorjs-2.5.0}/editorjs/blocks.py +56 -14
- {edwh_editorjs-2.3.2 → edwh_editorjs-2.5.0}/editorjs/core.py +38 -11
- {edwh_editorjs-2.3.2 → edwh_editorjs-2.5.0}/pyproject.toml +3 -2
- {edwh_editorjs-2.3.2 → edwh_editorjs-2.5.0}/tests/test_core.py +49 -2
- edwh_editorjs-2.3.2/.github/workflows/build_documentation.yml +0 -36
- edwh_editorjs-2.3.2/.github/workflows/publish_to_pypi.yml +0 -40
- edwh_editorjs-2.3.2/.github/workflows/pytest.yml +0 -30
- edwh_editorjs-2.3.2/editorjs/__about__.py +0 -1
- edwh_editorjs-2.3.2/htmlcov/.gitignore +0 -2
- edwh_editorjs-2.3.2/htmlcov/class_index.html +0 -259
- edwh_editorjs-2.3.2/htmlcov/favicon_32_cb_58284776.png +0 -0
- edwh_editorjs-2.3.2/htmlcov/function_index.html +0 -395
- edwh_editorjs-2.3.2/htmlcov/index.html +0 -132
- edwh_editorjs-2.3.2/htmlcov/keybd_closed_cb_ce680311.png +0 -0
- edwh_editorjs-2.3.2/htmlcov/status.json +0 -1
- edwh_editorjs-2.3.2/htmlcov/style_cb_8e611ae1.css +0 -337
- edwh_editorjs-2.3.2/htmlcov/z_a93c8aeb4b8fa1f9___init___py.html +0 -125
- edwh_editorjs-2.3.2/htmlcov/z_a93c8aeb4b8fa1f9_blocks_py.html +0 -406
- edwh_editorjs-2.3.2/htmlcov/z_a93c8aeb4b8fa1f9_exceptions_py.html +0 -116
- edwh_editorjs-2.3.2/htmlcov/z_a93c8aeb4b8fa1f9_parser_py.html +0 -172
- {edwh_editorjs-2.3.2 → edwh_editorjs-2.5.0}/README.md +0 -0
- {edwh_editorjs-2.3.2 → edwh_editorjs-2.5.0}/editorjs/__init__.py +0 -0
- {edwh_editorjs-2.3.2 → edwh_editorjs-2.5.0}/editorjs/exceptions.py +0 -0
- {edwh_editorjs-2.3.2 → edwh_editorjs-2.5.0}/editorjs/helpers.py +0 -0
- {edwh_editorjs-2.3.2 → edwh_editorjs-2.5.0}/editorjs/types.py +0 -0
- {edwh_editorjs-2.3.2 → edwh_editorjs-2.5.0}/tests/__init__.py +0 -0
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
<!--next-version-placeholder-->
|
|
4
4
|
|
|
5
|
+
## v2.5.0 (2025-03-20)
|
|
6
|
+
|
|
7
|
+
### Feature
|
|
8
|
+
|
|
9
|
+
* Improve markdown conversion and image handling in EditorJS blocks ([`80d0fc0`](https://github.com/educationwarehouse/edwh-editorjs/commit/80d0fc00a4e39b279de35998d1a85a37282c58a7))
|
|
10
|
+
|
|
11
|
+
## v2.4.0 (2024-12-02)
|
|
12
|
+
|
|
13
|
+
### Feature
|
|
14
|
+
|
|
15
|
+
* **image:** Support more options for the image block ([`c74dcce`](https://github.com/educationwarehouse/edwh-editorjs/commit/c74dccef5c1115038f6de0f08250dfa6cff18796))
|
|
16
|
+
|
|
17
|
+
### Fix
|
|
18
|
+
|
|
19
|
+
* Less exceptions, more warnings for better ease-of-use ([`891fca1`](https://github.com/educationwarehouse/edwh-editorjs/commit/891fca198e774c53a8b6365b927a080f61c0b2c8))
|
|
20
|
+
|
|
5
21
|
## v2.3.2 (2024-11-27)
|
|
6
22
|
|
|
7
23
|
### Fix
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: edwh-editorjs
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.0
|
|
4
4
|
Summary: EditorJS.py
|
|
5
5
|
Project-URL: Homepage, https://github.com/educationwarehouse/edwh-EditorJS
|
|
6
6
|
Author-email: SKevo <skevo.cw@gmail.com>, Robin van der Noord <robin.vdn@educationwarehouse.nl>
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
15
|
Requires-Python: >=3.10
|
|
16
|
+
Requires-Dist: html2markdown
|
|
16
17
|
Requires-Dist: humanize
|
|
17
18
|
Requires-Dist: markdown2
|
|
18
19
|
Requires-Dist: mdast
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.5.0"
|
|
@@ -8,6 +8,7 @@ import typing as t
|
|
|
8
8
|
from html.parser import HTMLParser
|
|
9
9
|
from urllib.parse import urlparse
|
|
10
10
|
|
|
11
|
+
import html2markdown
|
|
11
12
|
import humanize
|
|
12
13
|
import markdown2
|
|
13
14
|
|
|
@@ -53,6 +54,7 @@ def process_styled_content(item: MDChildNode, strict: bool = True) -> str:
|
|
|
53
54
|
A formatted HTML string based on the item type.
|
|
54
55
|
"""
|
|
55
56
|
_type = item.get("type")
|
|
57
|
+
|
|
56
58
|
html_wrappers = {
|
|
57
59
|
"text": "{value}",
|
|
58
60
|
"html": "{value}",
|
|
@@ -82,9 +84,16 @@ def process_styled_content(item: MDChildNode, strict: bool = True) -> str:
|
|
|
82
84
|
|
|
83
85
|
|
|
84
86
|
def default_to_text(node: MDChildNode):
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
if node["type"] == "paragraph":
|
|
88
|
+
return "".join(
|
|
89
|
+
process_styled_content(child) for child in node.get("children", [])
|
|
90
|
+
)
|
|
91
|
+
else:
|
|
92
|
+
return process_styled_content(node)
|
|
93
|
+
|
|
94
|
+
# return "".join(
|
|
95
|
+
# process_styled_content(child) for child in node.get("children", [])
|
|
96
|
+
# ) or process_styled_content(node)
|
|
88
97
|
|
|
89
98
|
|
|
90
99
|
@block("heading", "header")
|
|
@@ -173,6 +182,9 @@ class ParagraphBlock(EditorJSBlock):
|
|
|
173
182
|
}
|
|
174
183
|
)
|
|
175
184
|
|
|
185
|
+
# deal with bold etc:
|
|
186
|
+
text = html2markdown.convert(text)
|
|
187
|
+
|
|
176
188
|
return f"{text}\n\n"
|
|
177
189
|
|
|
178
190
|
@classmethod
|
|
@@ -384,7 +396,7 @@ class CodeBlock(EditorJSBlock):
|
|
|
384
396
|
@classmethod
|
|
385
397
|
def to_markdown(cls, data: EditorChildData) -> str:
|
|
386
398
|
code = data.get("code", "")
|
|
387
|
-
return f"```\n
|
|
399
|
+
return f"```\n{code}\n```\n"
|
|
388
400
|
|
|
389
401
|
@classmethod
|
|
390
402
|
def to_json(cls, node: MDChildNode) -> list[dict]:
|
|
@@ -406,7 +418,17 @@ class ImageBlock(EditorJSBlock):
|
|
|
406
418
|
def to_markdown(cls, data: EditorChildData) -> str:
|
|
407
419
|
url = data.get("url", "") or data.get("file", {}).get("url", "")
|
|
408
420
|
caption = data.get("caption", "")
|
|
409
|
-
|
|
421
|
+
|
|
422
|
+
with_border = "1" if data.get("withBorder") else ""
|
|
423
|
+
with_background = "1" if data.get("withBackground") else ""
|
|
424
|
+
stretched = "1" if data.get("stretched") else ""
|
|
425
|
+
|
|
426
|
+
# always custom type so we can render as <figure> instead of markdown2's default (simple <img>)
|
|
427
|
+
return f"""<editorjs type="image" caption="{caption}" border="{with_border}" background="{with_background}" stretched="{stretched}" url="{url}" />\n\n"""
|
|
428
|
+
|
|
429
|
+
@classmethod
|
|
430
|
+
def _caption(cls, node: MDChildNode):
|
|
431
|
+
return node.get("alt") or node.get("caption") or ""
|
|
410
432
|
|
|
411
433
|
@classmethod
|
|
412
434
|
def to_json(cls, node: MDChildNode) -> list[dict]:
|
|
@@ -414,15 +436,37 @@ class ImageBlock(EditorJSBlock):
|
|
|
414
436
|
{
|
|
415
437
|
"type": "image",
|
|
416
438
|
"data": {
|
|
417
|
-
"caption": cls.to_text(node),
|
|
418
439
|
"file": {"url": node.get("url")},
|
|
440
|
+
"caption": cls._caption(node),
|
|
441
|
+
"withBorder": bool(node.get("border", False)),
|
|
442
|
+
"stretched": bool(node.get("stretched", False)),
|
|
443
|
+
"withBackground": bool(node.get("background", False)),
|
|
419
444
|
},
|
|
420
445
|
}
|
|
421
446
|
]
|
|
422
447
|
|
|
423
448
|
@classmethod
|
|
424
449
|
def to_text(cls, node: MDChildNode) -> str:
|
|
425
|
-
|
|
450
|
+
caption = cls._caption(node)
|
|
451
|
+
url = node.get("url")
|
|
452
|
+
|
|
453
|
+
background = node.get("background") or ""
|
|
454
|
+
stretched = node.get("stretched") or ""
|
|
455
|
+
border = node.get("border") or ""
|
|
456
|
+
|
|
457
|
+
return f"""
|
|
458
|
+
<div class="ce-block {stretched and "ce-block--stretched"}">
|
|
459
|
+
<div class="ce-block__content">
|
|
460
|
+
<div class="cdx-block image-tool image-tool--filled {background and "image-tool--withBackground"} {stretched and "image-tool--stretched"} {border and "image-tool--withBorder"}">
|
|
461
|
+
<div class="image-tool__image">
|
|
462
|
+
<figure>
|
|
463
|
+
<img class="image-tool__image-picture" src="{url}" title="{caption}" alt="{caption}">
|
|
464
|
+
<figcaption>{caption}</figcaption>
|
|
465
|
+
</figure>
|
|
466
|
+
</div>
|
|
467
|
+
</div>
|
|
468
|
+
</div>
|
|
469
|
+
"""
|
|
426
470
|
|
|
427
471
|
|
|
428
472
|
@block("blockquote", "quote")
|
|
@@ -435,7 +479,7 @@ class QuoteBlock(EditorJSBlock):
|
|
|
435
479
|
result = f"> {text}\n"
|
|
436
480
|
if caption := data.get("caption", ""):
|
|
437
481
|
result += f"> <cite>{caption}</cite>\n"
|
|
438
|
-
return result
|
|
482
|
+
return result + "\n"
|
|
439
483
|
|
|
440
484
|
@classmethod
|
|
441
485
|
def to_json(cls, node: MDChildNode) -> list[dict]:
|
|
@@ -461,12 +505,13 @@ class QuoteBlock(EditorJSBlock):
|
|
|
461
505
|
|
|
462
506
|
@classmethod
|
|
463
507
|
def to_text(cls, node: MDChildNode) -> str:
|
|
464
|
-
return
|
|
508
|
+
return "".join(
|
|
509
|
+
process_styled_content(child) for child in node.get("children", [])
|
|
510
|
+
)
|
|
465
511
|
|
|
466
512
|
|
|
467
513
|
@block("raw", "html")
|
|
468
514
|
class RawBlock(EditorJSBlock):
|
|
469
|
-
|
|
470
515
|
@classmethod
|
|
471
516
|
def to_markdown(cls, data: EditorChildData) -> str:
|
|
472
517
|
text = data.get("html", "")
|
|
@@ -489,7 +534,6 @@ class RawBlock(EditorJSBlock):
|
|
|
489
534
|
|
|
490
535
|
@block("table")
|
|
491
536
|
class TableBlock(EditorJSBlock):
|
|
492
|
-
|
|
493
537
|
@classmethod
|
|
494
538
|
def to_markdown(cls, data: EditorChildData) -> str:
|
|
495
539
|
"""
|
|
@@ -608,7 +652,6 @@ class LinkBlock(EditorJSBlock):
|
|
|
608
652
|
|
|
609
653
|
@block("attaches")
|
|
610
654
|
class AttachmentBlock(EditorJSBlock):
|
|
611
|
-
|
|
612
655
|
@classmethod
|
|
613
656
|
def to_markdown(cls, data: EditorChildData) -> str:
|
|
614
657
|
title = data.get("title", "")
|
|
@@ -673,7 +716,7 @@ class AttachmentBlock(EditorJSBlock):
|
|
|
673
716
|
</div>
|
|
674
717
|
{file_size}
|
|
675
718
|
</div>
|
|
676
|
-
<a class="cdx-attaches__download-button" href="{node.get(
|
|
719
|
+
<a class="cdx-attaches__download-button" href="{node.get("file", "")}" target="_blank" rel="nofollow noindex noreferrer" title="{node.get("name", "")}">
|
|
677
720
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 10L11.8586 14.8586C11.9367 14.9367 12.0633 14.9367 12.1414 14.8586L17 10"></path></svg>
|
|
678
721
|
</a>
|
|
679
722
|
</div>
|
|
@@ -725,7 +768,6 @@ class AlignmentBlock(EditorJSBlock):
|
|
|
725
768
|
|
|
726
769
|
@block("embed")
|
|
727
770
|
class EmbedBlock(EditorJSBlock):
|
|
728
|
-
|
|
729
771
|
@classmethod
|
|
730
772
|
def to_markdown(cls, data: EditorChildData) -> str:
|
|
731
773
|
service = data.get("service", "")
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import typing as t
|
|
3
|
+
import warnings
|
|
3
4
|
|
|
4
5
|
import markdown2
|
|
5
6
|
import mdast
|
|
6
7
|
from typing_extensions import Self
|
|
7
8
|
|
|
8
9
|
from .blocks import BLOCKS
|
|
10
|
+
from .exceptions import TODO
|
|
9
11
|
from .helpers import unix_timestamp
|
|
10
12
|
from .types import MDRootNode
|
|
11
13
|
|
|
@@ -41,13 +43,26 @@ class EditorJS:
|
|
|
41
43
|
for child in blocks:
|
|
42
44
|
_type = child["type"]
|
|
43
45
|
if not (block := BLOCKS.get(_type)):
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
warnings.warn(
|
|
47
|
+
f"from_json: Unsupported block type `{_type}`",
|
|
48
|
+
category=RuntimeWarning,
|
|
49
|
+
)
|
|
50
|
+
continue
|
|
51
|
+
|
|
52
|
+
try:
|
|
53
|
+
data = child.get("data", {})
|
|
54
|
+
# forward any 'tunes' via data:
|
|
55
|
+
data["tunes"] = data.get("tunes") or child.get("tunes") or {}
|
|
56
|
+
|
|
57
|
+
markdown_items.append(block.to_markdown(data))
|
|
58
|
+
except Exception as e:
|
|
59
|
+
warnings.warn(
|
|
60
|
+
"from_json: Oh oh, unexpected block failure!",
|
|
61
|
+
category=RuntimeWarning,
|
|
62
|
+
source=e,
|
|
63
|
+
)
|
|
64
|
+
# if isinstance(e, TODO):
|
|
65
|
+
# raise e
|
|
51
66
|
|
|
52
67
|
markdown = "".join(markdown_items)
|
|
53
68
|
return cls.from_markdown(markdown)
|
|
@@ -76,9 +91,22 @@ class EditorJS:
|
|
|
76
91
|
for child in self._mdast["children"]:
|
|
77
92
|
_type = child["type"]
|
|
78
93
|
if not (block := BLOCKS.get(_type)):
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
94
|
+
warnings.warn(
|
|
95
|
+
f"to_json: Unsupported block type `{_type}`",
|
|
96
|
+
category=RuntimeWarning,
|
|
97
|
+
)
|
|
98
|
+
continue
|
|
99
|
+
|
|
100
|
+
try:
|
|
101
|
+
blocks.extend(block.to_json(child))
|
|
102
|
+
except Exception as e:
|
|
103
|
+
warnings.warn(
|
|
104
|
+
"to_json: Oh oh, unexpected block failure!",
|
|
105
|
+
category=RuntimeWarning,
|
|
106
|
+
source=e,
|
|
107
|
+
)
|
|
108
|
+
# if isinstance(e, TODO):
|
|
109
|
+
# raise e
|
|
82
110
|
|
|
83
111
|
data = {"time": unix_timestamp(), "blocks": blocks, "version": EDITORJS_VERSION}
|
|
84
112
|
|
|
@@ -107,7 +135,6 @@ class EditorJS:
|
|
|
107
135
|
Export HTML string
|
|
108
136
|
"""
|
|
109
137
|
md = self.to_markdown()
|
|
110
|
-
# todo: deal with custom elements like linktool, attaches
|
|
111
138
|
return self._md.convert(md)
|
|
112
139
|
|
|
113
140
|
def __repr__(self):
|
|
@@ -185,7 +185,8 @@ asdfsdajgdsjaklgkjds
|
|
|
185
185
|
|
|
186
186
|
|
|
187
187
|
def test_code():
|
|
188
|
-
e = EditorJS.from_markdown(
|
|
188
|
+
e = EditorJS.from_markdown(
|
|
189
|
+
textwrap.dedent("""
|
|
189
190
|
Read code:
|
|
190
191
|
|
|
191
192
|
```
|
|
@@ -193,7 +194,8 @@ def test_code():
|
|
|
193
194
|
```
|
|
194
195
|
|
|
195
196
|
End of code
|
|
196
|
-
""")
|
|
197
|
+
""")
|
|
198
|
+
)
|
|
197
199
|
|
|
198
200
|
blocks = json.loads(e.to_json())
|
|
199
201
|
|
|
@@ -246,3 +248,48 @@ def test_embed():
|
|
|
246
248
|
print(e.to_markdown())
|
|
247
249
|
print(e.to_html())
|
|
248
250
|
print(e.to_json())
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def test_image_options():
|
|
254
|
+
json_blocks = r"""{"time":1733155142016,"blocks":[{"id":"e7_WBThzLQ","type":"image","data":{"caption":"border","withBorder":true,"withBackground":false,"stretched":false,"file":{"url":"https://py4web.leiden.dockers.local/img/upload/5.jpg?hash=b39755c8a568cbf45d329e3a3128fb43065b1d1b","name":"kat.jpg","title":"kat","extension":"jpg","size":3682051}}},{"id":"B5qVcjqBuB","type":"image","data":{"caption":"stretch","withBorder":false,"withBackground":false,"stretched":true,"file":{"url":"https://py4web.leiden.dockers.local/img/upload/6.jpg?hash=b39755c8a568cbf45d329e3a3128fb43065b1d1b","name":"kat.jpg","title":"kat","extension":"jpg","size":3682051}}},{"id":"ft32yP2_cv","type":"image","data":{"caption":"background","withBorder":false,"withBackground":true,"stretched":false,"file":{"url":"https://py4web.leiden.dockers.local/img/upload/7.jpg?hash=b39755c8a568cbf45d329e3a3128fb43065b1d1b","name":"kat.jpg","title":"kat","extension":"jpg","size":3682051}}}],"version":"2.30.7"}"""
|
|
255
|
+
|
|
256
|
+
e = EditorJS.from_json(json_blocks)
|
|
257
|
+
|
|
258
|
+
print(e.to_markdown())
|
|
259
|
+
print(e.to_html())
|
|
260
|
+
print(e.to_json())
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def test_figcaption():
|
|
264
|
+
js = """{"time":1742471258492,"blocks":[{"id":"ZoA3rbc05C","type":"image","data":{"caption":"Party Time!","withBorder":false,"withBackground":false,"stretched":false,"file":{"url":"https://py4web.leiden.dockers.local/img/upload/23.png?hash=979795a433fc15cb94eccb3159f1f1e4054b1664"}}}],"version":"2.30.7"}"""
|
|
265
|
+
e = EditorJS.from_json(js)
|
|
266
|
+
|
|
267
|
+
html = e.to_html()
|
|
268
|
+
|
|
269
|
+
assert "figcaption" in html
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def test_bold():
|
|
273
|
+
js = """{"time":1742475802066,"blocks":[{"id":"v_Kc51dnJH","type":"paragraph","data":{"text":"Deze tekst is <b>half bold</b> en half niet"},"tunes":{"alignmentTune":{"alignment":"left"}}},{"id":"q_fkuEFcY5","type":"paragraph","data":{"text":"<b>Deze tekst is heel bold</b>"},"tunes":{"alignmentTune":{"alignment":"left"}}}],"version":"2.30.7"}"""
|
|
274
|
+
|
|
275
|
+
e = EditorJS.from_json(js)
|
|
276
|
+
|
|
277
|
+
print(
|
|
278
|
+
e._mdast,
|
|
279
|
+
e.to_json(),
|
|
280
|
+
e.to_html(),
|
|
281
|
+
e.to_markdown(),
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def test_quotes():
|
|
286
|
+
js = """{"time":1742477286420,"blocks":[{"id":"PpmEaxeSkq","type":"quote","data":{"text":"To baldly go where no bald man has ever gone before","caption":"a bald guy","alignment":"left"}},{"id":"26ERFQ6U3V","type":"quote","data":{"text":"Einstein was een sukkel","caption":"Einstein's ex vrouw","alignment":"left"}},{"id":"RB8AdaCd86","type":"quote","data":{"text":"Asdf","caption":"fsda-man","alignment":"left"}},{"id":"BCSus2rhUr","type":"paragraph","data":{"text":"groetjes"},"tunes":{"alignmentTune":{"alignment":"left"}}}],"version":"2.30.7"}"""
|
|
287
|
+
|
|
288
|
+
e = EditorJS.from_json(js)
|
|
289
|
+
|
|
290
|
+
print(
|
|
291
|
+
e._mdast,
|
|
292
|
+
e.to_json(),
|
|
293
|
+
e.to_html(),
|
|
294
|
+
e.to_markdown(),
|
|
295
|
+
)
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
name: Build documentation
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
release:
|
|
6
|
-
types: [published]
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
strategy:
|
|
12
|
-
matrix:
|
|
13
|
-
python-version: ['3.10']
|
|
14
|
-
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v2
|
|
17
|
-
|
|
18
|
-
- name: Set up Python ${{ matrix.python-version }}
|
|
19
|
-
uses: actions/setup-python@v2
|
|
20
|
-
with:
|
|
21
|
-
python-version: ${{ matrix.python-version }}
|
|
22
|
-
|
|
23
|
-
- name: Install dependencies
|
|
24
|
-
run: |
|
|
25
|
-
python -m pip install --upgrade pip
|
|
26
|
-
pip install pdoc
|
|
27
|
-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
28
|
-
- name: Build docs
|
|
29
|
-
run: |
|
|
30
|
-
chmod +x ./scripts/build_documentation.sh
|
|
31
|
-
bash ./scripts/build_documentation.sh
|
|
32
|
-
- name: Deploy
|
|
33
|
-
uses: JamesIves/github-pages-deploy-action@4.1.4
|
|
34
|
-
with:
|
|
35
|
-
branch: documentation
|
|
36
|
-
folder: ./documentation
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
name: Upload Python Package to PyPI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types: [published]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
deploy:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
strategy:
|
|
11
|
-
matrix:
|
|
12
|
-
python-version: ['3.10']
|
|
13
|
-
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v2
|
|
16
|
-
|
|
17
|
-
- name: Set up Python ${{ matrix.python-version }}
|
|
18
|
-
uses: actions/setup-python@v2
|
|
19
|
-
with:
|
|
20
|
-
python-version: ${{ matrix.python-version }}
|
|
21
|
-
|
|
22
|
-
- name: Install dependencies
|
|
23
|
-
run: |
|
|
24
|
-
python -m pip install --upgrade pip
|
|
25
|
-
python -m pip install pytest
|
|
26
|
-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
27
|
-
|
|
28
|
-
- name: Test with pyTest
|
|
29
|
-
run: |
|
|
30
|
-
python -m pytest -v
|
|
31
|
-
|
|
32
|
-
- name: Build package
|
|
33
|
-
run: |
|
|
34
|
-
bash ./scripts/compile_for_pypi.sh
|
|
35
|
-
|
|
36
|
-
- name: Publish package
|
|
37
|
-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
|
|
38
|
-
with:
|
|
39
|
-
user: __token__
|
|
40
|
-
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
name: Test with pyTest
|
|
2
|
-
|
|
3
|
-
on: [workflow_dispatch, push, pull_request]
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
deploy:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
strategy:
|
|
9
|
-
matrix:
|
|
10
|
-
python-version: ['3.10']
|
|
11
|
-
fail-fast: false
|
|
12
|
-
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v2
|
|
15
|
-
|
|
16
|
-
- name: Set up Python
|
|
17
|
-
uses: actions/setup-python@v2
|
|
18
|
-
with:
|
|
19
|
-
python-version: ${{ matrix.python-version }}
|
|
20
|
-
cache: 'pip'
|
|
21
|
-
|
|
22
|
-
- name: Install dependencies
|
|
23
|
-
run: |
|
|
24
|
-
python -m pip install --upgrade pip
|
|
25
|
-
python -m pip install pytest
|
|
26
|
-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
27
|
-
|
|
28
|
-
- name: Test with pyTest
|
|
29
|
-
run: |
|
|
30
|
-
python -m pytest -v
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.3.2"
|