devlinker 1.2.7__tar.gz → 1.2.8__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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devlinker
3
- Version: 1.2.7
3
+ Version: 1.2.8
4
4
  Summary: AI-powered linking and automation tool
5
5
  Author-email: Mani <mani1028@users.noreply.github.com>
6
6
  Requires-Python: >=3.7
@@ -6,15 +6,50 @@ from typing import Iterable, Optional, Tuple
6
6
  import requests
7
7
 
8
8
 
9
- def check_port(port: int, timeout: float = 1.0) -> bool:
10
- """Return True when an HTTP service responds on localhost:port."""
9
+ DEFAULT_BACKEND_PROBE_PATHS = (
10
+ "/health",
11
+ "/api/health",
12
+ "/",
13
+ )
14
+
15
+
16
+ def check_port(
17
+ port: int,
18
+ timeout: float = 1.0,
19
+ probe_paths: Iterable[str] = DEFAULT_BACKEND_PROBE_PATHS,
20
+ ) -> bool:
21
+ """Return True when an HTTP service is reachable on localhost:port.
22
+
23
+ Probe order is health-first (for API-style backends), then root fallback.
24
+ """
25
+ normalized_paths: list[str] = []
26
+ for path in probe_paths:
27
+ cleaned = path.strip()
28
+ if not cleaned:
29
+ continue
30
+ if not cleaned.startswith("/"):
31
+ cleaned = f"/{cleaned}"
32
+ normalized_paths.append(cleaned)
33
+
34
+ if not normalized_paths:
35
+ normalized_paths = ["/"]
36
+
11
37
  for host in ("localhost", "127.0.0.1"):
12
- try:
13
- response = requests.get(f"http://{host}:{port}", timeout=timeout)
14
- if response.status_code < 500:
38
+ for path in normalized_paths:
39
+ try:
40
+ response = requests.get(f"http://{host}:{port}{path}", timeout=timeout)
41
+ except requests.RequestException:
42
+ continue
43
+
44
+ # Health endpoints must return 2xx/3xx to be considered ready.
45
+ if path in {"/health", "/api/health"}:
46
+ if 200 <= response.status_code < 400:
47
+ return True
48
+ continue
49
+
50
+ # Root fallback accepts non-error responses.
51
+ if 200 <= response.status_code < 400:
15
52
  return True
16
- except requests.RequestException:
17
- pass
18
53
  return False
19
54
 
20
55
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devlinker
3
- Version: 1.2.7
3
+ Version: 1.2.8
4
4
  Summary: AI-powered linking and automation tool
5
5
  Author-email: Mani <mani1028@users.noreply.github.com>
6
6
  Requires-Python: >=3.7
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "devlinker"
7
- version = "1.2.7"
7
+ version = "1.2.8"
8
8
  description = "AI-powered linking and automation tool"
9
9
  authors = [
10
10
  { name = "Mani", email = "mani1028@users.noreply.github.com" }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes