artin-server 1.0.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.
@@ -0,0 +1,2 @@
1
+ from .core import ArtinServerEngine
2
+ __all__ = ["ArtinServerEngine"]
artin_server/core.py ADDED
@@ -0,0 +1,41 @@
1
+ import os
2
+ import sys
3
+ import socket
4
+ import subprocess
5
+ from typing import Dict, Optional
6
+
7
+ class ServerInstance:
8
+ def __init__(self, name: str, port: int, process: subprocess.Popen):
9
+ self.name = name
10
+ self.port = port
11
+ self.process = process
12
+
13
+ class ArtinServerEngine:
14
+ def __init__(self):
15
+ self.registry: Dict[str, ServerInstance] = {}
16
+
17
+ def is_port_available(self, port: int) -> bool:
18
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
19
+ return s.connect_ex(('127.0.0.1', port)) != 0
20
+
21
+ def find_free_port(self, start: int = 8000) -> int:
22
+ port = start
23
+ while not self.is_port_available(port):
24
+ port += 1
25
+ return port
26
+
27
+ def spawn(self, name: str, directory: str, port: Optional[int] = None) -> ServerInstance:
28
+ port = port or self.find_free_port()
29
+ creation_flags = subprocess.CREATE_NO_WINDOW if sys.platform == "win32" else 0
30
+
31
+ proc = subprocess.Popen(
32
+ [sys.executable, "-m", "http.server", str(port)],
33
+ cwd=os.path.abspath(directory),
34
+ creationflags=creation_flags,
35
+ stdout=subprocess.DEVNULL,
36
+ stderr=subprocess.DEVNULL
37
+ )
38
+
39
+ instance = ServerInstance(name, port, proc)
40
+ self.registry[name] = instance
41
+ return instance
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.5
2
+ Name: artin-server
3
+ Version: 1.0.0
4
+ Summary: High-performance background server orchestration engine.
5
+ Author: Artin
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.9
9
+ Description-Content-Type: text/markdown
10
+
11
+ # Artin Server Engine
12
+
13
+ High-performance local server orchestration library.
14
+
15
+ ## Installation
16
+ `pip install artin-server`
17
+
18
+ ## Usage
19
+ ```python
20
+ from artin_server import ArtinServerEngine
21
+
22
+ engine = ArtinServerEngine()
23
+ server = engine.spawn(name="main", directory="./public")
24
+ print(f"Server running on port {server.port}")
@@ -0,0 +1,6 @@
1
+ artin_server/__init__.py,sha256=PpAqyAlFkxlcFYZqXwrcvj5bUPEz9B4udNrr9rjemnk,68
2
+ artin_server/core.py,sha256=GNgYofhrxC32rXMZGQ-REGBCN-6XUBMYlBwjI874uok,1383
3
+ artin_server-1.0.0.dist-info/METADATA,sha256=bzOd1nyLkspwUDD-968XEjmFEfl6icNMkdkh36qF1C8,563
4
+ artin_server-1.0.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
5
+ artin_server-1.0.0.dist-info/licenses/LICENSE,sha256=DBeV11SHs7KybqHYCO_QuD5OJOgmBLisIlLpkqXr0cA,1083
6
+ artin_server-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.4
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Artin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.