Skip to content

Commit

Permalink
Merge branch 'lona-web-org:master' into daemonize_deprecation-2
Browse files Browse the repository at this point in the history
  • Loading branch information
AvdN authored Aug 21, 2023
2 parents 9e0276f + 7adb7aa commit e325229
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
3 changes: 3 additions & 0 deletions doc/content/tutorial/01-getting-started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ Run the script using:
``app.run()`` takes keywords like ``host`` or ``port`` for configuration, and
also parses the command line. Run ``python example.py -h`` to print the help.
If port 8080 is taken by another application, you can set environment
variable ``LONA_DEFAULT_PORT`` to some other port, affecting all examples that
do not set the port explicitly.

The script should print that it opened a webserver on
``http://localhost:8080``. If you navigate your browser there, you should see
Expand Down
6 changes: 4 additions & 2 deletions lona/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,14 @@ def parse_command_line(self) -> dict:
from lona.command_line.handle_command_line import (
parse_overrides,
DESCRIPTION,
EPILOG,
)

parser = ArgumentParser(
prog=str(self.script_path),
formatter_class=RawTextHelpFormatter,
description=DESCRIPTION,
epilog=EPILOG,
)

parser.add_argument(
Expand Down Expand Up @@ -428,8 +430,8 @@ def run(

# setup arguments
server_args = Namespace(
host='localhost',
port=8080,
host=os.environ.get('LONA_DEFAULT_HOST', 'localhost'),
port=os.environ.get('LONA_DEFAULT_PORT', '8080'),
shell_server_url='',
shutdown_timeout=0,
log_level='info',
Expand Down
9 changes: 7 additions & 2 deletions lona/command_line/handle_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
Code: https://github.com/lona-web-org/lona
""".strip()

EPILOG = """\
You can set environment variables LONA_DEFAULT_HOST and LONA_DEFAULT_PORT,
to override built-in defaults ('localhost' resp. '8080').
""".rstrip()


def parse_overrides(raw_overrides):
environment = Environment()
Expand Down Expand Up @@ -110,13 +115,13 @@ def handle_command_line(argv):
parser_run_server.add_argument(
'--host',
type=str,
default='localhost',
default=os.environ.get('LONA_DEFAULT_HOST', 'localhost'),
)

parser_run_server.add_argument(
'--port',
type=int,
default=8080,
default=os.environ.get('LONA_DEFAULT_PORT', '8080'),
)

parser_run_server.add_argument(
Expand Down
2 changes: 1 addition & 1 deletion playwright.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/playwright:v1.36.2-jammy
FROM mcr.microsoft.com/playwright:v1.37.1-jammy

ARG UID=1000 GID=1000

Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ test = [
"rlpython",
"typing-extensions",

"coverage==7.2.7",
"coverage==7.3.0",
"pytest==7.4.0",
"pytest-aiohttp==1.0.4",
"pytest-mock==3.11.1",
"pytest-timeout==2.1.0",
"playwright==1.36.0",
"playwright==1.37.0",
]

lint = [
Expand All @@ -72,7 +72,7 @@ lint = [
"typing-extensions",

"coverage",
"flake8==6.0.0",
"flake8==6.1.0",
"flake8-2020==1.8.1",
"flake8-bugbear==23.7.10",
"flake8-commas==2.1.0",
Expand All @@ -84,7 +84,7 @@ lint = [
"flake8-pytest-style==1.7.2",
"flake8-quotes==3.3.2",
"flake8-use-fstring==1.4",
"mypy==1.4.1",
"mypy==1.5.1",
"isort==5.12.0",
"pytest==7.4.0",
]
Expand Down
8 changes: 4 additions & 4 deletions tests/test_0104_html_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ def test_select():
</select>
""")[0]

assert type(node) == Select
assert type(node.nodes[0]) == Option
assert type(node) is Select
assert type(node.nodes[0]) is Option
assert node.value == '2'


Expand All @@ -290,8 +290,8 @@ def test_select2():
</select>
""")[0]

assert type(node) == Select2
assert type(node.nodes[0]) == Option2
assert type(node) is Select2
assert type(node.nodes[0]) is Option2
assert node.value == '2'

finally:
Expand Down

0 comments on commit e325229

Please sign in to comment.