kalong 0.8.1__py3-none-any.whl → 0.8.2__py3-none-any.whl
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.
- kalong/__init__.py +1 -1
- kalong/config.py +8 -0
- kalong/forking.py +1 -1
- kalong/server.py +3 -2
- kalong/utils/__init__.py +2 -1
- kalong/websockets.py +8 -6
- {kalong-0.8.1.dist-info → kalong-0.8.2.dist-info}/METADATA +1 -1
- {kalong-0.8.1.dist-info → kalong-0.8.2.dist-info}/RECORD +11 -11
- {kalong-0.8.1.dist-info → kalong-0.8.2.dist-info}/WHEEL +0 -0
- {kalong-0.8.1.dist-info → kalong-0.8.2.dist-info}/entry_points.txt +0 -0
- {kalong-0.8.1.dist-info → kalong-0.8.2.dist-info}/licenses/LICENSE +0 -0
kalong/__init__.py
CHANGED
kalong/config.py
CHANGED
|
@@ -13,6 +13,7 @@ defaults = {
|
|
|
13
13
|
"front_port": 59999,
|
|
14
14
|
"ws_host": "localhost",
|
|
15
15
|
"ws_port": 59999,
|
|
16
|
+
"base_path": "/",
|
|
16
17
|
"log": "warn",
|
|
17
18
|
"detached": False,
|
|
18
19
|
"command": [],
|
|
@@ -92,9 +93,16 @@ class Config:
|
|
|
92
93
|
action="store_true",
|
|
93
94
|
help="Break at the start of the python file",
|
|
94
95
|
)
|
|
96
|
+
parser.add_argument(
|
|
97
|
+
"--base-path",
|
|
98
|
+
type=str,
|
|
99
|
+
default=self.base_path,
|
|
100
|
+
help="Base path of the frontend url (for use with a proxy for instance)",
|
|
101
|
+
)
|
|
95
102
|
parser.add_argument(
|
|
96
103
|
"--urlsocket",
|
|
97
104
|
type=str,
|
|
105
|
+
default=self.urlsocket,
|
|
98
106
|
help="Path of the socket into which to feed the url for docker browser opening",
|
|
99
107
|
)
|
|
100
108
|
parser.add_argument(
|
kalong/forking.py
CHANGED
|
@@ -15,7 +15,7 @@ def forkserver():
|
|
|
15
15
|
kalong_dir = Path(__file__).parent.parent
|
|
16
16
|
env = dict(os.environ)
|
|
17
17
|
env["PYTHONPATH"] = (
|
|
18
|
-
f
|
|
18
|
+
f"{kalong_dir}:{env['PYTHONPATH']}" if env.get("PYTHONPATH") else kalong_dir
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
popen_args = (
|
kalong/server.py
CHANGED
|
@@ -145,9 +145,10 @@ def serve():
|
|
|
145
145
|
app["front"] = {}
|
|
146
146
|
app["back"] = {}
|
|
147
147
|
app.on_shutdown.append(shutdown)
|
|
148
|
-
|
|
148
|
+
base_path = f"/{config.base_path.strip('/')}/".replace("//", "/")
|
|
149
|
+
app.router.add_get(base_path + r"{side:(front|back)}/{origin}", websocket)
|
|
149
150
|
assets = Path(__file__).parent / "static" / "assets"
|
|
150
|
-
app.router.add_static("
|
|
151
|
+
app.router.add_static(base_path + "front/assets/", assets)
|
|
151
152
|
try:
|
|
152
153
|
loop = asyncio.get_event_loop()
|
|
153
154
|
except RuntimeError:
|
kalong/utils/__init__.py
CHANGED
|
@@ -61,7 +61,8 @@ def url(side):
|
|
|
61
61
|
host = config.front_host if side == "front" else config.host
|
|
62
62
|
port = config.front_port if side == "front" else config.port
|
|
63
63
|
protocol = config.protocol
|
|
64
|
-
|
|
64
|
+
base_path = f"/{config.base_path.strip('/')}/".replace("//", "/")
|
|
65
|
+
return f"{protocol}://{host}:{port}{base_path}{side}/{origin}"
|
|
65
66
|
|
|
66
67
|
|
|
67
68
|
def human_readable_side(side):
|
kalong/websockets.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
import logging
|
|
3
3
|
import os
|
|
4
|
-
import webbrowser
|
|
5
4
|
import socket
|
|
5
|
+
import webbrowser
|
|
6
6
|
from threading import Lock
|
|
7
7
|
|
|
8
8
|
from aiohttp import ClientSession
|
|
9
|
-
from aiohttp.client_exceptions import ClientConnectorError
|
|
9
|
+
from aiohttp.client_exceptions import ClientConnectorError, WSServerHandshakeError
|
|
10
10
|
|
|
11
11
|
from .errors import NoServerFoundError
|
|
12
12
|
from .forking import forkserver
|
|
@@ -41,7 +41,7 @@ async def websocket_state():
|
|
|
41
41
|
try:
|
|
42
42
|
ws = await sessions[origin].ws_connect(url("back"), **websocket_options)
|
|
43
43
|
log.info("Found existing kalong server")
|
|
44
|
-
except ClientConnectorError:
|
|
44
|
+
except (ClientConnectorError, WSServerHandshakeError):
|
|
45
45
|
# If there are no server available, fork one
|
|
46
46
|
log.info("No kalong server, starting one")
|
|
47
47
|
forkserver()
|
|
@@ -57,18 +57,20 @@ async def websocket_state():
|
|
|
57
57
|
else:
|
|
58
58
|
raise NoServerFoundError()
|
|
59
59
|
|
|
60
|
+
external_url = url("front")
|
|
61
|
+
|
|
60
62
|
if os.getenv("KALONG_URLSOCKET"):
|
|
61
63
|
try:
|
|
62
64
|
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
63
65
|
sock.connect(os.getenv("KALONG_URLSOCKET"))
|
|
64
|
-
sock.send(
|
|
66
|
+
sock.send(external_url.encode("utf-8"))
|
|
65
67
|
sock.shutdown(socket.SHUT_WR)
|
|
66
68
|
finally:
|
|
67
69
|
sock.close()
|
|
68
70
|
# webbrowser.open should be in the mutex too, it's not thread safe
|
|
69
|
-
elif os.getenv("KALONG_NO_BROWSER") or not webbrowser.open(
|
|
71
|
+
elif os.getenv("KALONG_NO_BROWSER") or not webbrowser.open(external_url):
|
|
70
72
|
log.warning(
|
|
71
|
-
f"Please open your browser to the following url: {
|
|
73
|
+
f"Please open your browser to the following url: {external_url}"
|
|
72
74
|
)
|
|
73
75
|
|
|
74
76
|
websockets[origin] = ws
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
kalong/__init__.py,sha256=
|
|
1
|
+
kalong/__init__.py,sha256=jy-fjO2olDVmMiGVFs_r050K3qn7GcBjIcgvRlkH3Lw,3371
|
|
2
2
|
kalong/__main__.py,sha256=rhd3QnCaDRx26Y1oEEoIUVYhzIhrddXMuZhDh1s1wyo,63
|
|
3
3
|
kalong/communication.py,sha256=He17EOKx-1mZt-RA3wjbC7K6mVHqzAE3iyqxE8bgrhM,7460
|
|
4
|
-
kalong/config.py,sha256=
|
|
4
|
+
kalong/config.py,sha256=6Jr6NOi3FPOU4ld-r5t2Ylc00-tnhX2I7gpPCpEwyfk,5265
|
|
5
5
|
kalong/debugger.py,sha256=pbwshEmzidhycYiF-cEZCH16okYaqGs6daNyZFviwF8,13397
|
|
6
6
|
kalong/errors.py,sha256=3uUIdb_Vk046fZu7kvUNSIWStKUb2Lw9lzSr4KYjydQ,394
|
|
7
|
-
kalong/forking.py,sha256=
|
|
7
|
+
kalong/forking.py,sha256=aSlX4dCaw_b6b8r6EGFN2wdUiHlOHkAAEPUajMFSOw4,941
|
|
8
8
|
kalong/loops.py,sha256=J1d0dpswZjE4yCqhI6NaPFETJvU7E9BRgaayE6RCNKc,1458
|
|
9
|
-
kalong/server.py,sha256=
|
|
9
|
+
kalong/server.py,sha256=9iTyCCK2Fbewne5j5BhqQVIfQ3wpIsQpI87kY1lt45M,5081
|
|
10
10
|
kalong/stepping.py,sha256=0f2eWfAZ8cTdy6eyNE5mo4E4WoQI6HjF0PQogC2mCCM,2457
|
|
11
11
|
kalong/tracing.py,sha256=KvOM-XeYbfQNHFA3FKYrElsOQp9hzzc9SiEhVTGOel4,4284
|
|
12
|
-
kalong/websockets.py,sha256=
|
|
12
|
+
kalong/websockets.py,sha256=aeyZNBDVYekG2HsyYrHTj2yx-98oX4INQt93YzSeHS0,3249
|
|
13
13
|
kalong/static/index.html,sha256=AobRsmnjVGSbKAan_65UaPvOE5FiRyokVl1vV1qsdPs,449
|
|
14
14
|
kalong/static/assets/FiraCode-Bold-DzhvDiv4.woff2,sha256=13jBmAPGctKUZj6Sg8e3UswSWrJm8N245TsDnaksr2c,107788
|
|
15
15
|
kalong/static/assets/FiraCode-Regular-jAL9VymT.woff2,sha256=ps5ZUguQ4V1wYv_vIU-UyK3VpAhcC7sWg2Au8iek0f4,103240
|
|
16
16
|
kalong/static/assets/favicon-DBiNgszC.svg,sha256=fFK1c_uInX-1NvYVQEiweHwXfNCWqBxEUmXWg4daSb8,596
|
|
17
17
|
kalong/static/assets/index-JJdLKGIu.js,sha256=ZOpMatpvby7625BY5MtUhUv94-P6T9V2Wz2QO82dvS0,1024900
|
|
18
|
-
kalong/utils/__init__.py,sha256=
|
|
18
|
+
kalong/utils/__init__.py,sha256=xXzqZGmkTJPlCCZi4qvQa9fniA-d1xrDT4W4xVU0kBs,3661
|
|
19
19
|
kalong/utils/io.py,sha256=lPxXFDErqVHDHAFKyIAjHH7WSFfY8HRKIRyXB1_6IkU,1533
|
|
20
20
|
kalong/utils/iterators.py,sha256=6fbv-9hZ-7a3i1oJvLCzLXm7Ihc66CgSO2u87nZzxrg,1045
|
|
21
21
|
kalong/utils/obj.py,sha256=FXm98nx7l60mBN3LzwdmuiAckw36-3F96tJqo1K5R6A,4385
|
|
22
22
|
kalong/utils/doc_lookup/__init__.py,sha256=Bf0hv0Enkk46TTIlBfyDlGMf9LHhp4wNPDgBl_TVM1s,685
|
|
23
23
|
kalong/utils/doc_lookup/lookup.json,sha256=Xvfd7njY3dyQ7i4IRoOs_5CAlTk0TWEAL4a5kiuObU0,997017
|
|
24
|
-
kalong-0.8.
|
|
25
|
-
kalong-0.8.
|
|
26
|
-
kalong-0.8.
|
|
27
|
-
kalong-0.8.
|
|
28
|
-
kalong-0.8.
|
|
24
|
+
kalong-0.8.2.dist-info/METADATA,sha256=9fnOvgsCoUNZiHEiV2hkrnS9ehNSNXOdWI5rbIjLpaQ,815
|
|
25
|
+
kalong-0.8.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
26
|
+
kalong-0.8.2.dist-info/entry_points.txt,sha256=ATxUxSsaDx2Ggw96-oG3rFA59uxPOK_R7o7-yJn7tlo,39
|
|
27
|
+
kalong-0.8.2.dist-info/licenses/LICENSE,sha256=pXYsRuhMNEdOP2Mtt6hP9twpETOg_5R2wMYDrz7Z0ms,36836
|
|
28
|
+
kalong-0.8.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|