chisel 1.4.0__tar.gz → 1.4.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chisel
3
- Version: 1.4.0
3
+ Version: 1.4.2
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
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = chisel
3
- version = 1.4.0
3
+ version = 1.4.2
4
4
  url = https://github.com/craigahobbs/chisel
5
5
  author = Craig A. Hobbs
6
6
  author_email = craigahobbs@gmail.com
@@ -16,8 +16,7 @@ from .app import \
16
16
  Context
17
17
 
18
18
  from .doc import \
19
- create_doc_requests, \
20
- create_markdown_up_requests
19
+ create_doc_requests
21
20
 
22
21
  from .request import \
23
22
  RedirectRequest, \
@@ -7,7 +7,7 @@ Chisel documentation application
7
7
 
8
8
  import importlib.resources
9
9
  import os
10
- from pathlib import PosixPath
10
+ from pathlib import PurePosixPath
11
11
  import tarfile
12
12
 
13
13
  from schema_markdown import get_referenced_types
@@ -17,7 +17,7 @@ from .action import Action, ActionError
17
17
  from .request import RedirectRequest, StaticRequest
18
18
 
19
19
 
20
- def create_doc_requests(requests=None, root_path='/doc', api=True, app=True):
20
+ def create_doc_requests(requests=None, root_path='/doc', api=True, app=True, markdown_up=False):
21
21
  """
22
22
  Yield a series of requests for use with :meth:`~chisel.Application.add_requests` comprising the Chisel
23
23
  documentation application. By default, the documenation application is hosted at "/doc/".
@@ -27,7 +27,8 @@ def create_doc_requests(requests=None, root_path='/doc', api=True, app=True):
27
27
  :param str root_path: The documentation application URL root path. The default is "/doc".
28
28
  :param bool api: If True, include the documentation APIs. Two documentation APIs are added,
29
29
  "/doc/doc_index" and "`/doc/doc_request <doc/#name=chisel_doc_request>`__".
30
- :param bool app: If True, include the documentation client application.
30
+ :param bool app: If True, include the documentation application.
31
+ :param bool markdown_up: If True, include the MarkdownUp application.
31
32
  :returns: Generator of :class:`~chisel.Request`
32
33
  """
33
34
 
@@ -57,30 +58,19 @@ def create_doc_requests(requests=None, root_path='/doc', api=True, app=True):
57
58
  'The Chisel documentation application',
58
59
  'Documentation'
59
60
  )
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
- )
61
+ if markdown_up or app:
62
+ parent_posix = PurePosixPath(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
+ )
84
74
 
85
75
 
86
76
  _CONTENT_TYPES = {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chisel
3
- Version: 1.4.0
3
+ Version: 1.4.2
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes