chisel 1.3.6__tar.gz → 1.4.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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: chisel
3
- Version: 1.3.6
3
+ Version: 1.4.0
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.6
3
+ version = 1.4.0
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 =
@@ -16,7 +16,8 @@ from .app import \
16
16
  Context
17
17
 
18
18
  from .doc import \
19
- create_doc_requests
19
+ create_doc_requests, \
20
+ create_markdown_up_requests
20
21
 
21
22
  from .request import \
22
23
  RedirectRequest, \
@@ -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
@@ -28,17 +31,20 @@ def create_doc_requests(requests=None, root_path='/doc', api=True, app=True):
28
31
  :returns: Generator of :class:`~chisel.Request`
29
32
  """
30
33
 
34
+ root_noslash = root_path.rstrip('/')
35
+ root_slash = root_noslash + '/'
31
36
  if api:
32
- yield DocIndex(requests=requests, urls=(('GET', root_path + '/doc_index'),))
33
- yield DocRequest(requests=requests, urls=(('GET', root_path + '/doc_request'),))
37
+ yield DocIndex(requests=requests, urls=(('GET', root_slash + 'doc_index'),))
38
+ yield DocRequest(requests=requests, urls=(('GET', root_slash + 'doc_request'),))
34
39
  if app:
35
- yield RedirectRequest((('GET', root_path),), root_path + '/', name='chisel_doc_redirect', doc_group='Documentation')
40
+ if root_noslash:
41
+ yield RedirectRequest((('GET', root_noslash),), root_slash, name='chisel_doc_redirect', doc_group='Documentation')
36
42
  with importlib.resources.files('chisel.static').joinpath('index.html').open('rb') as fh:
37
43
  yield StaticRequest(
38
44
  'chisel_doc',
39
45
  fh.read(),
40
46
  'text/html; charset=utf-8',
41
- (('GET', root_path + '/'), ('GET', root_path + '/index.html')),
47
+ (('GET', root_slash), ('GET', root_slash + 'index.html')),
42
48
  'The Chisel documentation HTML',
43
49
  'Documentation'
44
50
  )
@@ -47,10 +53,41 @@ def create_doc_requests(requests=None, root_path='/doc', api=True, app=True):
47
53
  'chisel_doc_app',
48
54
  fh.read(),
49
55
  'text/plain; charset=utf-8',
50
- (('GET', root_path + '/chiselDoc.bare'),),
56
+ (('GET', root_slash + 'chiselDoc.bare'),),
51
57
  'The Chisel documentation application',
52
58
  'Documentation'
53
59
  )
60
+ yield from create_markdown_up_requests(str(PosixPath(root_path).parent))
61
+
62
+
63
+ def create_markdown_up_requests(parent_path='/'):
64
+ """
65
+ Yield a series of requests for use with :meth:`~chisel.Application.add_requests` comprising the
66
+ MarkdownUp application. By default, the MarkdownUp application is hosted at "/markdown-up/".
67
+
68
+ :param str parent_path: The MarkdownUp application URL parent path. The default is "/".
69
+ :returns: Generator of :class:`~chisel.Request`
70
+ """
71
+
72
+ parent_posix = PosixPath(parent_path)
73
+ with importlib.resources.files('chisel.static').joinpath('markdown-up.tar.gz').open('rb') as tgz:
74
+ with tarfile.open(fileobj=tgz, mode='r:gz') as tar:
75
+ for member in tar.getmembers():
76
+ if member.isfile():
77
+ yield StaticRequest(
78
+ member.name,
79
+ tar.extractfile(member).read(),
80
+ content_type=_CONTENT_TYPES.get(os.path.splitext(member.name)[1], 'text/plain; charset=utf-8'),
81
+ urls=(('GET', str(parent_posix.joinpath(member.name))),),
82
+ doc_group='MarkdownUp Statics'
83
+ )
84
+
85
+
86
+ _CONTENT_TYPES = {
87
+ '.css': 'text/css; charset=utf-8',
88
+ '.js': 'text/javascript; charset=utf-8',
89
+ '.html': 'text/html; charset=utf-8'
90
+ }
54
91
 
55
92
 
56
93
  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.1
1
+ Metadata-Version: 2.4
2
2
  Name: chisel
3
- Version: 1.3.6
3
+ Version: 1.4.0
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