Skip to content

Commit df2fc74

Browse files
committedApr 30, 2021
Update waitress to 2.0 and add log-level option
Also update some more packages used for docs and testing.
1 parent 9ee6ea4 commit df2fc74

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed
 

‎setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212

1313
requireDev = [
1414
'Pygments>=2.7,<3', 'WebTest>=2.0,<3',
15-
'waitress>=1.4.4,<2', 'hupper>=1.10,<2',
15+
'waitress>=2,<3', 'hupper>=1.10,<2',
1616
]
1717
requireDocs = [
18-
'Sphinx>=3,<4', 'sphinx_rtd_theme>=0.5'
18+
'Sphinx>=3.5,<4', 'sphinx_rtd_theme>=0.5'
1919
]
2020
requireExamples = [
2121
'DBUtils>=2,<4', 'dominate>=2.6,<3', 'yattag>=1.14,<2',
2222
'Pygments>=2.7,<3', 'Pillow>=8,<9'
2323
]
2424
requireTests = [
25-
'psutil>=5.8,<6', 'flake8>=3.8,<4', 'pylint>=2.6,<3', 'tox>=3.21,<4',
25+
'psutil>=5.8,<6', 'flake8>=3.9,<4', 'pylint>=2.8,<3', 'tox>=3.23,<4',
2626
'pywin32>=300,<400;'
2727
'sys_platform=="win32" and implementation_name=="cpython"'
2828
] + requireDev + requireDocs + requireExamples

‎tox.ini

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ envlist = py{36,37,38,39}, pypy3, flake8, pylint, docs, manifest
33

44
[testenv:flake8]
55
basepython = python3.8
6-
deps = flake8>=3.8,<4
6+
deps = flake8>=3.9,<4
77
commands =
88
flake8 webware setup.py
99

1010
[testenv:pylint]
1111
basepython = python3.8
12-
deps = pylint>=2.6,<3
12+
deps = pylint>=2.8,<3
1313
commands =
1414
pylint webware
1515

@@ -22,7 +22,7 @@ commands =
2222

2323
[testenv:manifest]
2424
basepython = python3.8
25-
deps = check-manifest>=0.43
25+
deps = check-manifest>=0.46
2626
commands =
2727
check-manifest -v
2828

‎webware/Scripts/WaitressServer.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Serve Webware for Python Application using the waitress WSGI server."""
44

55
import argparse
6+
import logging
67

78

89
def serve(args):
@@ -68,7 +69,6 @@ def openBrowser():
6869
'Cannot find Webware application.\nIs the current directory'
6970
' the application working directory?') from e
7071

71-
print("Waitress serving Webware application...")
7272
args = vars(args)
7373
for arg in 'browser reload reload_interval prod wsgi_script'.split():
7474
del args[arg]
@@ -80,6 +80,14 @@ def openBrowser():
8080
del args['trusted_proxy_count']
8181
if not args['trusted_proxy_headers']:
8282
del args['trusted_proxy_headers']
83+
logLevel = args.pop('log_level')
84+
if logLevel:
85+
logLevel = logging.getLevelName(logLevel)
86+
if isinstance(logLevel, int):
87+
logger = logging.getLogger('waitress')
88+
logger.setLevel(logLevel)
89+
90+
print("Waitress serving Webware application...")
8391
serve(application, **args)
8492

8593

@@ -155,6 +163,13 @@ def addArguments(parser):
155163
help='The file path of the WSGI script',
156164
default='Scripts/WSGIScript.py',
157165
)
166+
parser.add_argument(
167+
'--log-level',
168+
help='Logs output on the given level',
169+
default=None,
170+
choices=('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'),
171+
type=str.upper
172+
)
158173

159174

160175
def main(args=None):

‎webware/Tests/TestEndToEnd/TestServer.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
Loading context: PSP/Examples at .+Examples
4343
4444
Waitress serving Webware application...
45-
Serving on http://.+:8080
4645
'''
4746

4847
expectedStartPage = r'''
@@ -74,7 +73,7 @@
7473
class RunServer(Process):
7574
"""Run a given command until a given line is found in the output."""
7675

77-
def __init__(self, cmd=None, waitForLine='Serving on '):
76+
def __init__(self, cmd=None, waitForLine='Waitress serving Webware'):
7877
super().__init__()
7978
self.cmd = cmd or ['webware', 'serve']
8079
self.waitForLine = waitForLine

0 commit comments

Comments
 (0)
Please sign in to comment.