add stub test, add pyproject.toml, add basic structure
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# nexus-sync
|
||||
|
||||
a utility that allows you to manage your computers.
|
||||
|
||||
*Main Idea*
|
||||
server can send to every client "what to do". Centralized control for all clients.
|
||||
|
||||
## Server-side
|
||||
|
||||
- (to future) works in docker container
|
||||
- accept connections on _some_ port with correct uuid from client
|
||||
- works via API requests
|
||||
- use _some_ database
|
||||
|
||||
## Client-side
|
||||
|
||||
- with _some_ period of time, send info to the server
|
||||
- if server want client to execute some command
|
||||
- decrease fetch time period
|
||||
- execute command
|
||||
- send result back to the server
|
||||
@@ -0,0 +1,28 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=75.0"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "nexus_sync"
|
||||
version = "0.1.0"
|
||||
description = "A utility that allows you to manage your computers from a centralized server."
|
||||
readme = "README.md"
|
||||
license = { file = "LICENSE" }
|
||||
requires-python = ">=3.11"
|
||||
dependencies = []
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"pytest>=8.0",
|
||||
"black>=24.0",
|
||||
]
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["src"]
|
||||
|
||||
[tool.black]
|
||||
line-length = 100
|
||||
target-version = ["py311"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["tests"]
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import shlex
|
||||
import subprocess
|
||||
from typing import Dict, Optional
|
||||
|
||||
|
||||
def run(command: str, stdin: Optional[str] = None) -> Dict[str, str]:
|
||||
process = _execute(command, stdin)
|
||||
|
||||
return {
|
||||
"stdout": process.stdout,
|
||||
"stderr": process.stderr,
|
||||
}
|
||||
|
||||
|
||||
def _parse_command(command: str) -> list[str]:
|
||||
# return command.split()
|
||||
return shlex.split(command)
|
||||
|
||||
|
||||
def _execute(command: str, stdin: Optional[str] = None) -> subprocess.CompletedProcess:
|
||||
parsed_command = _parse_command(command)
|
||||
result = subprocess.run(
|
||||
parsed_command, input=stdin, text=True, capture_output=True, shell=True
|
||||
)
|
||||
return result
|
||||
@@ -0,0 +1,6 @@
|
||||
def main() -> None:
|
||||
print("nexus-sync server")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,7 @@
|
||||
"""
|
||||
foobuzz test
|
||||
"""
|
||||
|
||||
|
||||
def test_foo():
|
||||
pass
|
||||
Reference in New Issue
Block a user