chisel 1.3.7__tar.gz → 1.4.1__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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: chisel
3
- Version: 1.3.7
3
+ Version: 1.4.1
4
4
  Summary: Lightweight WSGI application framework, schema-validated JSON APIs, and API documentation
5
5
  Home-page: https://github.com/craigahobbs/chisel
6
6
  Author: Craig A. Hobbs
@@ -22,6 +22,7 @@ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
22
22
  Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
24
  Requires-Dist: schema-markdown>=1.2.0
25
+ Dynamic: license-file
25
26
 
26
27
  # chisel
27
28
 
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = chisel
3
- version = 1.3.7
3
+ version = 1.4.1
4
4
  url = https://github.com/craigahobbs/chisel
5
5
  author = Craig A. Hobbs
6
6
  author_email = craigahobbs@gmail.com
@@ -34,6 +34,7 @@ install_requires =
34
34
  chisel =
35
35
  static/*.bare
36
36
  static/*.html
37
+ static/*.tar.gz
37
38
 
38
39
  [egg_info]
39
40
  tag_build =
@@ -6,6 +6,9 @@ Chisel documentation application
6
6
  """
7
7
 
8
8
  import importlib.resources
9
+ import os
10
+ from pathlib import PosixPath
11
+ import tarfile
9
12
 
10
13
  from schema_markdown import get_referenced_types
11
14
  from schema_markdown.type_model import TYPE_MODEL
@@ -14,7 +17,7 @@ from .action import Action, ActionError
14
17
  from .request import RedirectRequest, StaticRequest
15
18
 
16
19
 
17
- def create_doc_requests(requests=None, root_path='/doc', api=True, app=True, markdown_up=None):
20
+ def create_doc_requests(requests=None, root_path='/doc', api=True, app=True, markdown_up=False):
18
21
  """
19
22
  Yield a series of requests for use with :meth:`~chisel.Application.add_requests` comprising the Chisel
20
23
  documentation application. By default, the documenation application is hosted at "/doc/".
@@ -24,28 +27,25 @@ def create_doc_requests(requests=None, root_path='/doc', api=True, app=True, mar
24
27
  :param str root_path: The documentation application URL root path. The default is "/doc".
25
28
  :param bool api: If True, include the documentation APIs. Two documentation APIs are added,
26
29
  "/doc/doc_index" and "`/doc/doc_request <doc/#name=chisel_doc_request>`__".
27
- :param bool app: If True, include the documentation client application.
28
- :param str markdown_up: Optional, the relative path to the MarkdownUp application.
30
+ :param bool app: If True, include the documentation application.
31
+ :param bool markdown_up: If True, include the MarkdownUp application.
29
32
  :returns: Generator of :class:`~chisel.Request`
30
33
  """
31
34
 
35
+ root_noslash = root_path.rstrip('/')
36
+ root_slash = root_noslash + '/'
32
37
  if api:
33
- yield DocIndex(requests=requests, urls=(('GET', root_path + '/doc_index'),))
34
- yield DocRequest(requests=requests, urls=(('GET', root_path + '/doc_request'),))
38
+ yield DocIndex(requests=requests, urls=(('GET', root_slash + 'doc_index'),))
39
+ yield DocRequest(requests=requests, urls=(('GET', root_slash + 'doc_request'),))
35
40
  if app:
36
- yield RedirectRequest((('GET', root_path),), root_path + '/', name='chisel_doc_redirect', doc_group='Documentation')
41
+ if root_noslash:
42
+ yield RedirectRequest((('GET', root_noslash),), root_slash, name='chisel_doc_redirect', doc_group='Documentation')
37
43
  with importlib.resources.files('chisel.static').joinpath('index.html').open('rb') as fh:
38
- index_bytes = fh.read()
39
- if markdown_up:
40
- index_str = index_bytes.decode(encoding='utf-8')
41
- index_str = index_str.replace('https://craigahobbs.github.io/markdown-up/', markdown_up)
42
- index_str = index_str.replace("'markdownText':", f"'systemPrefix': '{markdown_up}include/', 'markdownText':")
43
- index_bytes = index_str.encode(encoding='utf-8')
44
44
  yield StaticRequest(
45
45
  'chisel_doc',
46
- index_bytes,
46
+ fh.read(),
47
47
  'text/html; charset=utf-8',
48
- (('GET', root_path + '/'), ('GET', root_path + '/index.html')),
48
+ (('GET', root_slash), ('GET', root_slash + 'index.html')),
49
49
  'The Chisel documentation HTML',
50
50
  'Documentation'
51
51
  )
@@ -54,10 +54,30 @@ def create_doc_requests(requests=None, root_path='/doc', api=True, app=True, mar
54
54
  'chisel_doc_app',
55
55
  fh.read(),
56
56
  'text/plain; charset=utf-8',
57
- (('GET', root_path + '/chiselDoc.bare'),),
57
+ (('GET', root_slash + 'chiselDoc.bare'),),
58
58
  'The Chisel documentation application',
59
59
  'Documentation'
60
60
  )
61
+ if markdown_up or app:
62
+ parent_posix = PosixPath(root_path).parent
63
+ with importlib.resources.files('chisel.static').joinpath('markdown-up.tar.gz').open('rb') as tgz:
64
+ with tarfile.open(fileobj=tgz, mode='r:gz') as tar:
65
+ for member in tar.getmembers():
66
+ if member.isfile():
67
+ yield StaticRequest(
68
+ member.name,
69
+ tar.extractfile(member).read(),
70
+ content_type=_CONTENT_TYPES.get(os.path.splitext(member.name)[1], 'text/plain; charset=utf-8'),
71
+ urls=(('GET', str(parent_posix.joinpath(member.name))),),
72
+ doc_group='MarkdownUp Statics'
73
+ )
74
+
75
+
76
+ _CONTENT_TYPES = {
77
+ '.css': 'text/css; charset=utf-8',
78
+ '.js': 'text/javascript; charset=utf-8',
79
+ '.html': 'text/html; charset=utf-8'
80
+ }
61
81
 
62
82
 
63
83
  class DocIndex(Action):
@@ -0,0 +1,54 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Chisel Documentation Application</title>
5
+ <meta charset="UTF-8">
6
+ <meta name="description" content="Chisel Documentation Application">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <link rel="stylesheet" href="../markdown-up/app.css">
9
+
10
+ <!-- Preloads -->
11
+ <link rel="modulepreload" href="../markdown-up/bare-script/lib/data.js" as="script">
12
+ <link rel="modulepreload" href="../markdown-up/bare-script/lib/library.js" as="script">
13
+ <link rel="modulepreload" href="../markdown-up/bare-script/lib/model.js" as="script">
14
+ <link rel="modulepreload" href="../markdown-up/bare-script/lib/options.js" as="script">
15
+ <link rel="modulepreload" href="../markdown-up/bare-script/lib/parser.js" as="script">
16
+ <link rel="modulepreload" href="../markdown-up/bare-script/lib/runtime.js" as="script">
17
+ <link rel="modulepreload" href="../markdown-up/bare-script/lib/runtimeAsync.js" as="script">
18
+ <link rel="modulepreload" href="../markdown-up/bare-script/lib/value.js" as="script">
19
+ <link rel="modulepreload" href="../markdown-up/element-model/lib/elementModel.js" as="script">
20
+ <link rel="modulepreload" href="../markdown-up/lib/app.js" as="script">
21
+ <link rel="modulepreload" href="../markdown-up/lib/dataTable.js" as="script">
22
+ <link rel="modulepreload" href="../markdown-up/lib/dataUtil.js" as="script">
23
+ <link rel="modulepreload" href="../markdown-up/lib/lineChart.js" as="script">
24
+ <link rel="modulepreload" href="../markdown-up/lib/script.js" as="script">
25
+ <link rel="modulepreload" href="../markdown-up/lib/scriptLibrary.js" as="script">
26
+ <link rel="modulepreload" href="../markdown-up/markdown-model/lib/elements.js" as="script">
27
+ <link rel="modulepreload" href="../markdown-up/markdown-model/lib/highlight.js" as="script">
28
+ <link rel="modulepreload" href="../markdown-up/markdown-model/lib/parser.js" as="script">
29
+ <link rel="modulepreload" href="../markdown-up/schema-markdown-doc/lib/schemaMarkdownDoc.js" as="script">
30
+ <link rel="modulepreload" href="../markdown-up/schema-markdown/lib/encode.js" as="script">
31
+ <link rel="modulepreload" href="../markdown-up/schema-markdown/lib/parser.js" as="script">
32
+ <link rel="modulepreload" href="../markdown-up/schema-markdown/lib/schema.js" as="script">
33
+ <link rel="modulepreload" href="../markdown-up/schema-markdown/lib/schemaUtil.js" as="script">
34
+ <link rel="modulepreload" href="../markdown-up/schema-markdown/lib/typeModel.js" as="script">
35
+ <link rel="preload" href="../markdown-up/app.css" as="style">
36
+ <link rel="preload" href="../markdown-up/markdown-model/static/markdown-model.css" as="style">
37
+ </head>
38
+ <body>
39
+ </body>
40
+ <script type="module">
41
+ import {MarkdownUp} from '../markdown-up/lib/app.js';
42
+ const app = new MarkdownUp(window, {
43
+ 'systemPrefix': '../markdown-up/include/',
44
+ 'markdownText': `\
45
+ ~~~ markdown-script
46
+ include 'chiselDoc.bare'
47
+
48
+ chiselDoc()
49
+ ~~~
50
+ `
51
+ });
52
+ app.run();
53
+ </script>
54
+ </html>
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: chisel
3
- Version: 1.3.7
3
+ Version: 1.4.1
4
4
  Summary: Lightweight WSGI application framework, schema-validated JSON APIs, and API documentation
5
5
  Home-page: https://github.com/craigahobbs/chisel
6
6
  Author: Craig A. Hobbs
@@ -22,6 +22,7 @@ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
22
22
  Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
24
  Requires-Dist: schema-markdown>=1.2.0
25
+ Dynamic: license-file
25
26
 
26
27
  # chisel
27
28
 
@@ -14,4 +14,5 @@ src/chisel.egg-info/requires.txt
14
14
  src/chisel.egg-info/top_level.txt
15
15
  src/chisel/static/__init__.py
16
16
  src/chisel/static/chiselDoc.bare
17
- src/chisel/static/index.html
17
+ src/chisel/static/index.html
18
+ src/chisel/static/markdown-up.tar.gz
@@ -1,52 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title>Chisel Documentation Application</title>
5
- <meta charset="UTF-8">
6
- <meta name="description" content="Chisel Documentation Application">
7
- <meta name="viewport" content="width=device-width, initial-scale=1">
8
- <link rel="stylesheet" href="https://craigahobbs.github.io/markdown-up/app.css">
9
-
10
- <!-- Preloads -->
11
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/data.js" as="script">
12
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/library.js" as="script">
13
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/model.js" as="script">
14
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/options.js" as="script">
15
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/parser.js" as="script">
16
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/runtime.js" as="script">
17
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/runtimeAsync.js" as="script">
18
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/value.js" as="script">
19
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/element-model/lib/elementModel.js" as="script">
20
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/app.js" as="script">
21
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/dataTable.js" as="script">
22
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/dataUtil.js" as="script">
23
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/lineChart.js" as="script">
24
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/script.js" as="script">
25
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/scriptLibrary.js" as="script">
26
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/markdown-model/lib/elements.js" as="script">
27
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/markdown-model/lib/highlight.js" as="script">
28
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/markdown-model/lib/parser.js" as="script">
29
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown-doc/lib/schemaMarkdownDoc.js" as="script">
30
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/encode.js" as="script">
31
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/parser.js" as="script">
32
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/schema.js" as="script">
33
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/schemaUtil.js" as="script">
34
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/typeModel.js" as="script">
35
- <link rel="preload" href="https://craigahobbs.github.io/markdown-up/app.css" as="style">
36
- <link rel="preload" href="https://craigahobbs.github.io/markdown-up/markdown-model/static/markdown-model.css" as="style">
37
- </head>
38
- <body>
39
- </body>
40
- <script type="module">
41
- import {MarkdownUp} from 'https://craigahobbs.github.io/markdown-up/lib/app.js';
42
- const app = new MarkdownUp(window, {
43
- 'markdownText': `\
44
- ~~~ markdown-script
45
- include 'chiselDoc.bare'
46
-
47
- chiselDoc()
48
- ~~~
49
- `});
50
- app.run();
51
- </script>
52
- </html>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes