kalong 0.8.1__tar.gz → 0.8.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.
Files changed (28) hide show
  1. {kalong-0.8.1 → kalong-0.8.2}/PKG-INFO +1 -1
  2. {kalong-0.8.1 → kalong-0.8.2}/kalong/__init__.py +1 -1
  3. {kalong-0.8.1 → kalong-0.8.2}/kalong/config.py +8 -0
  4. {kalong-0.8.1 → kalong-0.8.2}/kalong/forking.py +1 -1
  5. {kalong-0.8.1 → kalong-0.8.2}/kalong/server.py +3 -2
  6. {kalong-0.8.1 → kalong-0.8.2}/kalong/utils/__init__.py +2 -1
  7. {kalong-0.8.1 → kalong-0.8.2}/kalong/websockets.py +8 -6
  8. {kalong-0.8.1 → kalong-0.8.2}/pyproject.toml +5 -1
  9. {kalong-0.8.1 → kalong-0.8.2}/.gitignore +0 -0
  10. {kalong-0.8.1 → kalong-0.8.2}/LICENSE +0 -0
  11. {kalong-0.8.1 → kalong-0.8.2}/README.md +0 -0
  12. {kalong-0.8.1 → kalong-0.8.2}/kalong/__main__.py +0 -0
  13. {kalong-0.8.1 → kalong-0.8.2}/kalong/communication.py +0 -0
  14. {kalong-0.8.1 → kalong-0.8.2}/kalong/debugger.py +0 -0
  15. {kalong-0.8.1 → kalong-0.8.2}/kalong/errors.py +0 -0
  16. {kalong-0.8.1 → kalong-0.8.2}/kalong/loops.py +0 -0
  17. {kalong-0.8.1 → kalong-0.8.2}/kalong/static/assets/FiraCode-Bold-DzhvDiv4.woff2 +0 -0
  18. {kalong-0.8.1 → kalong-0.8.2}/kalong/static/assets/FiraCode-Regular-jAL9VymT.woff2 +0 -0
  19. {kalong-0.8.1 → kalong-0.8.2}/kalong/static/assets/favicon-DBiNgszC.svg +0 -0
  20. {kalong-0.8.1 → kalong-0.8.2}/kalong/static/assets/index-JJdLKGIu.js +0 -0
  21. {kalong-0.8.1 → kalong-0.8.2}/kalong/static/index.html +0 -0
  22. {kalong-0.8.1 → kalong-0.8.2}/kalong/stepping.py +0 -0
  23. {kalong-0.8.1 → kalong-0.8.2}/kalong/tracing.py +0 -0
  24. {kalong-0.8.1 → kalong-0.8.2}/kalong/utils/doc_lookup/__init__.py +0 -0
  25. {kalong-0.8.1 → kalong-0.8.2}/kalong/utils/doc_lookup/lookup.json +0 -0
  26. {kalong-0.8.1 → kalong-0.8.2}/kalong/utils/io.py +0 -0
  27. {kalong-0.8.1 → kalong-0.8.2}/kalong/utils/iterators.py +0 -0
  28. {kalong-0.8.1 → kalong-0.8.2}/kalong/utils/obj.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kalong
3
- Version: 0.8.1
3
+ Version: 0.8.2
4
4
  Summary: A new take on python debugging
5
5
  Author-email: Florian Mounier <paradoxxx.zero@gmail.com>
6
6
  License-Expression: GPL-3.0-or-later
@@ -1,6 +1,6 @@
1
1
  """A new take on debugging"""
2
2
 
3
- __version__ = "0.8.1"
3
+ __version__ = "0.8.2"
4
4
  import os
5
5
  import sys
6
6
  from pathlib import Path
@@ -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(
@@ -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'{kalong_dir}:{env["PYTHONPATH"]}' if env.get("PYTHONPATH") else kalong_dir
18
+ f"{kalong_dir}:{env['PYTHONPATH']}" if env.get("PYTHONPATH") else kalong_dir
19
19
  )
20
20
 
21
21
  popen_args = (
@@ -145,9 +145,10 @@ def serve():
145
145
  app["front"] = {}
146
146
  app["back"] = {}
147
147
  app.on_shutdown.append(shutdown)
148
- app.router.add_get(r"/{side:(front|back)}/{origin}", websocket)
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("/front/assets/", assets)
151
+ app.router.add_static(base_path + "front/assets/", assets)
151
152
  try:
152
153
  loop = asyncio.get_event_loop()
153
154
  except RuntimeError:
@@ -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
- return f"{protocol}://{host}:{port}/{side}/{origin}"
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):
@@ -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(url("front").encode("utf-8"))
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(url("front")):
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: {url('front')}"
73
+ f"Please open your browser to the following url: {external_url}"
72
74
  )
73
75
 
74
76
  websockets[origin] = ws
@@ -30,7 +30,11 @@ disassembly = ["uncompyle6>=3.9.2"]
30
30
  recursive = ["nest-asyncio>=1.6.0"]
31
31
 
32
32
  [dependency-groups]
33
- dev = ["pre-commit>=3.5.0", "sphinx>=7.1.2"]
33
+ dev = [
34
+ "pre-commit>=3.5.0",
35
+ "ruff>=0.15.0",
36
+ "sphinx>=7.1.2",
37
+ ]
34
38
 
35
39
  [build-system]
36
40
  requires = ["hatchling"]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes