Core Architecture & Invariant CI / validate (pull_request) Successful in 16s
- Declare pillow in pyproject.toml dependencies and ps.pillow in flake.nix runtimeDeps - Extend CaptureClient.__init__ with optional max_width and jpeg_quality keyword arguments - Add _recompress_jpeg helper preserving aspect ratio, never upscaling, defaulting quality to 75 when resizing, and raising TvError(SCREENSHOT_UNAVAILABLE) on corrupt image bytes - Compute frame_sha256, changed_since_last, and size_bytes on the final delivered image_bytes - Wire capture_max_width and capture_jpeg_quality into CaptureClient in create_mcp_server() - Add offline unit tests in tests/test_capture.py and tests/test_server.py
70 lines
1.5 KiB
Nix
70 lines
1.5 KiB
Nix
{
|
|
description = "LG Smart TV (webOS) MCP server and testing environment";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
};
|
|
|
|
outputs = { self, nixpkgs }:
|
|
let
|
|
system = "x86_64-linux";
|
|
pkgs = import nixpkgs { inherit system; };
|
|
ps = pkgs.python3Packages;
|
|
|
|
runtimeDeps = [
|
|
ps.websockets
|
|
ps.mcp
|
|
ps.pydantic
|
|
ps.asyncssh
|
|
ps.uvicorn
|
|
ps.pillow
|
|
];
|
|
|
|
testDeps = [
|
|
ps.httpx
|
|
ps.pytest
|
|
ps.pytest-asyncio
|
|
];
|
|
|
|
testTools = [
|
|
pkgs.systemd
|
|
];
|
|
|
|
pythonEnv = pkgs.python3.withPackages (_: runtimeDeps ++ testDeps);
|
|
in
|
|
{
|
|
packages.${system}.default = ps.buildPythonApplication {
|
|
pname = "lg-smtv-mcp";
|
|
version = "0.1.0";
|
|
src = ./.;
|
|
pyproject = true;
|
|
build-system = [ ps.setuptools ];
|
|
dependencies = runtimeDeps;
|
|
nativeCheckInputs = [
|
|
ps.pytestCheckHook
|
|
pkgs.ruff
|
|
pkgs.pyright
|
|
] ++ testDeps ++ testTools;
|
|
preCheck = ''
|
|
ruff check .
|
|
ruff format --check .
|
|
pyright
|
|
'';
|
|
};
|
|
|
|
devShells.${system}.default = pkgs.mkShell {
|
|
packages = [
|
|
pythonEnv
|
|
pkgs.pyright
|
|
pkgs.ruff
|
|
] ++ testTools;
|
|
shellHook = ''
|
|
export PYTHONPATH="$PWD/src:${PYTHONPATH:-}"
|
|
if [ -d .git ] && [ -d .githooks ]; then
|
|
git config core.hooksPath .githooks
|
|
fi
|
|
'';
|
|
};
|
|
};
|
|
}
|