Skip to content

Commit

Permalink
improves jpdemo for server usage
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Feb 24, 2023
1 parent 3abed38 commit a76b721
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ test = [
#pandas_datareader", #example
"plotly", # example
"pydeck", # example
"pydevd", # demo_browser
"pygments", # demo_browser
"seaborn", # example
#scipy", # example
Expand Down
43 changes: 40 additions & 3 deletions scripts/jpdemo
Original file line number Diff line number Diff line change
@@ -1,16 +1,53 @@
#!/bin/bash
# WF 2022-10-23
python -m venv --upgrade-deps venv
source venv/bin/activate
pip install '.[test]'

export PYTHONPATH=.
host=$(hostname -f)
port=8099

#
# start the webbrowser
#
webbrowser() {
local l_sleeptime=$1
local l_host=$2
local l_port=$3
sleep $l_sleeptime
open http://$l_host:$l_port
}
echo "Starting justpy demo browser on host $host port $port ..."
webbrowser 1 $host $port&
python examples/demo_browser.py --port $port --host $host

# show usage
#
usage() {
echo "$0 [-h|--help]"
echo "-s |--server: start justpy demo server"
echo "-b |--browser: start local demo browser"
echo "-h |--help: show this usage"
exit 1
}

if [ $# -lt 1 ]
then
usage
else
while [ "$1" != "" ]
do
option="$1"
case $option in
-h|--help)
usage
;;
-s|--serve)
echo "Starting justpy demo browser on host $host port $port ..."
python examples/demo_browser.py --port $port --host $host
;;
-b|--browse)
webbrowser 1 $host $port&
;;
esac
shift
done
fi

0 comments on commit a76b721

Please sign in to comment.