diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4e15341 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,59 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.{json,yml,yaml,props,targets,csproj,slnx,xml,toml}] +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false + +[*.cs] +# Namespaces and usings +csharp_style_namespace_declarations = file_scoped:warning +dotnet_sort_system_directives_first = true +dotnet_separate_import_directive_groups = false +dotnet_diagnostic.IDE0005.severity = warning +dotnet_diagnostic.IDE0161.severity = warning + +# Language preferences +csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion +csharp_style_var_elsewhere = false:suggestion +csharp_style_expression_bodied_methods = when_on_single_line:suggestion +csharp_style_expression_bodied_properties = true:suggestion +csharp_prefer_braces = when_multiline:suggestion +csharp_style_prefer_primary_constructors = true:suggestion +dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +dotnet_style_readonly_field = true:warning + +# Naming +dotnet_naming_rule.private_fields_underscore.symbols = private_fields +dotnet_naming_rule.private_fields_underscore.style = underscore_camel +dotnet_naming_rule.private_fields_underscore.severity = warning +dotnet_naming_symbols.private_fields.applicable_kinds = field +dotnet_naming_symbols.private_fields.applicable_accessibilities = private +dotnet_naming_style.underscore_camel.required_prefix = _ +dotnet_naming_style.underscore_camel.capitalization = camel_case + +dotnet_naming_rule.private_static_readonly.symbols = private_static_readonly_fields +dotnet_naming_rule.private_static_readonly.style = pascal_case +dotnet_naming_rule.private_static_readonly.severity = warning +dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private +dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = static, readonly +dotnet_naming_style.pascal_case.capitalization = pascal_case + +dotnet_naming_rule.private_const.symbols = private_const_fields +dotnet_naming_rule.private_const.style = pascal_case +dotnet_naming_rule.private_const.severity = warning +dotnet_naming_symbols.private_const_fields.applicable_kinds = field +dotnet_naming_symbols.private_const_fields.applicable_accessibilities = private +dotnet_naming_symbols.private_const_fields.required_modifiers = const diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0f8613a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,10 @@ +* text=auto eol=lf + +*.cmd text eol=crlf +*.bat text eol=crlf +*.ps1 text eol=crlf + +*.png binary +*.jpg binary +*.pdf binary +*.whl binary diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4bdb406 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,94 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + +jobs: + dotnet: + name: .NET (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v7 + + - uses: actions/setup-dotnet@v6 + with: + global-json-file: global.json + + # The integration tests build the psrunner wheel and create real Python environments with uv. + - uses: astral-sh/setup-uv@v10.3.0 + + - name: Restore + run: dotnet restore + + - name: Build + run: dotnet build --no-restore --configuration Release + + - name: Test + run: dotnet test --no-build --configuration Release + + format: + name: .NET format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - uses: actions/setup-dotnet@v6 + with: + global-json-file: global.json + + - name: Verify formatting + run: dotnet format --verify-no-changes + + python-sdk: + name: psrunner (${{ matrix.os }}, Python ${{ matrix.python }}) + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python: ['3.10', '3.11', '3.12', '3.13'] + include: + # Windows only on the default version to save Actions minutes. + - os: windows-latest + python: '3.12' + runs-on: ${{ matrix.os }} + defaults: + run: + working-directory: python/psrunner + steps: + - uses: actions/checkout@v7 + + - uses: astral-sh/setup-uv@v10.3.0 + with: + python-version: ${{ matrix.python }} + + - name: Install + run: uv sync --locked + + - name: Lint + run: | + uv run ruff check src tests + uv run ruff format --check src tests + + - name: Type check + run: uv run mypy + + - name: Test + run: uv run pytest diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..015da48 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,28 @@ + + + net10.0 + 14 + enable + enable + true + true + latest + true + true + + + + 0.1.0 + net0well + Copyright (c) 2026 net0well + MIT + https://github.com/net0well/PythonScriptRunner + https://github.com/net0well/PythonScriptRunner + git + true + true + true + snupkg + python;scripts;pipelines;runner;uv + + diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 0000000..8f016f7 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,20 @@ + + + true + + + + + + + + + + + + + + + + + diff --git a/PythonScriptRunner.slnx b/PythonScriptRunner.slnx new file mode 100644 index 0000000..a691e0f --- /dev/null +++ b/PythonScriptRunner.slnx @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/README.md b/README.md index 2da442a..f524ee0 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,86 @@ # PythonScriptRunner -Biblioteca .NET 10 para executar Python de forma tipada, encadeável e observável: etapas (Stages) -com contrato de entrada/saída, trilhas (Pipelines), execução assíncrona com RabbitMQ, agendamento +Biblioteca .NET 10 para executar Python de forma tipada, encadeável e observável: etapas (**Stages**) +com contrato de entrada/saída, trilhas (**Pipelines**), execução assíncrona com RabbitMQ, agendamento cron e painel Vue opcional. -> Projeto em desenvolvimento. +> Projeto em desenvolvimento. Esta versão entrega o **Core Runner** (execução síncrona de Stages) e o +> SDK Python **`psrunner`**. + +## Como funciona + +Cada Stage declara suas entradas e saídas (12 tipos: `number`, `integer`, `decimal`, `string`, `bool`, +`date`, `datetime`, `enum`, `json`, `table`, `file`, `list`) e tem exatamente um script Python. +O runner valida as entradas, executa o script num processo isolado (ambiente limpo, timeout, limite +de memória, segredos injetados só nele), valida as saídas e devolve o resultado tipado. + +```python +# stages/progressao-termos/script.py +from psrunner import stage + +@stage +def run(inputs, ctx): + a1, razao, n = inputs["a1"], inputs["razao"], inputs["n"] + termos = [a1 * razao**i for i in range(n)] + ctx.log.info("gerados %d termos", n) + return {"termos": termos} +``` + +```jsonc +// stages/progressao-termos/stage.json +{ + "$schema": "https://raw.githubusercontent.com/net0well/PythonScriptRunner/main/schemas/stage.v1.json", + "key": "progressao-termos", + "version": 1, + "name": "Termos de progressão", + "inputs": [ + { "name": "a1", "type": "number" }, + { "name": "razao", "type": "number" }, + { "name": "n", "type": "integer" } + ], + "outputs": [ { "name": "termos", "type": "list", "itemType": "number" } ] +} +``` + +```csharp +builder.Services + .AddPythonScriptRunner() + .AddFileCatalog("./psr"); // pasta com stages//stage.json + +// ... +await using var result = await runner.RunStageAsync("progressao-termos", new { a1 = 1, razao = 2, n = 4 }); +result.EnsureSuccess(); +double[] termos = result.GetOutput("termos"); // [1, 2, 4, 8] +``` + +Stages também podem ser definidos em C# (`AddStage("chave", s => s.Script(...).Input(...).Output(...))`) +e testados localmente com pytest pelo `psrunner.testing.run_stage`, sem .NET. + +## Requisitos + +- .NET 10 SDK +- [uv](https://docs.astral.sh/uv/) no PATH (cria e cacheia um ambiente Python por conjunto de dependências) + +## Estrutura + +| Pasta | Conteúdo | +|-------|----------| +| `src/PythonScriptRunner.Abstractions` | contratos públicos (tipos de campo, `StageDefinition`, `RunResult`, `PsrFile`, interfaces) | +| `src/PythonScriptRunner.Core` | catálogos (código e pasta), validação, ambientes uv, executor de processos, runner | +| `python/psrunner` | SDK Python (`@stage`, `Context`, `File`, `StageError`, `psrunner.testing`, CLI) | +| `schemas` | JSON Schema do `stage.json` | +| `tests` | testes .NET (unitários e de integração com Python real) | + +## Desenvolvimento + +```bash +dotnet build +dotnet test --project tests/PythonScriptRunner.Core.Tests + +cd python/psrunner +uv sync +uv run pytest +``` ## Licença diff --git a/global.json b/global.json new file mode 100644 index 0000000..a0703e8 --- /dev/null +++ b/global.json @@ -0,0 +1,9 @@ +{ + "sdk": { + "version": "10.0.400", + "rollForward": "latestFeature" + }, + "test": { + "runner": "Microsoft.Testing.Platform" + } +} diff --git a/python/psrunner/README.md b/python/psrunner/README.md new file mode 100644 index 0000000..ea5dca5 --- /dev/null +++ b/python/psrunner/README.md @@ -0,0 +1,31 @@ +# psrunner + +Python SDK for [PythonScriptRunner](https://github.com/net0well/PythonScriptRunner) stages. + +A stage is one Python script with typed inputs and outputs. The .NET runner validates the inputs, +runs the script in an isolated process and validates the outputs. `psrunner` handles the protocol, +so the script only contains the logic: + +```python +from psrunner import stage + +@stage +def run(inputs, ctx): + a1, ratio, n = inputs["a1"], inputs["ratio"], inputs["n"] + terms = [a1 * ratio**i for i in range(n)] + ctx.log.info("generated %d terms", n) + return {"terms": terms} +``` + +Test it locally with pytest, without .NET: + +```python +from psrunner.testing import run_stage + +def test_terms(): + result = run_stage("stages/terms/script.py", {"a1": 1, "ratio": 2, "n": 4}, + stage_json="stages/terms/stage.json") + assert result.outputs == {"terms": [1, 2, 4, 8]} +``` + +Install the `pandas` extra to receive `table` inputs as `pandas.DataFrame`: `pip install psrunner[pandas]`. diff --git a/python/psrunner/pyproject.toml b/python/psrunner/pyproject.toml new file mode 100644 index 0000000..cdadafa --- /dev/null +++ b/python/psrunner/pyproject.toml @@ -0,0 +1,69 @@ +[build-system] +requires = ["hatchling>=1.27"] +build-backend = "hatchling.build" + +[project] +name = "psrunner" +dynamic = ["version"] +description = "Python SDK for PythonScriptRunner stages: typed inputs and outputs, files, secrets and logging." +readme = "README.md" +requires-python = ">=3.10" +license = "MIT" +authors = [{ name = "net0well" }] +keywords = ["pythonscriptrunner", "dotnet", "pipeline", "stage"] +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Typing :: Typed", +] +dependencies = [] + +[project.optional-dependencies] +pandas = ["pandas>=2.0"] + +[project.urls] +Repository = "https://github.com/net0well/PythonScriptRunner" + +[project.scripts] +psrunner = "psrunner.cli:main" + +[dependency-groups] +dev = [ + "pytest>=8.3", + "mypy>=1.13", + "ruff>=0.8", + "pandas>=2.0", +] + +[tool.hatch.version] +path = "src/psrunner/_version.py" + +[tool.hatch.build.targets.wheel] +packages = ["src/psrunner"] + +[tool.pytest.ini_options] +testpaths = ["tests"] +addopts = "-ra" + +[tool.mypy] +strict = true +python_version = "3.10" +files = ["src"] + +[[tool.mypy.overrides]] +module = ["pandas", "pandas.*", "numpy", "numpy.*"] +ignore_missing_imports = true + +[tool.ruff] +line-length = 100 +target-version = "py310" + +[tool.ruff.lint] +select = ["E", "F", "W", "I", "UP", "B", "SIM", "RUF"] diff --git a/python/psrunner/src/psrunner/__init__.py b/python/psrunner/src/psrunner/__init__.py new file mode 100644 index 0000000..b9bfad4 --- /dev/null +++ b/python/psrunner/src/psrunner/__init__.py @@ -0,0 +1,10 @@ +"""Python SDK for PythonScriptRunner stages.""" + +from psrunner._version import __version__ +from psrunner.context import Context +from psrunner.errors import StageError +from psrunner.files import File +from psrunner.protocol import PROTOCOL_VERSION +from psrunner.stage import stage + +__all__ = ["PROTOCOL_VERSION", "Context", "File", "StageError", "__version__", "stage"] diff --git a/python/psrunner/src/psrunner/__main__.py b/python/psrunner/src/psrunner/__main__.py new file mode 100644 index 0000000..8710557 --- /dev/null +++ b/python/psrunner/src/psrunner/__main__.py @@ -0,0 +1,3 @@ +from psrunner.cli import main + +raise SystemExit(main()) diff --git a/python/psrunner/src/psrunner/_execution.py b/python/psrunner/src/psrunner/_execution.py new file mode 100644 index 0000000..3891818 --- /dev/null +++ b/python/psrunner/src/psrunner/_execution.py @@ -0,0 +1,89 @@ +"""Shared helpers to call the stage function and classify failures.""" + +from __future__ import annotations + +import asyncio +import inspect +import traceback +from collections.abc import Callable +from pathlib import Path +from typing import Any + +from psrunner.context import Context +from psrunner.errors import ContractError, ScriptLoadError, StageError +from psrunner.protocol import KIND_MEMORY_LIMIT, KIND_SCRIPT_ERROR + +_PACKAGE_DIR = str(Path(__file__).resolve().parent) + + +def call_stage(fn: Callable[..., Any], inputs: dict[str, Any], ctx: Context) -> Any: + """Calls ``fn(inputs, ctx)``; coroutines (``async def run``) are awaited.""" + result = fn(inputs, ctx) + if inspect.iscoroutine(result): + result = asyncio.run(result) + return result + + +def _is_internal(filename: str) -> bool: + if filename.startswith(" str: + """Traceback without the SDK's own frames, so it points at the user script.""" + frames = [f for f in traceback.extract_tb(exc.__traceback__) if not _is_internal(f.filename)] + lines = ["Traceback (most recent call last):\n"] + lines += traceback.format_list(frames) + lines += traceback.format_exception_only(type(exc), exc) + return "".join(lines) + + +def classify_exception(exc: BaseException) -> dict[str, Any]: + """Maps an exception to the protocol error object.""" + if isinstance(exc, StageError): + error: dict[str, Any] = { + "kind": KIND_SCRIPT_ERROR, + "code": exc.code, + "message": exc.message, + "traceback": user_traceback(exc), + } + if exc.details is not None: + error["details"] = exc.details + return error + if isinstance(exc, ContractError): + return {"kind": exc.kind, "code": exc.code, "message": exc.message} + if isinstance(exc, ScriptLoadError): + error = {"kind": KIND_SCRIPT_ERROR, "code": exc.code, "message": exc.message} + if exc.__cause__ is not None and not isinstance(exc.__cause__, SyntaxError): + error["traceback"] = user_traceback(exc.__cause__) + return error + if isinstance(exc, MemoryError): + return { + "kind": KIND_MEMORY_LIMIT, + "code": "MEMORY_LIMIT_EXCEEDED", + "message": "The script exceeded its memory limit.", + } + if isinstance(exc, SystemExit): + return { + "kind": KIND_SCRIPT_ERROR, + "code": "SCRIPT_EXITED", + "message": ( + f"The script called sys.exit({exc.code!r}); return a dict or raise StageError." + ), + } + if isinstance(exc, KeyboardInterrupt): + return { + "kind": KIND_SCRIPT_ERROR, + "code": "INTERRUPTED", + "message": "The script was interrupted.", + } + return { + "kind": KIND_SCRIPT_ERROR, + "code": None, + "message": f"{type(exc).__name__}: {exc}", + "traceback": user_traceback(exc), + } diff --git a/python/psrunner/src/psrunner/_version.py b/python/psrunner/src/psrunner/_version.py new file mode 100644 index 0000000..3dc1f76 --- /dev/null +++ b/python/psrunner/src/psrunner/_version.py @@ -0,0 +1 @@ +__version__ = "0.1.0" diff --git a/python/psrunner/src/psrunner/cli.py b/python/psrunner/src/psrunner/cli.py new file mode 100644 index 0000000..971c789 --- /dev/null +++ b/python/psrunner/src/psrunner/cli.py @@ -0,0 +1,177 @@ +"""Command line helpers for stage authors. + +``python -m psrunner validate `` + Validates ``stage.json`` and checks that the script declares exactly one ``@stage``. + +``python -m psrunner run --input sample.json [--secret NAME=VALUE ...]`` + Runs the stage locally with the real protocol (separate process, temporary work folder). + File inputs in the sample are written as ``{"$path": "relative/to/sample.json"}``. +""" + +from __future__ import annotations + +import argparse +import json +import os +import shutil +import subprocess +import sys +import tempfile +import uuid +from collections.abc import Sequence +from pathlib import Path +from typing import Any + +from psrunner.errors import ScriptLoadError +from psrunner.manifest import Manifest, ManifestError, load_manifest +from psrunner.protocol import ( + ENV_INPUT, + ENV_MEMORY_LIMIT_MB, + ENV_OUTPUT, + ENV_PROTOCOL, + ENV_SCRIPT, + ENV_SECRET_PREFIX, + ENV_WORK_DIR, + PROTOCOL_VERSION, +) +from psrunner.stage import load_stage_function +from psrunner.testing import _copy_input_files + + +def _validate(folder: Path) -> int: + try: + manifest = load_manifest(folder) + load_stage_function(manifest.script_path) + except ManifestError as exc: + print(f"Invalid manifest {exc.path}:", file=sys.stderr) + for error in exc.errors: + print(f" - {error}", file=sys.stderr) + return 1 + except ScriptLoadError as exc: + print(f"Invalid script: [{exc.code}] {exc.message}", file=sys.stderr) + return 1 + print( + f"OK: {manifest.key}@{manifest.version} " + f"({len(manifest.inputs)} inputs, {len(manifest.outputs)} outputs)" + ) + return 0 + + +def _resolve_sample(sample: dict[str, Any], sample_dir: Path, work_dir: Path) -> dict[str, Any]: + resolved: dict[str, Any] = {} + for name, value in sample.items(): + if isinstance(value, dict) and "$path" in value: + resolved[name] = _copy_input_files(name, sample_dir / value["$path"], work_dir) + elif ( + isinstance(value, list) + and value + and all(isinstance(v, dict) and "$path" in v for v in value) + ): + resolved[name] = _copy_input_files( + name, [sample_dir / v["$path"] for v in value], work_dir + ) + else: + resolved[name] = value + return resolved + + +def _run(folder: Path, input_file: Path | None, secrets: Sequence[str], keep: bool) -> int: + try: + manifest: Manifest = load_manifest(folder) + except ManifestError as exc: + print(f"Invalid manifest {exc.path}: {'; '.join(exc.errors)}", file=sys.stderr) + return 1 + + work_dir = Path(tempfile.mkdtemp(prefix="psrunner-run-")) + for sub in ("in", "out", "tmp"): + (work_dir / sub).mkdir() + + sample: dict[str, Any] = {} + if input_file is not None: + sample = json.loads(input_file.read_text(encoding="utf-8")) + inputs = _resolve_sample( + sample, (input_file or folder).parent if input_file else folder, work_dir + ) + + document = { + "protocol": PROTOCOL_VERSION, + "context": { + "runId": uuid.uuid4().hex, + "stepKey": manifest.key, + "attempt": 1, + "stage": {"key": manifest.key, "version": manifest.version}, + "isTest": True, + "inputFields": manifest.raw["inputs"], + "outputFields": manifest.raw["outputs"], + }, + "inputs": inputs, + } + (work_dir / "input.json").write_text(json.dumps(document, ensure_ascii=False), encoding="utf-8") + + env = {key: value for key, value in os.environ.items() if key in {"PATH", "SYSTEMROOT", "LANG"}} + env.update( + { + "TEMP": str(work_dir / "tmp"), + "TMP": str(work_dir / "tmp"), + ENV_PROTOCOL: str(PROTOCOL_VERSION), + ENV_INPUT: str(work_dir / "input.json"), + ENV_OUTPUT: str(work_dir / "output.json"), + ENV_WORK_DIR: str(work_dir), + ENV_SCRIPT: str(manifest.script_path.resolve()), + ENV_MEMORY_LIMIT_MB: str(manifest.raw.get("memoryLimitMb", 0)), + } + ) + for item in secrets: + name, _, value = item.partition("=") + env[f"{ENV_SECRET_PREFIX}{name}"] = value + + completed = subprocess.run( + [sys.executable, "-I", "-X", "utf8", "-m", "psrunner.host"], + cwd=work_dir, + env=env, + capture_output=True, + text=True, + encoding="utf-8", + errors="replace", + check=False, + ) + if completed.stdout: + print("--- stdout ---") + print(completed.stdout.rstrip()) + if completed.stderr: + print("--- stderr ---") + print(completed.stderr.rstrip()) + + output_path = work_dir / "output.json" + if not output_path.exists(): + print( + f"Process exited with code {completed.returncode} without output.json.", file=sys.stderr + ) + return 1 + output = json.loads(output_path.read_text(encoding="utf-8")) + print("--- output.json ---") + print(json.dumps(output, indent=2, ensure_ascii=False)) + if keep: + print(f"Work folder: {work_dir}") + else: + shutil.rmtree(work_dir, ignore_errors=True) + return 0 if output.get("status") == "ok" else 1 + + +def main(argv: Sequence[str] | None = None) -> int: + parser = argparse.ArgumentParser(prog="psrunner", description="PythonScriptRunner stage tools") + commands = parser.add_subparsers(dest="command", required=True) + + validate = commands.add_parser("validate", help="validate stage.json and the script") + validate.add_argument("folder", type=Path) + + run = commands.add_parser("run", help="run a stage locally with the real protocol") + run.add_argument("folder", type=Path) + run.add_argument("--input", type=Path, help="JSON file with the inputs") + run.add_argument("--secret", action="append", default=[], help="NAME=VALUE (repeatable)") + run.add_argument("--keep", action="store_true", help="print the work folder path") + + args = parser.parse_args(argv) + if args.command == "validate": + return _validate(args.folder) + return _run(args.folder, args.input, args.secret, args.keep) diff --git a/python/psrunner/src/psrunner/context.py b/python/psrunner/src/psrunner/context.py new file mode 100644 index 0000000..f1071a8 --- /dev/null +++ b/python/psrunner/src/psrunner/context.py @@ -0,0 +1,121 @@ +"""Execution context handed to the stage function.""" + +from __future__ import annotations + +import logging +from collections.abc import Iterator, Mapping +from pathlib import Path + +from psrunner.files import File + + +class _Secrets(Mapping[str, str]): + """Read-only view of the secrets declared by the stage.""" + + def __init__(self, values: Mapping[str, str]) -> None: + self._values = dict(values) + + def __getitem__(self, key: str) -> str: + try: + return self._values[key] + except KeyError: + declared = ", ".join(sorted(self._values)) or "(none)" + raise KeyError( + f"Secret '{key}' was not declared by this stage. Declared secrets: {declared}." + ) from None + + def __iter__(self) -> Iterator[str]: + return iter(self._values) + + def __len__(self) -> int: + return len(self._values) + + def __repr__(self) -> str: + return f"" + + +class Context: + """Metadata and helpers available to the stage while it runs.""" + + def __init__( + self, + *, + work_dir: Path, + run_id: str = "", + step_key: str = "", + attempt: int = 1, + stage_key: str = "", + stage_version: int = 0, + is_test: bool = False, + secrets: Mapping[str, str] | None = None, + logger: logging.Logger | None = None, + ) -> None: + self._work_dir = work_dir + self._run_id = run_id + self._step_key = step_key + self._attempt = attempt + self._stage_key = stage_key + self._stage_version = stage_version + self._is_test = is_test + self._secrets = _Secrets(secrets or {}) + self._log = logger or logging.getLogger("psrunner.stage") + + @property + def run_id(self) -> str: + return self._run_id + + @property + def step_key(self) -> str: + return self._step_key + + @property + def attempt(self) -> int: + return self._attempt + + @property + def stage_key(self) -> str: + return self._stage_key + + @property + def stage_version(self) -> int: + return self._stage_version + + @property + def is_test(self) -> bool: + return self._is_test + + @property + def work_dir(self) -> Path: + return self._work_dir + + @property + def out_dir(self) -> Path: + return self._work_dir / "out" + + @property + def tmp_dir(self) -> Path: + return self._work_dir / "tmp" + + @property + def log(self) -> logging.Logger: + return self._log + + @property + def secrets(self) -> Mapping[str, str]: + return self._secrets + + def new_file(self, name: str, content_type: str | None = None) -> File: + """Reserves an output file in ``out/``; the script writes to ``File.path``.""" + if ( + not name + or name in {".", ".."} + or "/" in name + or "\\" in name + or Path(name).name != name + ): + raise ValueError(f"Invalid output file name: {name!r}. Use a plain file name.") + self.out_dir.mkdir(parents=True, exist_ok=True) + path = self.out_dir / name + if path.exists(): + raise FileExistsError(f"Output file '{name}' already exists.") + return File(path, name, content_type) diff --git a/python/psrunner/src/psrunner/convert.py b/python/psrunner/src/psrunner/convert.py new file mode 100644 index 0000000..db47c56 --- /dev/null +++ b/python/psrunner/src/psrunner/convert.py @@ -0,0 +1,447 @@ +"""Conversion between the wire format (JSON) and Python values, with contract validation.""" + +from __future__ import annotations + +import importlib.util +import json +import math +import os +import re +from collections.abc import Mapping, Sequence +from datetime import date, datetime, timedelta, timezone +from decimal import Decimal, InvalidOperation +from pathlib import Path, PurePath +from typing import Any + +from psrunner.errors import ContractError +from psrunner.fields import FieldSpec +from psrunner.files import File, guess_content_type +from psrunner.protocol import FILE_MARKER, KIND_INPUT_VALIDATION, KIND_OUTPUT_CONTRACT + +_DATETIME = re.compile( + r"^(?P\d{4}-\d{2}-\d{2})[T ](?P\d{2}):(?P\d{2})" + r"(?::(?P\d{2})(?:[.,](?P\d+))?)?" + r"(?PZ|z|[+-]\d{2}:?\d{2})?$" +) + +_pandas_loaded = False +_pandas: Any = None + + +def get_pandas() -> Any: + """Returns the pandas module when installed (imported lazily, it is slow to import).""" + global _pandas_loaded, _pandas + if not _pandas_loaded: + _pandas_loaded = True + if importlib.util.find_spec("pandas") is not None: + import pandas + + _pandas = pandas + return _pandas + + +def _error(kind: str, code: str, path: str, message: str) -> ContractError: + return ContractError(kind, code, f"'{path}': {message}") + + +def _type_name(value: Any) -> str: + return type(value).__name__ + + +# --------------------------------------------------------------------------- +# Wire -> Python (inputs received from the runner) +# --------------------------------------------------------------------------- + + +def inputs_to_python( + raw: Mapping[str, Any], specs: Sequence[FieldSpec], work_dir: Path +) -> dict[str, Any]: + """Converts wire inputs to Python values. Absent optional inputs become ``None``.""" + declared = {spec.name for spec in specs} + undeclared = sorted(name for name in raw if name not in declared) + if undeclared: + raise ContractError( + KIND_INPUT_VALIDATION, + "UNDECLARED_INPUT", + f"Inputs not declared by the stage: {', '.join(undeclared)}.", + ) + + result: dict[str, Any] = {} + for spec in specs: + value = raw.get(spec.name) + if value is None and spec.has_default: + value = spec.default + if value is None: + if spec.required: + raise _error( + KIND_INPUT_VALIDATION, + "MISSING_REQUIRED_INPUT", + spec.name, + "required input is missing", + ) + result[spec.name] = None + continue + result[spec.name] = wire_to_python(value, spec, work_dir, spec.name) + return result + + +def wire_to_python(value: Any, spec: FieldSpec, work_dir: Path, path: str) -> Any: + kind = KIND_INPUT_VALIDATION + t = spec.type + if t == "number": + if isinstance(value, bool) or not isinstance(value, (int, float)): + raise _error(kind, "TYPE_MISMATCH", path, f"expected number, got {_type_name(value)}") + number = float(value) + if not math.isfinite(number): + raise _error(kind, "NON_FINITE_NUMBER", path, "number must be finite") + return number + if t == "integer": + if isinstance(value, bool) or not isinstance(value, int): + raise _error(kind, "TYPE_MISMATCH", path, f"expected integer, got {_type_name(value)}") + return value + if t == "decimal": + return _parse_decimal(value, kind, path) + if t == "string": + if not isinstance(value, str): + raise _error(kind, "TYPE_MISMATCH", path, f"expected string, got {_type_name(value)}") + return value + if t == "bool": + if not isinstance(value, bool): + raise _error(kind, "TYPE_MISMATCH", path, f"expected bool, got {_type_name(value)}") + return value + if t == "date": + return _parse_date(value, kind, path) + if t == "datetime": + return _parse_datetime(value, kind, path) + if t == "enum": + return _check_enum(value, spec, kind, path) + if t == "json": + return value + if t == "table": + return _table_to_python(value, spec, kind, path) + if t == "file": + return _file_from_wire(value, work_dir, kind, path) + if t == "list": + if not isinstance(value, list): + raise _error(kind, "TYPE_MISMATCH", path, f"expected list, got {_type_name(value)}") + item = spec.item_spec() + return [wire_to_python(v, item, work_dir, f"{path}[{i}]") for i, v in enumerate(value)] + raise _error(kind, "UNKNOWN_TYPE", path, f"unknown field type '{t}'") + + +def _parse_decimal(value: Any, kind: str, path: str) -> Decimal: + if isinstance(value, bool) or not isinstance(value, (str, int, Decimal)): + raise _error( + kind, "TYPE_MISMATCH", path, f"expected decimal string, got {_type_name(value)}" + ) + try: + number = Decimal(str(value).strip()) + except InvalidOperation: + raise _error(kind, "INVALID_DECIMAL", path, f"'{value}' is not a valid decimal") from None + if not number.is_finite(): + raise _error(kind, "NON_FINITE_NUMBER", path, "decimal must be finite") + return number + + +def _parse_date(value: Any, kind: str, path: str) -> date: + if not isinstance(value, str): + raise _error( + kind, "TYPE_MISMATCH", path, f"expected ISO date string, got {_type_name(value)}" + ) + try: + return date.fromisoformat(value) + except ValueError: + raise _error(kind, "INVALID_DATE", path, f"'{value}' is not an ISO 8601 date") from None + + +def parse_datetime(text: str) -> datetime | None: + """Parses ISO 8601 date-times with any fraction length on every supported Python version.""" + match = _DATETIME.match(text) + if match is None: + return None + year, month, day = (int(p) for p in match["date"].split("-")) + fraction = (match["f"] or "0")[:6].ljust(6, "0") + tz_text = match["tz"] + tzinfo: timezone | None = None + if tz_text: + if tz_text in {"Z", "z"}: + tzinfo = timezone.utc + else: + sign = -1 if tz_text[0] == "-" else 1 + digits = tz_text[1:].replace(":", "") + offset = timedelta(hours=int(digits[:2]), minutes=int(digits[2:])) + tzinfo = timezone(sign * offset) + try: + return datetime( + year, + month, + day, + int(match["h"]), + int(match["m"]), + int(match["s"] or 0), + int(fraction), + tzinfo=tzinfo, + ) + except ValueError: + return None + + +def _parse_datetime(value: Any, kind: str, path: str) -> datetime: + if not isinstance(value, str): + raise _error( + kind, "TYPE_MISMATCH", path, f"expected ISO date-time string, got {_type_name(value)}" + ) + parsed = parse_datetime(value) + if parsed is None: + raise _error(kind, "INVALID_DATETIME", path, f"'{value}' is not an ISO 8601 date-time") + if parsed.tzinfo is None: + raise _error(kind, "NAIVE_DATETIME", path, "date-time must include a UTC offset") + return parsed + + +def _check_enum(value: Any, spec: FieldSpec, kind: str, path: str) -> str: + if not isinstance(value, str): + raise _error(kind, "TYPE_MISMATCH", path, f"expected enum string, got {_type_name(value)}") + allowed = spec.enum_values or () + if value not in allowed: + raise _error( + kind, "ENUM_VALUE_INVALID", path, f"'{value}' is not one of: {', '.join(allowed)}" + ) + return value + + +def _table_to_python(value: Any, spec: FieldSpec, kind: str, path: str) -> Any: + if not isinstance(value, list) or not all(isinstance(row, Mapping) for row in value): + raise _error(kind, "TYPE_MISMATCH", path, "expected a list of objects (records)") + rows: list[dict[str, Any]] = [dict(row) for row in value] + if spec.columns: + for index, row in enumerate(rows): + for column in spec.columns: + cell_path = f"{path}[{index}].{column.name}" + if column.name not in row: + raise _error(kind, "MISSING_COLUMN", cell_path, "declared column is missing") + cell = row[column.name] + if cell is not None: + row[column.name] = wire_to_python( + cell, FieldSpec(name=column.name, type=column.type), Path("."), cell_path + ) + pandas = get_pandas() + if pandas is None: + return rows + columns = [c.name for c in spec.columns] if spec.columns else None + if columns is not None: + extra = [k for row in rows for k in row if k not in columns] + columns += list(dict.fromkeys(extra)) + return pandas.DataFrame.from_records(rows, columns=columns) + + +def _file_from_wire(value: Any, work_dir: Path, kind: str, path: str) -> File: + info = value.get(FILE_MARKER) if isinstance(value, Mapping) else None + if not isinstance(info, Mapping) or not isinstance(info.get("path"), str): + raise _error(kind, "TYPE_MISMATCH", path, "expected a file reference") + return File( + work_dir / info["path"], + info.get("name"), + info.get("contentType"), + size=info.get("size"), + sha256=info.get("sha256"), + ) + + +# --------------------------------------------------------------------------- +# Python -> wire (outputs produced by the script) +# --------------------------------------------------------------------------- + + +def outputs_to_wire(result: Any, specs: Sequence[FieldSpec], work_dir: Path) -> dict[str, Any]: + """Validates the dict returned by ``run()`` against the declared outputs.""" + kind = KIND_OUTPUT_CONTRACT + if not isinstance(result, Mapping): + raise ContractError( + kind, "OUTPUT_NOT_A_DICT", f"run() must return a dict, got {_type_name(result)}." + ) + declared = {spec.name for spec in specs} + undeclared = sorted(str(name) for name in result if name not in declared) + if undeclared: + raise ContractError( + kind, + "UNDECLARED_OUTPUT", + f"Outputs not declared by the stage: {', '.join(undeclared)}.", + ) + + wire: dict[str, Any] = {} + for spec in specs: + value = result.get(spec.name) + if value is None: + if spec.required: + raise _error( + kind, "MISSING_REQUIRED_OUTPUT", spec.name, "required output is missing" + ) + continue + wire[spec.name] = python_to_wire(value, spec, work_dir, spec.name, kind) + return wire + + +def _unwrap_numpy(value: Any) -> Any: + if type(value).__module__ == "numpy" and hasattr(value, "item"): + return value.item() + return value + + +def python_to_wire(value: Any, spec: FieldSpec, work_dir: Path, path: str, kind: str) -> Any: + value = _unwrap_numpy(value) + t = spec.type + if t == "number": + if isinstance(value, bool) or not isinstance(value, (int, float)): + raise _error(kind, "TYPE_MISMATCH", path, f"expected number, got {_type_name(value)}") + if isinstance(value, float) and not math.isfinite(value): + raise _error(kind, "NON_FINITE_NUMBER", path, "number must be finite (no NaN/Infinity)") + return value + if t == "integer": + if isinstance(value, bool) or not isinstance(value, int): + raise _error(kind, "TYPE_MISMATCH", path, f"expected integer, got {_type_name(value)}") + return value + if t == "decimal": + if isinstance(value, float): + raise _error( + kind, "TYPE_MISMATCH", path, "expected Decimal, int or str; float loses precision" + ) + return format(_parse_decimal(value, kind, path), "f") + if t == "string": + if not isinstance(value, str): + raise _error(kind, "TYPE_MISMATCH", path, f"expected string, got {_type_name(value)}") + return value + if t == "bool": + if not isinstance(value, bool): + raise _error(kind, "TYPE_MISMATCH", path, f"expected bool, got {_type_name(value)}") + return value + if t == "date": + if isinstance(value, datetime) or not isinstance(value, date): + raise _error(kind, "TYPE_MISMATCH", path, f"expected date, got {_type_name(value)}") + return value.isoformat() + if t == "datetime": + if not isinstance(value, datetime): + raise _error(kind, "TYPE_MISMATCH", path, f"expected datetime, got {_type_name(value)}") + if value.tzinfo is None or value.utcoffset() is None: + raise _error(kind, "NAIVE_DATETIME", path, "datetime must be timezone-aware") + return value.isoformat() + if t == "enum": + return _check_enum(value, spec, kind, path) + if t == "json": + _ensure_json(value, kind, path) + return value + if t == "table": + return _table_to_wire(value, spec, work_dir, kind, path) + if t == "file": + return _file_to_wire(value, work_dir, kind, path) + if t == "list": + if isinstance(value, (str, bytes, Mapping)) or not isinstance(value, (list, tuple)): + raise _error(kind, "TYPE_MISMATCH", path, f"expected list, got {_type_name(value)}") + item = spec.item_spec() + return [ + python_to_wire(v, item, work_dir, f"{path}[{i}]", kind) for i, v in enumerate(value) + ] + raise _error(kind, "UNKNOWN_TYPE", path, f"unknown field type '{t}'") + + +def _ensure_json(value: Any, kind: str, path: str) -> None: + try: + json.dumps(value, allow_nan=False) + except (TypeError, ValueError) as exc: + raise _error(kind, "NOT_JSON_SERIALIZABLE", path, str(exc)) from None + + +def _table_to_wire(value: Any, spec: FieldSpec, work_dir: Path, kind: str, path: str) -> Any: + pandas = get_pandas() + if pandas is not None and isinstance(value, pandas.DataFrame): + rows: list[Any] = value.to_dict(orient="records") + elif isinstance(value, (list, tuple)): + rows = list(value) + else: + raise _error( + kind, + "TYPE_MISMATCH", + path, + f"expected DataFrame or list of dicts, got {_type_name(value)}", + ) + + column_types = {c.name: c.type for c in spec.columns} if spec.columns else {} + wire_rows: list[dict[str, Any]] = [] + for index, row in enumerate(rows): + row_path = f"{path}[{index}]" + if not isinstance(row, Mapping): + raise _error(kind, "TYPE_MISMATCH", row_path, "each row must be a dict") + missing = [name for name in column_types if name not in row] + if missing: + raise _error(kind, "MISSING_COLUMN", row_path, f"missing columns: {', '.join(missing)}") + wire_rows.append( + { + str(name): _cell_to_wire( + cell, column_types.get(str(name)), work_dir, kind, f"{row_path}.{name}" + ) + for name, cell in row.items() + } + ) + return wire_rows + + +def _is_missing(value: Any) -> bool: + if value is None: + return True + if isinstance(value, float) and math.isnan(value): + return True + pandas = get_pandas() + return pandas is not None and value is pandas.NaT + + +def _cell_to_wire(value: Any, column_type: str | None, work_dir: Path, kind: str, path: str) -> Any: + value = _unwrap_numpy(value) + if _is_missing(value): + return None + if hasattr(value, "to_pydatetime"): + value = value.to_pydatetime() + if column_type is not None: + if column_type == "date" and isinstance(value, datetime): + value = value.date() + return python_to_wire(value, FieldSpec(name=path, type=column_type), work_dir, path, kind) + if isinstance(value, Decimal): + return format(value, "f") + if isinstance(value, (date, datetime)): + return value.isoformat() + _ensure_json(value, kind, path) + return value + + +def _file_to_wire(value: Any, work_dir: Path, kind: str, path: str) -> dict[str, Any]: + if isinstance(value, File): + file_path, name, content_type = value.path, value.name, value.content_type + elif isinstance(value, (PurePath, os.PathLike)): + file_path = Path(value) + name = file_path.name + content_type = guess_content_type(name) + else: + raise _error(kind, "TYPE_MISMATCH", path, f"expected File or Path, got {_type_name(value)}") + + full = Path(file_path) + if not full.is_absolute(): + full = work_dir / full + out_dir = (work_dir / "out").resolve() + if full.is_symlink(): + raise _error(kind, "OUTPUT_FILE_OUTSIDE_OUT", path, "symbolic links are not allowed") + try: + resolved = full.resolve(strict=True) + except (FileNotFoundError, OSError): + raise _error( + kind, "OUTPUT_FILE_MISSING", path, f"file was not written: {full.name}" + ) from None + if not resolved.is_relative_to(out_dir): + raise _error( + kind, + "OUTPUT_FILE_OUTSIDE_OUT", + path, + "output files must be created inside out/ (use ctx.new_file)", + ) + if not resolved.is_file(): + raise _error(kind, "OUTPUT_FILE_MISSING", path, f"not a regular file: {full.name}") + relative = resolved.relative_to(work_dir.resolve()).as_posix() + return {FILE_MARKER: {"path": relative, "name": name, "contentType": content_type}} diff --git a/python/psrunner/src/psrunner/errors.py b/python/psrunner/src/psrunner/errors.py new file mode 100644 index 0000000..ef62cd9 --- /dev/null +++ b/python/psrunner/src/psrunner/errors.py @@ -0,0 +1,39 @@ +"""Errors raised by stage scripts and by the SDK.""" + +from __future__ import annotations + +from typing import Any + + +class StageError(Exception): + """Business error raised by a stage script. + + The runner reports it as ``ScriptError`` with the given ``code`` so callers can react to it. + """ + + def __init__( + self, message: str, *, code: str | None = None, details: dict[str, Any] | None = None + ) -> None: + super().__init__(message) + self.message = message + self.code = code + self.details = details + + +class ContractError(Exception): + """Inputs or outputs do not match the declared fields.""" + + def __init__(self, kind: str, code: str, message: str) -> None: + super().__init__(message) + self.kind = kind + self.code = code + self.message = message + + +class ScriptLoadError(Exception): + """The script could not be loaded or does not declare exactly one ``@stage`` function.""" + + def __init__(self, code: str, message: str) -> None: + super().__init__(message) + self.code = code + self.message = message diff --git a/python/psrunner/src/psrunner/fields.py b/python/psrunner/src/psrunner/fields.py new file mode 100644 index 0000000..d94c80e --- /dev/null +++ b/python/psrunner/src/psrunner/fields.py @@ -0,0 +1,80 @@ +"""Field declarations (mirror of the .NET ``FieldDefinition``).""" + +from __future__ import annotations + +import re +from collections.abc import Mapping +from dataclasses import dataclass +from typing import Any + +SCALAR_TYPES = frozenset({"number", "integer", "decimal", "string", "bool", "date", "datetime"}) +ALL_TYPES = SCALAR_TYPES | {"enum", "json", "table", "file", "list"} +LIST_ITEM_TYPES = SCALAR_TYPES | {"enum", "file"} +FIELD_NAME = re.compile(r"^[a-z_][a-z0-9_]{0,63}$") + + +@dataclass(frozen=True) +class Column: + """A declared column of a ``table`` field.""" + + name: str + type: str + + +@dataclass(frozen=True) +class FieldSpec: + """One declared input or output of a stage.""" + + name: str + type: str + item_type: str | None = None + required: bool = True + has_default: bool = False + default: Any = None + enum_values: tuple[str, ...] | None = None + content_types: tuple[str, ...] | None = None + columns: tuple[Column, ...] | None = None + + @property + def is_file(self) -> bool: + return self.type == "file" or (self.type == "list" and self.item_type == "file") + + def item_spec(self) -> FieldSpec: + """Spec used to convert each item of a ``list`` field.""" + return FieldSpec( + name=self.name, + type=self.item_type or "json", + enum_values=self.enum_values, + content_types=self.content_types, + ) + + @staticmethod + def from_dict(data: Mapping[str, Any]) -> FieldSpec: + """Builds a spec from the wire/manifest representation (camelCase keys).""" + columns_raw = data.get("columns") + columns = ( + tuple(Column(str(c["name"]), str(c["type"])) for c in columns_raw) + if columns_raw + else None + ) + enum_values = data.get("enumValues") + content_types = data.get("contentTypes") + default = data.get("default") + return FieldSpec( + name=str(data["name"]), + type=str(data["type"]), + item_type=data.get("itemType"), + required=bool(data.get("required", True)), + has_default=default is not None, + default=default, + enum_values=tuple(enum_values) if enum_values else None, + content_types=tuple(content_types) if content_types else None, + columns=columns, + ) + + +def specs_from_dicts(items: Any) -> list[FieldSpec]: + """Converts a list of field dictionaries into specs (``None`` means no fields).""" + if not items: + return [] + return [FieldSpec.from_dict(item) for item in items] diff --git a/python/psrunner/src/psrunner/files.py b/python/psrunner/src/psrunner/files.py new file mode 100644 index 0000000..cc3103f --- /dev/null +++ b/python/psrunner/src/psrunner/files.py @@ -0,0 +1,87 @@ +"""Access to input and output files of a stage.""" + +from __future__ import annotations + +import builtins +import hashlib +import mimetypes +import os +from pathlib import Path +from typing import IO, Any + +_CHUNK = 1024 * 1024 + + +def guess_content_type(name: str) -> str: + """MIME type guessed from the file name (``application/octet-stream`` when unknown).""" + content_type, _ = mimetypes.guess_type(name) + return content_type or "application/octet-stream" + + +class File: + """A file received as input or produced as output by a stage.""" + + __slots__ = ("_content_type", "_name", "_path", "_sha256", "_size") + + def __init__( + self, + path: str | os.PathLike[str], + name: str | None = None, + content_type: str | None = None, + *, + size: int | None = None, + sha256: str | None = None, + ) -> None: + self._path = Path(path) + self._name = name or self._path.name + self._content_type = content_type or guess_content_type(self._name) + self._size = size + self._sha256 = sha256 + + @property + def path(self) -> Path: + return self._path + + @property + def name(self) -> str: + return self._name + + @property + def content_type(self) -> str: + return self._content_type + + @property + def size(self) -> int: + """Size in bytes (read from disk when not provided by the runner).""" + if self._size is not None: + return self._size + return self._path.stat().st_size + + @property + def sha256(self) -> str: + """SHA-256 of the content, as lowercase hex.""" + if self._sha256 is not None: + return self._sha256 + digest = hashlib.sha256() + with builtins.open(self._path, "rb") as stream: + for chunk in iter(lambda: stream.read(_CHUNK), b""): + digest.update(chunk) + return digest.hexdigest() + + def read_bytes(self) -> bytes: + return self._path.read_bytes() + + def read_text(self, encoding: str = "utf-8") -> str: + return self._path.read_text(encoding=encoding) + + def open(self, mode: str = "rb") -> IO[Any]: + """Opens the file; text modes default to UTF-8.""" + if "b" in mode: + return builtins.open(self._path, mode) + return builtins.open(self._path, mode, encoding="utf-8") + + def __repr__(self) -> str: + return ( + f"File(name={self._name!r}, content_type={self._content_type!r}, " + f"path={str(self._path)!r})" + ) diff --git a/python/psrunner/src/psrunner/host.py b/python/psrunner/src/psrunner/host.py new file mode 100644 index 0000000..41a76d8 --- /dev/null +++ b/python/psrunner/src/psrunner/host.py @@ -0,0 +1,123 @@ +"""Process entry point used by the .NET runner: ``python -I -X utf8 -m psrunner.host``. + +Reads ``input.json``, runs the ``@stage`` function and always writes ``output.json`` +(exit code 0) unless the output itself cannot be written. +""" + +from __future__ import annotations + +import json +import logging +import os +import sys +from pathlib import Path +from typing import Any + +from psrunner._execution import call_stage, classify_exception +from psrunner.context import Context +from psrunner.convert import inputs_to_python, outputs_to_wire +from psrunner.fields import specs_from_dicts +from psrunner.limits import apply_memory_limit +from psrunner.protocol import ( + ENV_INPUT, + ENV_MEMORY_LIMIT_MB, + ENV_OUTPUT, + ENV_PROTOCOL, + ENV_SCRIPT, + ENV_SECRET_PREFIX, + ENV_WORK_DIR, + KIND_ENVIRONMENT, + PROTOCOL_VERSION, +) +from psrunner.stage import load_stage_function + + +def _configure_logging() -> logging.Logger: + logger = logging.getLogger("psrunner.stage") + handler = logging.StreamHandler(sys.stderr) + handler.setFormatter(logging.Formatter("%(levelname)s %(message)s")) + logger.handlers[:] = [handler] + logger.setLevel(logging.INFO) + logger.propagate = False + return logger + + +def _secrets_from_env() -> dict[str, str]: + return { + name[len(ENV_SECRET_PREFIX) :]: value + for name, value in os.environ.items() + if name.startswith(ENV_SECRET_PREFIX) + } + + +def _protocol_error(message: str) -> dict[str, Any]: + return { + "protocol": PROTOCOL_VERSION, + "status": "error", + "error": {"kind": KIND_ENVIRONMENT, "code": "PROTOCOL_MISMATCH", "message": message}, + } + + +def _run() -> dict[str, Any]: + requested = os.environ.get(ENV_PROTOCOL, "") + if requested != str(PROTOCOL_VERSION): + return _protocol_error( + f"Runner requested protocol {requested or '(none)'}, " + f"this psrunner speaks {PROTOCOL_VERSION}." + ) + + apply_memory_limit(int(os.environ.get(ENV_MEMORY_LIMIT_MB, "0") or 0)) + logger = _configure_logging() + + try: + document = json.loads(Path(os.environ[ENV_INPUT]).read_text(encoding="utf-8")) + if document.get("protocol") != PROTOCOL_VERSION: + return _protocol_error(f"input.json uses protocol {document.get('protocol')!r}.") + + info = document.get("context") or {} + stage_info = info.get("stage") or {} + work_dir = Path(os.environ[ENV_WORK_DIR]) + ctx = Context( + work_dir=work_dir, + run_id=str(info.get("runId", "")), + step_key=str(info.get("stepKey", "")), + attempt=int(info.get("attempt", 1)), + stage_key=str(stage_info.get("key", "")), + stage_version=int(stage_info.get("version", 0)), + is_test=bool(info.get("isTest", False)), + secrets=_secrets_from_env(), + logger=logger, + ) + input_specs = specs_from_dicts(info.get("inputFields")) + output_specs = specs_from_dicts(info.get("outputFields")) + + inputs = inputs_to_python(document.get("inputs") or {}, input_specs, work_dir) + fn = load_stage_function(Path(os.environ[ENV_SCRIPT])) + result = call_stage(fn, inputs, ctx) + outputs = outputs_to_wire(result, output_specs, work_dir) + except BaseException as exc: # every failure is reported through output.json + return {"protocol": PROTOCOL_VERSION, "status": "error", "error": classify_exception(exc)} + + return {"protocol": PROTOCOL_VERSION, "status": "ok", "outputs": outputs} + + +def main() -> int: + output_path = os.environ.get(ENV_OUTPUT) + if not output_path: + print( + f"psrunner: {ENV_OUTPUT} is not set; this module is started by the .NET runner.", + file=sys.stderr, + ) + return 2 + + document = _run() + try: + Path(output_path).write_text(json.dumps(document, ensure_ascii=False), encoding="utf-8") + except (OSError, TypeError, ValueError) as exc: + print(f"psrunner: could not write output.json: {exc}", file=sys.stderr) + return 1 + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/python/psrunner/src/psrunner/limits.py b/python/psrunner/src/psrunner/limits.py new file mode 100644 index 0000000..fa7ecfc --- /dev/null +++ b/python/psrunner/src/psrunner/limits.py @@ -0,0 +1,111 @@ +"""Resource limits applied by the interpreter to itself, before the user script is imported. + +The limit is applied here, inside the real interpreter process, because on Windows the venv +``python.exe`` is a launcher that starts the interpreter as a child process: a Job Object assigned +by the .NET runner after ``Process.Start`` can miss that child. +""" + +from __future__ import annotations + +import sys +from typing import Any + +_MB = 1024 * 1024 +_keep_alive: list[Any] = [] + + +def apply_memory_limit(limit_mb: int) -> bool: + """Limits the memory of this process. Returns ``True`` when a limit was applied.""" + if limit_mb <= 0: + return False + if sys.platform == "win32": + return _limit_windows(limit_mb * _MB) + else: + return _limit_posix(limit_mb * _MB) + + +if sys.platform == "win32": + import ctypes + from ctypes import wintypes + + _JOB_OBJECT_EXTENDED_LIMIT_INFORMATION = 9 + _JOB_OBJECT_LIMIT_PROCESS_MEMORY = 0x00000100 + + class _BasicLimits(ctypes.Structure): + _fields_ = [ + ("PerProcessUserTimeLimit", ctypes.c_int64), + ("PerJobUserTimeLimit", ctypes.c_int64), + ("LimitFlags", wintypes.DWORD), + ("MinimumWorkingSetSize", ctypes.c_size_t), + ("MaximumWorkingSetSize", ctypes.c_size_t), + ("ActiveProcessLimit", wintypes.DWORD), + ("Affinity", ctypes.c_size_t), + ("PriorityClass", wintypes.DWORD), + ("SchedulingClass", wintypes.DWORD), + ] + + class _IoCounters(ctypes.Structure): + _fields_ = [ + ("ReadOperationCount", ctypes.c_ulonglong), + ("WriteOperationCount", ctypes.c_ulonglong), + ("OtherOperationCount", ctypes.c_ulonglong), + ("ReadTransferCount", ctypes.c_ulonglong), + ("WriteTransferCount", ctypes.c_ulonglong), + ("OtherTransferCount", ctypes.c_ulonglong), + ] + + class _ExtendedLimits(ctypes.Structure): + _fields_ = [ + ("BasicLimitInformation", _BasicLimits), + ("IoInfo", _IoCounters), + ("ProcessMemoryLimit", ctypes.c_size_t), + ("JobMemoryLimit", ctypes.c_size_t), + ("PeakProcessMemoryUsed", ctypes.c_size_t), + ("PeakJobMemoryUsed", ctypes.c_size_t), + ] + + def _limit_windows(limit: int) -> bool: + kernel32 = ctypes.WinDLL("kernel32", use_last_error=True) + kernel32.CreateJobObjectW.argtypes = [ctypes.c_void_p, wintypes.LPCWSTR] + kernel32.CreateJobObjectW.restype = wintypes.HANDLE + kernel32.SetInformationJobObject.argtypes = [ + wintypes.HANDLE, + ctypes.c_int, + ctypes.c_void_p, + wintypes.DWORD, + ] + kernel32.SetInformationJobObject.restype = wintypes.BOOL + kernel32.AssignProcessToJobObject.argtypes = [wintypes.HANDLE, wintypes.HANDLE] + kernel32.AssignProcessToJobObject.restype = wintypes.BOOL + kernel32.GetCurrentProcess.restype = wintypes.HANDLE + + job = kernel32.CreateJobObjectW(None, None) + if not job: + print(f"psrunner: CreateJobObject failed ({ctypes.get_last_error()})", file=sys.stderr) + return False + + info = _ExtendedLimits() + info.BasicLimitInformation.LimitFlags = _JOB_OBJECT_LIMIT_PROCESS_MEMORY + info.ProcessMemoryLimit = limit + applied = kernel32.SetInformationJobObject( + job, _JOB_OBJECT_EXTENDED_LIMIT_INFORMATION, ctypes.byref(info), ctypes.sizeof(info) + ) and kernel32.AssignProcessToJobObject(job, kernel32.GetCurrentProcess()) + if not applied: + print( + f"psrunner: could not apply memory limit ({ctypes.get_last_error()})", + file=sys.stderr, + ) + return False + _keep_alive.append(job) + return True + +else: + import resource + + def _limit_posix(limit: int) -> bool: + try: + resource.setrlimit(resource.RLIMIT_AS, (limit, limit)) + except (ValueError, OSError) as exc: + print(f"psrunner: could not apply memory limit: {exc}", file=sys.stderr) + return False + return True diff --git a/python/psrunner/src/psrunner/manifest.py b/python/psrunner/src/psrunner/manifest.py new file mode 100644 index 0000000..22aff90 --- /dev/null +++ b/python/psrunner/src/psrunner/manifest.py @@ -0,0 +1,272 @@ +"""Loading and validation of ``stage.json`` (same rules as ``schemas/stage.v1.json``).""" + +from __future__ import annotations + +import json +import os +import re +from collections.abc import Mapping +from dataclasses import dataclass, field +from pathlib import Path +from typing import Any + +from psrunner.convert import wire_to_python +from psrunner.errors import ContractError +from psrunner.fields import ALL_TYPES, FIELD_NAME, LIST_ITEM_TYPES, SCALAR_TYPES, FieldSpec + +_KEY = re.compile(r"^[a-z0-9]+(-[a-z0-9]+)*$") +_PYTHON = re.compile(r"^3\.(1[0-9]|[2-9][0-9])$") +_SECRET = re.compile(r"^[A-Z][A-Z0-9_]{0,63}$") +_TOP_LEVEL = { + "$schema", + "key", + "version", + "name", + "description", + "python", + "script", + "requirements", + "timeoutSeconds", + "memoryLimitMb", + "retry", + "idempotent", + "secrets", + "inputs", + "outputs", +} +_FIELD_KEYS = { + "name", + "type", + "itemType", + "required", + "default", + "description", + "enumValues", + "contentTypes", + "columns", +} + + +class ManifestError(Exception): + """``stage.json`` is invalid; ``errors`` lists every problem found.""" + + def __init__(self, path: Path, errors: list[str]) -> None: + super().__init__(f"{path}: " + "; ".join(errors)) + self.path = path + self.errors = errors + + +@dataclass(frozen=True) +class Manifest: + """A loaded and validated stage manifest.""" + + folder: Path + key: str + version: int + name: str + python: str + script: str + requirements: str + inputs: list[FieldSpec] + outputs: list[FieldSpec] + raw: dict[str, Any] = field(repr=False) + + @property + def script_path(self) -> Path: + return self.folder / self.script + + @property + def secrets(self) -> list[str]: + return list(self.raw.get("secrets") or []) + + +def load_manifest(path: str | os.PathLike[str]) -> Manifest: + """Reads ``stage.json`` (or the folder that contains it) and validates it.""" + manifest_path = Path(path) + if manifest_path.is_dir(): + manifest_path = manifest_path / "stage.json" + try: + data = json.loads(manifest_path.read_text(encoding="utf-8")) + except (OSError, json.JSONDecodeError) as exc: + raise ManifestError(manifest_path, [f"cannot read manifest: {exc}"]) from exc + + errors = validate_manifest_data(data) + if errors: + raise ManifestError(manifest_path, errors) + return Manifest( + folder=manifest_path.parent, + key=data["key"], + version=data["version"], + name=data["name"], + python=data.get("python", "3.12"), + script=data.get("script", "script.py"), + requirements=data.get("requirements", "requirements.txt"), + inputs=[FieldSpec.from_dict(f) for f in data["inputs"]], + outputs=[FieldSpec.from_dict(f) for f in data["outputs"]], + raw=data, + ) + + +def validate_manifest_data(data: Any) -> list[str]: + """Returns every validation error of a manifest document (empty when valid).""" + if not isinstance(data, Mapping): + return ["manifest must be a JSON object"] + errors: list[str] = [f"unknown property '{k}'" for k in data if k not in _TOP_LEVEL] + + for required in ("key", "version", "name", "inputs", "outputs"): + if required not in data: + errors.append(f"missing required property '{required}'") + + key = data.get("key") + if key is not None and ( + not isinstance(key, str) or not 3 <= len(key) <= 64 or not _KEY.match(key) + ): + errors.append("'key' must be a slug of 3-64 chars (a-z, 0-9, '-')") + version = data.get("version") + if version is not None and ( + isinstance(version, bool) or not isinstance(version, int) or version < 1 + ): + errors.append("'version' must be an integer >= 1") + name = data.get("name") + if name is not None and (not isinstance(name, str) or not 1 <= len(name) <= 200): + errors.append("'name' must be a string of 1-200 chars") + python = data.get("python") + if python is not None and (not isinstance(python, str) or not _PYTHON.match(python)): + errors.append("'python' must look like '3.12' (minimum 3.10)") + _check_int(data, "timeoutSeconds", 1, 86400, errors) + _check_int(data, "memoryLimitMb", 64, None, errors) + _check_retry(data.get("retry"), errors) + if "idempotent" in data and not isinstance(data["idempotent"], bool): + errors.append("'idempotent' must be a boolean") + secrets = data.get("secrets") + if secrets is not None: + if not isinstance(secrets, list) or len(set(map(str, secrets))) != len(secrets): + errors.append("'secrets' must be a list of unique names") + else: + errors += [ + f"invalid secret name '{s}'" + for s in secrets + if not isinstance(s, str) or not _SECRET.match(s) + ] + + for section in ("inputs", "outputs"): + fields = data.get(section) + if fields is None: + continue + if not isinstance(fields, list): + errors.append(f"'{section}' must be a list") + continue + names: set[str] = set() + for index, item in enumerate(fields): + errors += [f"{section}[{index}]: {e}" for e in validate_field(item)] + field_name = item.get("name") if isinstance(item, Mapping) else None + if isinstance(field_name, str): + if field_name in names: + errors.append(f"{section}[{index}]: duplicate field name '{field_name}'") + names.add(field_name) + return errors + + +def _check_int( + data: Mapping[str, Any], key: str, minimum: int, maximum: int | None, errors: list[str] +) -> None: + if key not in data: + return + value = data[key] + if ( + isinstance(value, bool) + or not isinstance(value, int) + or value < minimum + or (maximum is not None and value > maximum) + ): + bounds = f">= {minimum}" if maximum is None else f"between {minimum} and {maximum}" + errors.append(f"'{key}' must be an integer {bounds}") + + +def _check_retry(retry: Any, errors: list[str]) -> None: + if retry is None: + return + if not isinstance(retry, Mapping): + errors.append("'retry' must be an object") + return + errors += [ + f"retry: unknown property '{k}'" + for k in retry + if k not in {"maxAttempts", "initialDelaySeconds", "backoffMultiplier"} + ] + _check_int(retry, "maxAttempts", 0, 20, errors) + _check_int(retry, "initialDelaySeconds", 0, 600, errors) + multiplier = retry.get("backoffMultiplier") + if multiplier is not None and ( + isinstance(multiplier, bool) + or not isinstance(multiplier, (int, float)) + or not 1 <= multiplier <= 10 + ): + errors.append("'retry.backoffMultiplier' must be a number between 1 and 10") + + +def validate_field(item: Any) -> list[str]: + """Validates one field declaration.""" + if not isinstance(item, Mapping): + return ["field must be an object"] + errors = [f"unknown property '{k}'" for k in item if k not in _FIELD_KEYS] + name, kind, item_type = item.get("name"), item.get("type"), item.get("itemType") + if not isinstance(name, str) or not FIELD_NAME.match(name): + errors.append("'name' must match ^[a-z_][a-z0-9_]{0,63}$") + if kind not in ALL_TYPES: + errors.append(f"'type' must be one of {sorted(ALL_TYPES)}") + return errors + + if kind == "list": + if item_type not in LIST_ITEM_TYPES: + errors.append(f"list fields require 'itemType' in {sorted(LIST_ITEM_TYPES)}") + elif item_type is not None: + errors.append("'itemType' is only allowed on list fields") + + is_enum = kind == "enum" or (kind == "list" and item_type == "enum") + enum_values = item.get("enumValues") + if is_enum: + if ( + not isinstance(enum_values, list) + or not enum_values + or len(enum_values) > 200 + or len(set(map(str, enum_values))) != len(enum_values) + ): + errors.append("enum fields require 1-200 unique 'enumValues'") + elif enum_values is not None: + errors.append("'enumValues' is only allowed on enum fields") + + is_file = kind == "file" or (kind == "list" and item_type == "file") + if not is_file and item.get("contentTypes") is not None: + errors.append("'contentTypes' is only allowed on file fields") + if kind != "table" and item.get("columns") is not None: + errors.append("'columns' is only allowed on table fields") + columns = item.get("columns") + if kind == "table" and columns is not None: + if not isinstance(columns, list) or not columns: + errors.append("'columns' must be a non-empty list") + else: + for column in columns: + if ( + not isinstance(column, Mapping) + or not isinstance(column.get("name"), str) + or column.get("type") not in SCALAR_TYPES + ): + errors.append("each column needs a 'name' and a scalar 'type'") + + description = item.get("description") + if description is not None and (not isinstance(description, str) or len(description) > 500): + errors.append("'description' must be a string up to 500 chars") + if "required" in item and not isinstance(item["required"], bool): + errors.append("'required' must be a boolean") + + default = item.get("default") + if default is not None: + if is_file or kind == "table": + errors.append(f"'{kind}' fields cannot have a default") + elif not errors: + try: + wire_to_python(default, FieldSpec.from_dict(item), Path("."), f"{name}.default") + except ContractError as exc: + errors.append(f"invalid default: {exc.message}") + return errors diff --git a/python/psrunner/src/psrunner/protocol.py b/python/psrunner/src/psrunner/protocol.py new file mode 100644 index 0000000..6712d0a --- /dev/null +++ b/python/psrunner/src/psrunner/protocol.py @@ -0,0 +1,22 @@ +"""Constants shared with the .NET runner (protocol version 1).""" + +from __future__ import annotations + +PROTOCOL_VERSION = 1 + +ENV_PROTOCOL = "PSR_PROTOCOL" +ENV_INPUT = "PSR_INPUT" +ENV_OUTPUT = "PSR_OUTPUT" +ENV_WORK_DIR = "PSR_WORK_DIR" +ENV_SCRIPT = "PSR_SCRIPT" +ENV_MEMORY_LIMIT_MB = "PSR_MEMORY_LIMIT_MB" +ENV_SECRET_PREFIX = "PSR_SECRET_" + +FILE_MARKER = "$file" + +# Error kinds understood by the runner (mirror of the .NET ErrorKind enum). +KIND_INPUT_VALIDATION = "InputValidation" +KIND_OUTPUT_CONTRACT = "OutputContractViolation" +KIND_SCRIPT_ERROR = "ScriptError" +KIND_MEMORY_LIMIT = "MemoryLimitExceeded" +KIND_ENVIRONMENT = "EnvironmentSetupFailed" diff --git a/python/psrunner/src/psrunner/py.typed b/python/psrunner/src/psrunner/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/python/psrunner/src/psrunner/stage.py b/python/psrunner/src/psrunner/stage.py new file mode 100644 index 0000000..9283ba7 --- /dev/null +++ b/python/psrunner/src/psrunner/stage.py @@ -0,0 +1,58 @@ +"""The ``@stage`` decorator and script loading.""" + +from __future__ import annotations + +import hashlib +import importlib.util +import sys +from collections.abc import Callable +from pathlib import Path +from typing import Any, TypeVar + +from psrunner.errors import ScriptLoadError + +F = TypeVar("F", bound=Callable[..., Any]) + +_registry: list[Callable[..., Any]] = [] + + +def stage(fn: F) -> F: + """Marks ``fn(inputs, ctx)`` as the entry point of the script (exactly one per script).""" + _registry.append(fn) + return fn + + +def load_stage_function(script: Path) -> Callable[..., Any]: + """Imports the script and returns its single ``@stage`` function.""" + if not script.is_file(): + raise ScriptLoadError("SCRIPT_NOT_FOUND", f"Script not found: {script}") + + _registry.clear() + digest = hashlib.sha256(str(script.resolve()).encode()).hexdigest()[:16] + module_name = f"psrunner_stage_{digest}" + spec = importlib.util.spec_from_file_location(module_name, script) + if spec is None or spec.loader is None: + raise ScriptLoadError("SCRIPT_NOT_FOUND", f"Cannot load script: {script}") + + module = importlib.util.module_from_spec(spec) + sys.modules[module_name] = module + try: + spec.loader.exec_module(module) + except SyntaxError as exc: + raise ScriptLoadError( + "SYNTAX_ERROR", f"{exc.msg} (line {exc.lineno}, column {exc.offset})" + ) from exc + + found = list(_registry) + if not found: + raise ScriptLoadError( + "NO_STAGE_FUNCTION", "The script does not define a function decorated with @stage." + ) + if len(found) > 1: + names = ", ".join(fn.__name__ for fn in found) + raise ScriptLoadError( + "MULTIPLE_STAGE_FUNCTIONS", + f"The script defines {len(found)} functions decorated with @stage ({names}); " + "exactly one is allowed.", + ) + return found[0] diff --git a/python/psrunner/src/psrunner/testing.py b/python/psrunner/src/psrunner/testing.py new file mode 100644 index 0000000..c97fc04 --- /dev/null +++ b/python/psrunner/src/psrunner/testing.py @@ -0,0 +1,219 @@ +"""Run a stage in-process (no .NET needed), e.g. from pytest. + +Example:: + + from psrunner.testing import run_stage + + def test_terms(): + result = run_stage("stages/terms/script.py", {"a1": 1, "ratio": 2, "n": 4}, + stage_json="stages/terms/stage.json") + assert result.ok + assert result.outputs["terms"] == [1, 2, 4, 8] +""" + +from __future__ import annotations + +import logging +import os +import shutil +import tempfile +import uuid +from collections.abc import Callable, Mapping, Sequence +from dataclasses import dataclass, field +from pathlib import Path +from typing import Any + +from psrunner._execution import call_stage, classify_exception +from psrunner.context import Context +from psrunner.convert import inputs_to_python, outputs_to_wire, python_to_wire +from psrunner.errors import ContractError +from psrunner.fields import FieldSpec +from psrunner.files import File, guess_content_type +from psrunner.manifest import load_manifest +from psrunner.protocol import FILE_MARKER, KIND_INPUT_VALIDATION +from psrunner.stage import load_stage_function + +PathLike = str | os.PathLike[str] + + +@dataclass(frozen=True) +class StageRunError: + """Failure reported by :func:`run_stage` (same shape as the protocol error).""" + + kind: str + code: str | None + message: str + traceback: str | None = None + + +@dataclass +class StageRunResult: + """Outcome of :func:`run_stage`.""" + + outputs: dict[str, Any] | None + """Values exactly as returned by ``run()``.""" + wire_outputs: dict[str, Any] | None + """Outputs converted to the wire format (only when a contract was given).""" + error: StageRunError | None + logs: list[str] = field(default_factory=list) + work_dir: Path = field(default_factory=Path) + + @property + def ok(self) -> bool: + return self.error is None + + +class _ListHandler(logging.Handler): + def __init__(self, sink: list[str]) -> None: + super().__init__() + self._sink = sink + self.setFormatter(logging.Formatter("%(levelname)s %(message)s")) + + def emit(self, record: logging.LogRecord) -> None: + self._sink.append(self.format(record)) + + +def _copy_input_files( + name: str, paths: PathLike | Sequence[PathLike], work_dir: Path +) -> dict[str, Any] | list[dict[str, Any]]: + """Copies files into ``in///`` and returns wire references.""" + many = not isinstance(paths, (str, os.PathLike)) + items: Sequence[PathLike] = [paths] if isinstance(paths, (str, os.PathLike)) else paths + references: list[dict[str, Any]] = [] + for index, source in enumerate(items): + source_path = Path(source) + relative = Path("in") / name / str(index) / source_path.name + target = work_dir / relative + target.parent.mkdir(parents=True, exist_ok=True) + shutil.copyfile(source_path, target) + reference = File(target, source_path.name, guess_content_type(source_path.name)) + references.append( + { + FILE_MARKER: { + "path": relative.as_posix(), + "name": reference.name, + "contentType": reference.content_type, + "size": reference.size, + "sha256": reference.sha256, + } + } + ) + return references if many else references[0] + + +def _file_from_reference(reference: Mapping[str, Any], work_dir: Path) -> File: + info = reference[FILE_MARKER] + return File( + work_dir / info["path"], + info["name"], + info["contentType"], + size=info["size"], + sha256=info["sha256"], + ) + + +def _inputs_to_wire( + inputs: Mapping[str, Any], specs: Sequence[FieldSpec], work_dir: Path +) -> dict[str, Any]: + by_name = {spec.name: spec for spec in specs} + unknown = sorted(name for name in inputs if name not in by_name) + if unknown: + raise ContractError( + KIND_INPUT_VALIDATION, + "UNDECLARED_INPUT", + f"Inputs not declared by the stage: {', '.join(unknown)}.", + ) + wire: dict[str, Any] = {} + for name, value in inputs.items(): + spec = by_name[name] + if value is None or spec.is_file: + wire[name] = value + else: + wire[name] = python_to_wire(value, spec, work_dir, name, KIND_INPUT_VALIDATION) + return wire + + +def run_stage( + script: PathLike | Callable[..., Any], + inputs: Mapping[str, Any] | None = None, + *, + stage_json: PathLike | None = None, + secrets: Mapping[str, str] | None = None, + files: Mapping[str, PathLike | Sequence[PathLike]] | None = None, + work_dir: PathLike | None = None, + run_id: str | None = None, +) -> StageRunResult: + """Runs one stage function with the same conversions and validations as the real runner. + + ``files`` maps file fields to local paths (a list for ``list``). When ``stage_json`` + is given, inputs and outputs are validated against the declared fields; otherwise inputs + are passed through as given. + """ + directory = ( + Path(work_dir) if work_dir is not None else Path(tempfile.mkdtemp(prefix="psrunner-")) + ) + for sub in ("in", "out", "tmp"): + (directory / sub).mkdir(parents=True, exist_ok=True) + + logs: list[str] = [] + logger = logging.getLogger(f"psrunner.stage.test.{uuid.uuid4().hex}") + logger.setLevel(logging.DEBUG) + logger.propagate = False + logger.addHandler(_ListHandler(logs)) + + manifest = load_manifest(stage_json) if stage_json is not None else None + ctx = Context( + work_dir=directory, + run_id=run_id or uuid.uuid4().hex, + step_key=manifest.key if manifest else "test", + stage_key=manifest.key if manifest else "test", + stage_version=manifest.version if manifest else 0, + is_test=True, + secrets=secrets, + logger=logger, + ) + + result: Any = None + try: + raw: dict[str, Any] = dict(inputs or {}) + file_refs = { + name: _copy_input_files(name, paths, directory) for name, paths in (files or {}).items() + } + if manifest is not None: + wire = _inputs_to_wire(raw, manifest.inputs, directory) + wire.update(file_refs) + converted = inputs_to_python(wire, manifest.inputs, directory) + else: + converted = raw + for name, reference in file_refs.items(): + if isinstance(reference, list): + converted[name] = [_file_from_reference(r, directory) for r in reference] + else: + converted[name] = _file_from_reference(reference, directory) + + fn = script if callable(script) else load_stage_function(Path(script)) + result = call_stage(fn, converted, ctx) + wire_outputs = ( + outputs_to_wire(result, manifest.outputs, directory) if manifest is not None else None + ) + except BaseException as exc: + if isinstance(exc, KeyboardInterrupt): + raise + info = classify_exception(exc) + return StageRunResult( + outputs=result if isinstance(result, dict) else None, + wire_outputs=None, + error=StageRunError( + info["kind"], info.get("code"), info["message"], info.get("traceback") + ), + logs=logs, + work_dir=directory, + ) + + return StageRunResult( + outputs=dict(result) if isinstance(result, Mapping) else None, + wire_outputs=wire_outputs, + error=None, + logs=logs, + work_dir=directory, + ) diff --git a/python/psrunner/tests/conftest.py b/python/psrunner/tests/conftest.py new file mode 100644 index 0000000..bbe880a --- /dev/null +++ b/python/psrunner/tests/conftest.py @@ -0,0 +1,131 @@ +from __future__ import annotations + +import json +import os +import subprocess +import sys +import textwrap +from collections.abc import Callable +from dataclasses import dataclass +from pathlib import Path +from typing import Any + +import pytest + + +@dataclass +class HostRun: + output: dict[str, Any] | None + returncode: int + stdout: str + stderr: str + work_dir: Path + + @property + def outputs(self) -> dict[str, Any]: + assert self.output is not None, self.stderr + assert self.output["status"] == "ok", self.output + return self.output["outputs"] # type: ignore[no-any-return] + + @property + def error(self) -> dict[str, Any]: + assert self.output is not None, self.stderr + assert self.output["status"] == "error", self.output + return self.output["error"] # type: ignore[no-any-return] + + +RunHost = Callable[..., HostRun] + + +@pytest.fixture +def run_host(tmp_path: Path) -> RunHost: + """Runs ``python -I -X utf8 -m psrunner.host`` exactly like the .NET runner does.""" + + def _run( + script: str, + inputs: dict[str, Any] | None = None, + input_fields: list[dict[str, Any]] | None = None, + output_fields: list[dict[str, Any]] | None = None, + *, + files: dict[str, tuple[str, bytes, str] | list[tuple[str, bytes, str]]] | None = None, + secrets: dict[str, str] | None = None, + protocol: str = "1", + memory_limit_mb: int = 0, + ) -> HostRun: + work = tmp_path / "work" + for sub in ("in", "out", "tmp"): + (work / sub).mkdir(parents=True, exist_ok=True) + script_path = tmp_path / "script.py" + script_path.write_text(textwrap.dedent(script), encoding="utf-8") + + wire_inputs = dict(inputs or {}) + for name, given in (files or {}).items(): + items = given if isinstance(given, list) else [given] + references = [] + for index, (file_name, content, content_type) in enumerate(items): + relative = Path("in") / name / str(index) / file_name + (work / relative).parent.mkdir(parents=True, exist_ok=True) + (work / relative).write_bytes(content) + references.append( + { + "$file": { + "path": relative.as_posix(), + "name": file_name, + "contentType": content_type, + "size": len(content), + } + } + ) + wire_inputs[name] = references if isinstance(given, list) else references[0] + + document = { + "protocol": 1, + "context": { + "runId": "run-1", + "stepKey": "step", + "attempt": 1, + "stage": {"key": "test-stage", "version": 1}, + "isTest": False, + "inputFields": input_fields or [], + "outputFields": output_fields or [], + }, + "inputs": wire_inputs, + } + (work / "input.json").write_text(json.dumps(document), encoding="utf-8") + + env = {"PATH": os.environ.get("PATH", "")} + if "SYSTEMROOT" in os.environ: + env["SYSTEMROOT"] = os.environ["SYSTEMROOT"] + env.update( + { + "TEMP": str(work / "tmp"), + "TMP": str(work / "tmp"), + "PSR_PROTOCOL": protocol, + "PSR_INPUT": str(work / "input.json"), + "PSR_OUTPUT": str(work / "output.json"), + "PSR_WORK_DIR": str(work), + "PSR_SCRIPT": str(script_path), + "PSR_MEMORY_LIMIT_MB": str(memory_limit_mb), + } + ) + for name, value in (secrets or {}).items(): + env[f"PSR_SECRET_{name}"] = value + + completed = subprocess.run( + [sys.executable, "-I", "-X", "utf8", "-m", "psrunner.host"], + cwd=work, + env=env, + capture_output=True, + text=True, + encoding="utf-8", + errors="replace", + timeout=120, + check=False, + ) + output_path = work / "output.json" + output = ( + json.loads(output_path.read_text(encoding="utf-8")) if output_path.exists() else None + ) + return HostRun(output, completed.returncode, completed.stdout, completed.stderr, work) + + return _run diff --git a/python/psrunner/tests/test_convert.py b/python/psrunner/tests/test_convert.py new file mode 100644 index 0000000..734c000 --- /dev/null +++ b/python/psrunner/tests/test_convert.py @@ -0,0 +1,139 @@ +from __future__ import annotations + +from datetime import date, datetime, timedelta, timezone +from decimal import Decimal +from pathlib import Path + +import pandas as pd +import pytest + +from psrunner import convert +from psrunner.errors import ContractError +from psrunner.fields import Column, FieldSpec + +TABLE = FieldSpec(name="tabela", type="table") + + +def test_spec002_ac03_table_without_pandas_is_list_of_dicts( + monkeypatch: pytest.MonkeyPatch, +) -> None: + monkeypatch.setattr(convert, "_pandas_loaded", True) + monkeypatch.setattr(convert, "_pandas", None) + + value = convert.wire_to_python([{"i": 1}], TABLE, Path("."), "tabela") + + assert value == [{"i": 1}] + + +def test_spec002_ac03_table_with_pandas_is_dataframe() -> None: + value = convert.wire_to_python([{"i": 1, "x": 2.0}], TABLE, Path("."), "tabela") + + assert isinstance(value, pd.DataFrame) + assert list(value.columns) == ["i", "x"] + + +def test_spec002_ac03_dataframe_output_dates_become_iso() -> None: + frame = pd.DataFrame( + { + "dia": pd.to_datetime(["2026-10-19", "2026-10-20"]), + "valor": [1.5, float("nan")], + } + ) + + wire = convert.python_to_wire(frame, TABLE, Path("."), "tabela", "OutputContractViolation") + + assert wire == [ + {"dia": "2026-10-19T00:00:00", "valor": 1.5}, + {"dia": "2026-10-20T00:00:00", "valor": None}, + ] + + +def test_table_columns_are_converted_and_required() -> None: + spec = FieldSpec( + name="t", type="table", columns=(Column("dia", "date"), Column("n", "integer")) + ) + + rows = convert.wire_to_python([{"dia": "2026-10-19", "n": 1}], spec, Path("."), "t") + assert rows["dia"][0] == date(2026, 10, 19) + + with pytest.raises(ContractError) as error: + convert.python_to_wire( + [{"dia": date(2026, 10, 19)}], spec, Path("."), "t", "OutputContractViolation" + ) + assert error.value.code == "MISSING_COLUMN" + + +@pytest.mark.parametrize( + ("text", "expected"), + [ + ( + "2026-10-19T14:30:00-03:00", + datetime(2026, 10, 19, 14, 30, tzinfo=timezone(timedelta(hours=-3))), + ), + ("2026-10-19T17:30:00Z", datetime(2026, 10, 19, 17, 30, tzinfo=timezone.utc)), + ( + "2026-10-19T17:30:00.1234567+00:00", + datetime(2026, 10, 19, 17, 30, 0, 123456, tzinfo=timezone.utc), + ), + ( + "2026-10-19T17:30:00.5+0000", + datetime(2026, 10, 19, 17, 30, 0, 500000, tzinfo=timezone.utc), + ), + ], +) +def test_datetime_parsing_accepts_dotnet_formats(text: str, expected: datetime) -> None: + assert convert.parse_datetime(text) == expected + + +def test_naive_datetime_input_is_rejected() -> None: + spec = FieldSpec(name="m", type="datetime") + + with pytest.raises(ContractError) as error: + convert.wire_to_python("2026-10-19T10:00:00", spec, Path("."), "m") + + assert error.value.code == "NAIVE_DATETIME" + + +def test_decimal_output_never_uses_exponent() -> None: + spec = FieldSpec(name="v", type="decimal") + + assert convert.python_to_wire(Decimal("1E-7"), spec, Path("."), "v", "x") == "0.0000001" + assert convert.python_to_wire(10, spec, Path("."), "v", "x") == "10" + + +def test_decimal_output_rejects_float() -> None: + spec = FieldSpec(name="v", type="decimal") + + with pytest.raises(ContractError): + convert.python_to_wire(0.1, spec, Path("."), "v", "x") + + +def test_enum_list_validates_each_item() -> None: + spec = FieldSpec(name="tipos", type="list", item_type="enum", enum_values=("a", "b")) + + assert convert.wire_to_python(["a", "b"], spec, Path("."), "tipos") == ["a", "b"] + with pytest.raises(ContractError) as error: + convert.wire_to_python(["a", "c"], spec, Path("."), "tipos") + assert "tipos[1]" in error.value.message + + +def test_integer_rejects_bool_and_float() -> None: + spec = FieldSpec(name="n", type="integer") + + for value in (True, 1.0): + with pytest.raises(ContractError): + convert.wire_to_python(value, spec, Path("."), "n") + + +def test_default_applies_to_absent_optional_input() -> None: + spec = FieldSpec( + name="tipo", type="enum", required=False, has_default=True, default="a", enum_values=("a",) + ) + + assert convert.inputs_to_python({}, [spec], Path(".")) == {"tipo": "a"} + + +def test_absent_optional_input_without_default_is_none() -> None: + spec = FieldSpec(name="anexo", type="file", required=False) + + assert convert.inputs_to_python({}, [spec], Path(".")) == {"anexo": None} diff --git a/python/psrunner/tests/test_host.py b/python/psrunner/tests/test_host.py new file mode 100644 index 0000000..fedefb9 --- /dev/null +++ b/python/psrunner/tests/test_host.py @@ -0,0 +1,379 @@ +"""Spec 002 acceptance criteria exercised through the real entry point (``-m psrunner.host``).""" + +from __future__ import annotations + +import pytest +from conftest import RunHost + +ALL_FIELDS = [ + {"name": "numero", "type": "number"}, + {"name": "inteiro", "type": "integer"}, + {"name": "valor", "type": "decimal"}, + {"name": "texto", "type": "string"}, + {"name": "ativo", "type": "bool"}, + {"name": "dia", "type": "date"}, + {"name": "momento", "type": "datetime"}, + {"name": "tipo", "type": "enum", "enumValues": ["aritmetica", "geometrica"]}, + {"name": "dados", "type": "json"}, + {"name": "tabela", "type": "table"}, + {"name": "lista", "type": "list", "itemType": "number"}, + {"name": "arquivo", "type": "file"}, + {"name": "anexos", "type": "list", "itemType": "file"}, +] + +ECHO_SCRIPT = """ + import shutil + from psrunner import stage + + @stage + def run(inputs, ctx): + out = dict(inputs) + source = inputs["arquivo"] + copy = ctx.new_file("copia-" + source.name, source.content_type) + shutil.copyfile(source.path, copy.path) + out["arquivo"] = copy + attachments = [] + for index, item in enumerate(inputs["anexos"]): + target = ctx.new_file(f"{index}-{item.name}", item.content_type) + shutil.copyfile(item.path, target.path) + attachments.append(target) + out["anexos"] = attachments + out["tipos"] = {name: type(value).__name__ for name, value in inputs.items()} + return out +""" + + +def test_spec002_ac01_all_types_round_trip(run_host: RunHost) -> None: + inputs = { + "numero": 1.5, + "inteiro": 42, + "valor": "1234.5600", + "texto": "olá", + "ativo": True, + "dia": "2026-10-19", + "momento": "2026-10-19T14:30:00-03:00", + "tipo": "geometrica", + "dados": {"a": [1, 2, {"b": None}]}, + "tabela": [{"i": 1, "x": 1.0}, {"i": 2, "x": 2.0}], + "lista": [1, 2.5, 3], + } + files = { + "arquivo": ("pagina.html", b"

oi

", "text/html"), + "anexos": [("a.txt", b"A", "text/plain"), ("b.txt", b"B", "text/plain")], + } + output_fields = [*ALL_FIELDS, {"name": "tipos", "type": "json"}] + + run = run_host(ECHO_SCRIPT, inputs, ALL_FIELDS, output_fields, files=files) + + outputs = run.outputs + assert outputs["tipos"] == { + "numero": "float", + "inteiro": "int", + "valor": "Decimal", + "texto": "str", + "ativo": "bool", + "dia": "date", + "momento": "datetime", + "tipo": "str", + "dados": "dict", + "tabela": "DataFrame", + "lista": "list", + "arquivo": "File", + "anexos": "list", + } + for name in ( + "numero", + "inteiro", + "valor", + "texto", + "ativo", + "dia", + "momento", + "tipo", + "dados", + "tabela", + ): + assert outputs[name] == inputs[name], name + assert outputs["lista"] == [1.0, 2.5, 3.0] + assert outputs["arquivo"]["$file"] == { + "path": "out/copia-pagina.html", + "name": "copia-pagina.html", + "contentType": "text/html", + } + assert [a["$file"]["name"] for a in outputs["anexos"]] == ["0-a.txt", "1-b.txt"] + assert (run.work_dir / "out" / "copia-pagina.html").read_bytes() == b"

oi

" + + +def test_spec002_ac02_decimal_keeps_every_digit(run_host: RunHost) -> None: + script = """ + from decimal import Decimal + from psrunner import stage + + @stage + def run(inputs, ctx): + assert isinstance(inputs["valor"], Decimal) + return {"valor": inputs["valor"]} + """ + fields = [{"name": "valor", "type": "decimal"}] + + run = run_host(script, {"valor": "0.1000000000000000000000000001"}, fields, fields) + + assert run.outputs == {"valor": "0.1000000000000000000000000001"} + + +def test_spec002_ac04_stage_error_reports_code(run_host: RunHost) -> None: + script = """ + from psrunner import StageError, stage + + @stage + def run(inputs, ctx): + raise StageError("html sem body", code="E1", details={"linha": 3}) + """ + + run = run_host(script) + + assert run.returncode == 0 + assert run.error["kind"] == "ScriptError" + assert run.error["code"] == "E1" + assert run.error["message"] == "html sem body" + assert run.error["details"] == {"linha": 3} + + +def test_spec002_ac05_unhandled_exception_has_user_traceback(run_host: RunHost) -> None: + script = """ + from psrunner import stage + + def helper(): + return 1 / 0 + + @stage + def run(inputs, ctx): + return {"x": helper()} + """ + + run = run_host(script) + + assert run.error["kind"] == "ScriptError" + assert run.error["message"].startswith("ZeroDivisionError") + assert "script.py" in run.error["traceback"] + assert "line 5" in run.error["traceback"] + assert "psrunner" not in run.error["traceback"].split("script.py")[0].replace( + "psrunner_stage", "" + ) + + +@pytest.mark.parametrize( + ("script", "code"), + [ + ("def run(inputs, ctx):\n return {}\n", "NO_STAGE_FUNCTION"), + ( + "from psrunner import stage\n" + "@stage\ndef a(i, c):\n return {}\n" + "@stage\ndef b(i, c):\n return {}\n", + "MULTIPLE_STAGE_FUNCTIONS", + ), + ("def run(:\n", "SYNTAX_ERROR"), + ], +) +def test_spec002_ac06_script_must_have_exactly_one_stage( + run_host: RunHost, script: str, code: str +) -> None: + run = run_host(script) + + assert run.error["kind"] == "ScriptError" + assert run.error["code"] == code + + +def test_spec002_ac07_new_file_is_created_in_out(run_host: RunHost) -> None: + script = """ + from psrunner import stage + + @stage + def run(inputs, ctx): + pdf = ctx.new_file("a.pdf") + pdf.path.write_bytes(b"%PDF-1.7") + return {"pdf": pdf} + """ + + run = run_host(script, output_fields=[{"name": "pdf", "type": "file"}]) + + assert run.outputs["pdf"] == { + "$file": {"path": "out/a.pdf", "name": "a.pdf", "contentType": "application/pdf"} + } + + +def test_spec002_ac08_file_outside_out_is_rejected(run_host: RunHost) -> None: + script = """ + from psrunner import File, stage + + @stage + def run(inputs, ctx): + target = ctx.tmp_dir / "segredo.txt" + target.write_text("x") + return {"arquivo": File(target)} + """ + + run = run_host(script, output_fields=[{"name": "arquivo", "type": "file"}]) + + assert run.error["kind"] == "OutputContractViolation" + assert run.error["code"] == "OUTPUT_FILE_OUTSIDE_OUT" + + +def test_spec002_ac09_only_declared_secrets_are_readable(run_host: RunHost) -> None: + script = """ + from psrunner import stage + + @stage + def run(inputs, ctx): + try: + ctx.secrets["OUTRO"] + missing = "" + except KeyError as exc: + missing = str(exc) + try: + ctx.secrets["SMTP_SENHA"] = "x" + writable = True + except TypeError: + writable = False + return {"valor": ctx.secrets["SMTP_SENHA"], "erro": missing, "gravavel": writable} + """ + outputs = [ + {"name": "valor", "type": "string"}, + {"name": "erro", "type": "string"}, + {"name": "gravavel", "type": "bool"}, + ] + + run = run_host(script, output_fields=outputs, secrets={"SMTP_SENHA": "abc"}) + + assert run.outputs["valor"] == "abc" + assert "SMTP_SENHA" in run.outputs["erro"] + assert run.outputs["gravavel"] is False + + +def test_spec002_ac10_memory_limit(run_host: RunHost) -> None: + script = """ + from psrunner import stage + + @stage + def run(inputs, ctx): + data = bytearray(1024 * 1024 * 1024) + return {"tamanho": len(data)} + """ + + run = run_host( + script, output_fields=[{"name": "tamanho", "type": "integer"}], memory_limit_mb=128 + ) + + assert run.error["kind"] == "MemoryLimitExceeded" + + +def test_spec002_ac11_protocol_mismatch(run_host: RunHost) -> None: + run = run_host("from psrunner import stage\n", protocol="2") + + assert run.error["code"] == "PROTOCOL_MISMATCH" + + +def test_spec002_ac12_async_run_is_awaited(run_host: RunHost) -> None: + script = """ + import asyncio + from psrunner import stage + + @stage + async def run(inputs, ctx): + await asyncio.sleep(0.01) + return {"ok": True} + """ + + run = run_host(script, output_fields=[{"name": "ok", "type": "bool"}]) + + assert run.outputs == {"ok": True} + + +@pytest.mark.parametrize( + ("body", "code"), + [ + ('return {"x": 1, "extra": 2}', "UNDECLARED_OUTPUT"), + ("return {}", "MISSING_REQUIRED_OUTPUT"), + ('return {"x": float("nan")}', "NON_FINITE_NUMBER"), + ('return {"x": "1"}', "TYPE_MISMATCH"), + ("return [1]", "OUTPUT_NOT_A_DICT"), + ], +) +def test_output_contract_violations(run_host: RunHost, body: str, code: str) -> None: + script = f""" + from psrunner import stage + + @stage + def run(inputs, ctx): + {body} + """ + + run = run_host(script, output_fields=[{"name": "x", "type": "number"}]) + + assert run.error["kind"] == "OutputContractViolation" + assert run.error["code"] == code + + +def test_naive_datetime_output_is_rejected(run_host: RunHost) -> None: + script = """ + from datetime import datetime + from psrunner import stage + + @stage + def run(inputs, ctx): + return {"quando": datetime(2026, 10, 19, 12, 0)} + """ + + run = run_host(script, output_fields=[{"name": "quando", "type": "datetime"}]) + + assert run.error["code"] == "NAIVE_DATETIME" + + +def test_sys_exit_is_a_script_error(run_host: RunHost) -> None: + script = """ + import sys + from psrunner import stage + + @stage + def run(inputs, ctx): + sys.exit(3) + """ + + run = run_host(script) + + assert run.error["code"] == "SCRIPT_EXITED" + + +def test_print_and_logging_do_not_break_the_protocol(run_host: RunHost) -> None: + script = """ + from psrunner import stage + + print("hello from stdout") + + @stage + def run(inputs, ctx): + print("running") + ctx.log.info("calculado %d termos", 4) + return {"ok": True} + """ + + run = run_host(script, output_fields=[{"name": "ok", "type": "bool"}]) + + assert run.outputs == {"ok": True} + assert "hello from stdout" in run.stdout + assert "INFO calculado 4 termos" in run.stderr + + +def test_missing_required_input_is_input_validation(run_host: RunHost) -> None: + script = """ + from psrunner import stage + + @stage + def run(inputs, ctx): + return {} + """ + + run = run_host(script, {}, [{"name": "n", "type": "integer"}]) + + assert run.error["kind"] == "InputValidation" + assert run.error["code"] == "MISSING_REQUIRED_INPUT" diff --git a/python/psrunner/tests/test_testing_and_cli.py b/python/psrunner/tests/test_testing_and_cli.py new file mode 100644 index 0000000..bb7b9e5 --- /dev/null +++ b/python/psrunner/tests/test_testing_and_cli.py @@ -0,0 +1,164 @@ +from __future__ import annotations + +import json +from pathlib import Path + +import pytest + +from psrunner.cli import main as cli_main +from psrunner.manifest import ManifestError, load_manifest, validate_manifest_data +from psrunner.testing import run_stage + +SCRIPT = """ +from psrunner import stage + +@stage +def run(inputs, ctx): + a1, razao, n = inputs["a1"], inputs["razao"], inputs["n"] + if inputs["tipo"] == "geometrica": + termos = [a1 * razao**i for i in range(n)] + else: + termos = [a1 + razao * i for i in range(n)] + ctx.log.info("gerados %d termos", n) + return {"termos": termos} +""" + +MANIFEST = { + "key": "progressao-termos", + "version": 1, + "name": "Termos de progressão", + "inputs": [ + {"name": "a1", "type": "number"}, + {"name": "razao", "type": "number"}, + {"name": "n", "type": "integer"}, + { + "name": "tipo", + "type": "enum", + "enumValues": ["aritmetica", "geometrica"], + "required": False, + "default": "aritmetica", + }, + ], + "outputs": [{"name": "termos", "type": "list", "itemType": "number"}], +} + + +@pytest.fixture +def stage_dir(tmp_path: Path) -> Path: + folder = tmp_path / "progressao-termos" + folder.mkdir() + (folder / "stage.json").write_text(json.dumps(MANIFEST), encoding="utf-8") + (folder / "script.py").write_text(SCRIPT, encoding="utf-8") + return folder + + +def test_spec002_ac13_run_stage_validates_against_stage_json(stage_dir: Path) -> None: + result = run_stage( + stage_dir / "script.py", + {"a1": 1, "razao": 2, "n": 4, "tipo": "geometrica"}, + stage_json=stage_dir / "stage.json", + ) + + assert result.ok, result.error + assert result.outputs == {"termos": [1.0, 2.0, 4.0, 8.0]} + assert result.wire_outputs == {"termos": [1.0, 2.0, 4.0, 8.0]} + assert result.logs == ["INFO gerados 4 termos"] + + +def test_run_stage_applies_defaults(stage_dir: Path) -> None: + result = run_stage( + stage_dir / "script.py", {"a1": 1, "razao": 2, "n": 3}, stage_json=stage_dir / "stage.json" + ) + + assert result.outputs == {"termos": [1.0, 3.0, 5.0]} + + +def test_run_stage_rejects_invalid_input(stage_dir: Path) -> None: + result = run_stage( + stage_dir / "script.py", + {"a1": 1, "razao": 2, "n": "4"}, + stage_json=stage_dir / "stage.json", + ) + + assert not result.ok + assert result.error is not None + assert result.error.kind == "InputValidation" + + +def test_run_stage_accepts_callables_and_files(tmp_path: Path) -> None: + source = tmp_path / "pagina.html" + source.write_text("

oi

", encoding="utf-8") + + def run(inputs: dict[str, object], ctx: object) -> dict[str, object]: + html = inputs["html"] + return {"tamanho": len(html.read_text())} # type: ignore[attr-defined] + + result = run_stage(run, files={"html": source}) + + assert result.outputs == {"tamanho": 11} + + +def test_manifest_loads(stage_dir: Path) -> None: + manifest = load_manifest(stage_dir) + + assert manifest.key == "progressao-termos" + assert [f.name for f in manifest.inputs] == ["a1", "razao", "n", "tipo"] + + +@pytest.mark.parametrize( + ("change", "fragment"), + [ + ({"key": "X"}, "'key'"), + ({"inputs": [{"name": "a", "type": "number", "itemType": "number"}]}, "itemType"), + ({"inputs": [{"name": "a", "type": "enum"}]}, "enumValues"), + ({"inputs": [{"name": "f", "type": "file", "default": "x"}]}, "cannot have a default"), + ( + {"inputs": [{"name": "a", "type": "number"}, {"name": "a", "type": "number"}]}, + "duplicate", + ), + ({"inputs": [{"name": "n", "type": "integer", "default": "1"}]}, "invalid default"), + ({"python": "2.7"}, "'python'"), + ({"secrets": ["smtp"]}, "secret name"), + ({"unknown": 1}, "unknown property"), + ], +) +def test_manifest_validation_errors(change: dict[str, object], fragment: str) -> None: + errors = validate_manifest_data({**MANIFEST, **change}) + + assert any(fragment in e for e in errors), errors + + +def test_invalid_manifest_raises(tmp_path: Path) -> None: + (tmp_path / "stage.json").write_text("{}", encoding="utf-8") + + with pytest.raises(ManifestError): + load_manifest(tmp_path) + + +def test_cli_validate(stage_dir: Path, capsys: pytest.CaptureFixture[str]) -> None: + assert cli_main(["validate", str(stage_dir)]) == 0 + assert "OK: progressao-termos@1" in capsys.readouterr().out + + +def test_cli_validate_reports_missing_stage( + stage_dir: Path, capsys: pytest.CaptureFixture[str] +) -> None: + (stage_dir / "script.py").write_text("def run(i, c):\n return {}\n", encoding="utf-8") + + assert cli_main(["validate", str(stage_dir)]) == 1 + assert "NO_STAGE_FUNCTION" in capsys.readouterr().err + + +def test_cli_run_uses_the_real_protocol( + stage_dir: Path, tmp_path: Path, capsys: pytest.CaptureFixture[str] +) -> None: + sample = tmp_path / "sample.json" + sample.write_text( + json.dumps({"a1": 1, "razao": 2, "n": 4, "tipo": "geometrica"}), encoding="utf-8" + ) + + code = cli_main(["run", str(stage_dir), "--input", str(sample)]) + + out = capsys.readouterr().out + assert code == 0, out + assert '"termos": [' in out diff --git a/python/psrunner/uv.lock b/python/psrunner/uv.lock new file mode 100644 index 0000000..77d1ed8 --- /dev/null +++ b/python/psrunner/uv.lock @@ -0,0 +1,930 @@ +version = 1 +revision = 5 +requires-python = ">=3.10" +resolution-markers = [ + "python_full_version >= '3.15' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version >= '3.15' and sys_platform == 'emscripten'", + "python_full_version == '3.14.*' and sys_platform == 'emscripten'", + "python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.14.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'win32'", + "python_full_version == '3.11.*' and sys_platform == 'win32'", + "python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'emscripten'", + "python_full_version == '3.11.*' and sys_platform == 'emscripten'", + "python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.11.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version < '3.11'", +] + +[[package]] +name = "ast-serialize" +version = "0.13.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/21/d5/5dc1ee8a80c3b20a0b63c61b43ba6bc53517faecd1def47bcd752d22268e/ast_serialize-0.13.1.tar.gz", hash = "sha256:401cc84e8888d4d76f2c8d296fa006ed1a5ff993b6aff90dd777c03973efd025", size = 955137, upload-time = "2026-10-17T00:04:17.183Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f3/a8/fbd136b9f70c59e75f59a8e974c84102976f1201828b4f886480ba956936/ast_serialize-0.13.1-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:3e129d44b0cffbea24a7f40117ce49e30993c3d119e584d4817ebd6f87246456", size = 897306, upload-time = "2026-10-17T00:02:52.479Z" }, + { url = "https://files.pythonhosted.org/packages/50/3f/2ad51e9823a790e7a70fd781e9595ab3abeace27f3aefcaa1939457efd72/ast_serialize-0.13.1-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:523d45bab16ddaf1399c04c4fe81bbf180f81e33c2f7bcbe76be56b0f7311ab4", size = 1236082, upload-time = "2026-10-17T00:02:54.82Z" }, + { url = "https://files.pythonhosted.org/packages/c0/5c/8e959db5cc2237f9d4c560a8e2253c98f9746883fb4774651e4cda458901/ast_serialize-0.13.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:638333fb8ae72c62753f9e794fda20290883ddc65b0d85e26e08f8bb227567ad", size = 1221242, upload-time = "2026-10-17T00:02:56.395Z" }, + { url = "https://files.pythonhosted.org/packages/d6/05/ab1c56c3b7adcac88764bba609502d6b4989e449b2dd60eb478e1d20e369/ast_serialize-0.13.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cc34c670747d85d4232834665e247009413eaebe47c69eaf60a5c439aaecaed9", size = 1282105, upload-time = "2026-10-17T00:02:58.275Z" }, + { url = "https://files.pythonhosted.org/packages/0d/f4/41981fcd2ddffe0760e5326be9dcbd2eda9478a8430a637e5123bd8fcb26/ast_serialize-0.13.1-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8c8ebd419811c435812d242fb2a173e57dfede198c9ac9a0a584666ebc9b9331", size = 1287905, upload-time = "2026-10-17T00:03:00.068Z" }, + { url = "https://files.pythonhosted.org/packages/6a/43/b783addc5681153707121991b7b47892f7e9c8ba58a0d03b71a3b023ba47/ast_serialize-0.13.1-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8899c038b1c15ae8b98e379057fb3ef398ceb0b21d1737a8156dd5a0923b7e51", size = 1541806, upload-time = "2026-10-17T00:03:01.503Z" }, + { url = "https://files.pythonhosted.org/packages/47/10/969db095038ee15270f65ad20d1129c5e4da605bf7e93b70ae640f1c8a9f/ast_serialize-0.13.1-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e14c4de98f965647a74e6eaf37e20207124e45451ccd36e84a6f6ebab45e0372", size = 1309946, upload-time = "2026-10-17T00:03:02.971Z" }, + { url = "https://files.pythonhosted.org/packages/06/dd/7c623d2fb0b868948952d1787e629a43b866f7d4caefd5445e20aefacec4/ast_serialize-0.13.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7f3e8a3eff69af640db985360fef35073fb46956dfc3e5c614cf00920d2746dd", size = 1302773, upload-time = "2026-10-17T00:03:04.378Z" }, + { url = "https://files.pythonhosted.org/packages/d4/c2/4d49469110a19a44fc6269f4fd59679bcf84df068f185f89b73bee4da19b/ast_serialize-0.13.1-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:75d7750fe98f6f35a96c43aba8d98a2e623e22c778a0c17ab9ede92eb10f5d82", size = 1299579, upload-time = "2026-10-17T00:03:05.88Z" }, + { url = "https://files.pythonhosted.org/packages/9d/9a/2d381f1f262dda15affc8ad643fba1619eb07e7d9f8bd904deffef183006/ast_serialize-0.13.1-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:43e8ddd63e80fc280c2f790157386f27f9b9f6ccb9c4f8e803b863cbfb085769", size = 1355969, upload-time = "2026-10-17T00:03:07.321Z" }, + { url = "https://files.pythonhosted.org/packages/9d/9c/2266794e6c25fa9ce51ce04a9bf4b7e330e3ac9351ba3fa14e487678acdb/ast_serialize-0.13.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:9221e09496fb942901993c1812ee87950cc0ecbb514c7c0f1f5fa6d78f701ed8", size = 1460227, upload-time = "2026-10-17T00:03:08.733Z" }, + { url = "https://files.pythonhosted.org/packages/2b/d6/14deb28e5d8f328f626a0778ea2cf98fe908f2bbcccd804cb6f449ee1782/ast_serialize-0.13.1-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:7a5c38bdb93669c596f94fb7204dd6ebe4fadb19058ac9a2faf2948c2a175f96", size = 1562691, upload-time = "2026-10-17T00:03:10.25Z" }, + { url = "https://files.pythonhosted.org/packages/f5/19/7a28c0e5ba54f0d3e054f847a2a549b748cb179ab433321a8dc1b39e398d/ast_serialize-0.13.1-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:acf4e9f055d75058ab01536da330648746f2f82b7697a85230547f2d5ebe895c", size = 1558669, upload-time = "2026-10-17T00:03:11.799Z" }, + { url = "https://files.pythonhosted.org/packages/18/9a/f9e2690eab58217f1d395a964a78efa7eaf813a1e38be8dfd9a8d45d0840/ast_serialize-0.13.1-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:87427913c325adc811e81e7c9a757b061f47ef1e29114ac479aa0953a2687a98", size = 1665071, upload-time = "2026-10-17T00:03:13.284Z" }, + { url = "https://files.pythonhosted.org/packages/8e/f3/ef5b159a0d7161b404f05e7ec21cf7735ee7edc10c000cd2cbbc7bb6b69a/ast_serialize-0.13.1-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:ad88921f95b92bc144d9ad059a0e16f8c1ae69f5239f2d3c6536fd2774f73dfe", size = 1473364, upload-time = "2026-10-17T00:03:14.563Z" }, + { url = "https://files.pythonhosted.org/packages/1d/87/6e8ac4a865124a12cc4f915bf1bcfac3bba426cd5f58d3712a873ee61012/ast_serialize-0.13.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:f8b17e2921e56621bcb46792bd3e0b82ca3b85de78d5936e7b8174ba1758b0aa", size = 1500566, upload-time = "2026-10-17T00:03:15.917Z" }, + { url = "https://files.pythonhosted.org/packages/f5/1e/29155f1621433008013ad5c940a03d41a676be0680c41527040472d37583/ast_serialize-0.13.1-cp314-cp314t-win32.whl", hash = "sha256:2f9a9ce8b0994f757b941f7f7fe384a6666b4162b941ebc5c248081baea18e47", size = 1128674, upload-time = "2026-10-17T00:03:17.481Z" }, + { url = "https://files.pythonhosted.org/packages/bb/64/2506da65143ea138de5822e9173e0b72320a2f70e23bd723f044033175f1/ast_serialize-0.13.1-cp314-cp314t-win_amd64.whl", hash = "sha256:5d99910e6b9a9b9360bcca2ae99aee36cc912ce058df2a57d1c33099b6cb2593", size = 1163306, upload-time = "2026-10-17T00:03:19.046Z" }, + { url = "https://files.pythonhosted.org/packages/6d/8f/c7cb22638899b0cf15908809c270560e46395e65604bc59e4b623ab9f405/ast_serialize-0.13.1-cp314-cp314t-win_arm64.whl", hash = "sha256:a789cbe14d0a0e9ec9b32a456e5abc81ad8799479c3cfd88a29e3442262aebe6", size = 1133775, upload-time = "2026-10-17T00:03:20.377Z" }, + { url = "https://files.pythonhosted.org/packages/2b/e2/b0c140fe50fa39dd249e382f7733af6f816c90021fe7959a0b026f86237f/ast_serialize-0.13.1-cp315-abi3.abi3t-macosx_10_12_x86_64.whl", hash = "sha256:23d768369b89d551077dc173da6892fad00443338417523b6732f4e8ba4a7ed5", size = 1236160, upload-time = "2026-10-17T00:03:21.945Z" }, + { url = "https://files.pythonhosted.org/packages/23/c4/a8a2ca21e3943555b48221f8fba546877a7ad39efaf6505506524967d7c4/ast_serialize-0.13.1-cp315-abi3.abi3t-macosx_11_0_arm64.whl", hash = "sha256:68f8829d114dab6c9db4a8bbb8d0e342958faee1b5e15a29022678df639960f8", size = 1222214, upload-time = "2026-10-17T00:03:23.462Z" }, + { url = "https://files.pythonhosted.org/packages/15/19/2f58f2ba64e4799b39de85c140aef09a03aa6ea53be75dd292a9d9b9d8ae/ast_serialize-0.13.1-cp315-abi3.abi3t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e385b17d5bde892a6184003a9aff3518387908b73f8f5ea539313c07c8c0ede", size = 1282979, upload-time = "2026-10-17T00:03:24.695Z" }, + { url = "https://files.pythonhosted.org/packages/b1/af/ca6087fe84210c1ccd43e3182917bb70649fa1e69745a90c1d59ba08fea8/ast_serialize-0.13.1-cp315-abi3.abi3t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:02686b281ec9b8e9614f6f0db27e12e4cac515f336c5d05b678bc9eb73ff2af5", size = 1288596, upload-time = "2026-10-17T00:03:26.04Z" }, + { url = "https://files.pythonhosted.org/packages/b0/2c/4ef964c763329a0347125e745ec0451ba4fbaceec9efe2ac729b7cd55f17/ast_serialize-0.13.1-cp315-abi3.abi3t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a8ab2c2585b2e22e48cd4aff2136fce4eab4ced569b85f150ef9a5a5d6f34d49", size = 1545540, upload-time = "2026-10-17T00:03:27.52Z" }, + { url = "https://files.pythonhosted.org/packages/bb/85/aa961dbb75813cfa94de0ce9a16a9510c226b95f604c405421e727f44bb0/ast_serialize-0.13.1-cp315-abi3.abi3t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c652d9f5d52d8b81eff3ff2c95c9dd0f281de45f6ad5d3fa95527550c396454a", size = 1309374, upload-time = "2026-10-17T00:03:29.091Z" }, + { url = "https://files.pythonhosted.org/packages/b4/e6/f2b67c327d9f9533e41791804403ccc2dc457821195a2e51f0b587a90b90/ast_serialize-0.13.1-cp315-abi3.abi3t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:121e1d08d58b75c15491cc3003609cbad71ac2b0016043c36d30a6b2032b6605", size = 1303466, upload-time = "2026-10-17T00:03:30.451Z" }, + { url = "https://files.pythonhosted.org/packages/73/1d/33f18b81d1bb1f5d682943ea92fda8130a6593627f12f6201668d40824fd/ast_serialize-0.13.1-cp315-abi3.abi3t-manylinux_2_31_riscv64.whl", hash = "sha256:30cf89b6a6844542d116c758725d13de5b97b9410a51ee577715f761270d0c1c", size = 1300576, upload-time = "2026-10-17T00:03:32.102Z" }, + { url = "https://files.pythonhosted.org/packages/25/cb/64914144925f1a4abdd9217e717b122255c38fc5ebe4342f92052f3bacbc/ast_serialize-0.13.1-cp315-abi3.abi3t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:732aaae9e498c973fc63fd7f308009b57c4afa6ff59d0b674d894e57d0bca01a", size = 1355960, upload-time = "2026-10-17T00:03:33.676Z" }, + { url = "https://files.pythonhosted.org/packages/ee/80/bd29379fab2bce19adc0bf9177002b11b23dfe8d8fecf409998b458b4624/ast_serialize-0.13.1-cp315-abi3.abi3t-musllinux_1_2_aarch64.whl", hash = "sha256:d9c1a920b2aa0c1e016bed7721689717034ca0dba64ac3a3ff243b003d4e8dd8", size = 1459779, upload-time = "2026-10-17T00:03:35.09Z" }, + { url = "https://files.pythonhosted.org/packages/83/89/012dbe733de05ffdf8e40ca0f9fa5d417cb16ec93a74463c57c001914198/ast_serialize-0.13.1-cp315-abi3.abi3t-musllinux_1_2_armv7l.whl", hash = "sha256:847cad4c22953823f5e76d0b126c6f9da670cfa45b1df41b9324e22189d77611", size = 1563399, upload-time = "2026-10-17T00:03:37.285Z" }, + { url = "https://files.pythonhosted.org/packages/69/37/ee4bcb0358bee38744eb0f18560446572d095fe3bf6b63d6f739d08a839c/ast_serialize-0.13.1-cp315-abi3.abi3t-musllinux_1_2_i686.whl", hash = "sha256:aca07de3ca8e3d9f2b716c3c31f4f384fe4bd2d03e09912417cff7a3e08036f7", size = 1558808, upload-time = "2026-10-17T00:03:38.711Z" }, + { url = "https://files.pythonhosted.org/packages/54/1c/ff44c5355251d61ef22934c4430bb31a61de4781d25a992154aac9b8c82a/ast_serialize-0.13.1-cp315-abi3.abi3t-musllinux_1_2_ppc64le.whl", hash = "sha256:5db12d843d931b9d1f1519ce66b9cbfe72d8563b75c1204d255322254d1964dd", size = 1666324, upload-time = "2026-10-17T00:03:40.376Z" }, + { url = "https://files.pythonhosted.org/packages/c8/bb/6da4bfc8aa3403e6447607131bf3463acaf954d990c6c8b6787c1902ddfe/ast_serialize-0.13.1-cp315-abi3.abi3t-musllinux_1_2_riscv64.whl", hash = "sha256:fb8021f4dc3296de18737e3b8b34994411da725374d74a0b9eb32a738f2a23d0", size = 1474089, upload-time = "2026-10-17T00:03:41.715Z" }, + { url = "https://files.pythonhosted.org/packages/21/97/897e33bef2eefd880e6350e375cc66bc5bcd00a139be480fd655f5b3f095/ast_serialize-0.13.1-cp315-abi3.abi3t-musllinux_1_2_x86_64.whl", hash = "sha256:0d764913374ba21df8cd618045b371ed104ce55c6276de7c59e554a4f5ba26fd", size = 1501542, upload-time = "2026-10-17T00:03:43.08Z" }, + { url = "https://files.pythonhosted.org/packages/8d/4c/821211ac83870c27e4412381b7c7838336456b40575bf840e4680b2018d9/ast_serialize-0.13.1-cp315-abi3.abi3t-win32.whl", hash = "sha256:2bad302ae2427454ef9dab71bd5c3ad67188860c39d36daee38f72031edb39c4", size = 1126118, upload-time = "2026-10-17T00:03:44.616Z" }, + { url = "https://files.pythonhosted.org/packages/1f/86/2b2d5e6c4fa352874a80618e742ffd32d249dee6c119f4233b51afc6b8f4/ast_serialize-0.13.1-cp315-abi3.abi3t-win_amd64.whl", hash = "sha256:032b09d86c785c3984e975378b7861f2a68ac44e22ba7b07b93a536b2524eeb8", size = 1163766, upload-time = "2026-10-17T00:03:45.986Z" }, + { url = "https://files.pythonhosted.org/packages/77/a3/d610cfcdabaa44fd62a54ca1fc57a7dba120643798b089a14914973562de/ast_serialize-0.13.1-cp315-abi3.abi3t-win_arm64.whl", hash = "sha256:929eda0c419e622ab49df3a4c45f81c57dcc10874bbad55d0470a4a03324dac3", size = 1134043, upload-time = "2026-10-17T00:03:48.453Z" }, + { url = "https://files.pythonhosted.org/packages/f0/89/0e30f9eddf7d44ccf9d25979030754fd0457af61fa4279acb8c293a04f97/ast_serialize-0.13.1-cp315-cp315-pyemscripten_2026_5_wasm32.whl", hash = "sha256:bf53a3ba1cbe45399fc1e4ccd684b8f2a11cca450f89706b79122f478534c6f5", size = 897546, upload-time = "2026-10-17T00:03:50.093Z" }, + { url = "https://files.pythonhosted.org/packages/81/92/d705be88ff452b9ba0088b554a0cbd308fd01879da092b33fd2ad7d1aa60/ast_serialize-0.13.1-cp39-abi3-macosx_10_12_x86_64.whl", hash = "sha256:4bcf1d5f4eefecaa325a34ecf079b2741189e7d0821523f92cb343a389a67489", size = 1242416, upload-time = "2026-10-17T00:03:51.521Z" }, + { url = "https://files.pythonhosted.org/packages/60/c2/98370845a7f35cb8a25782e78284b48e01bf3128339881d48d613f304f8f/ast_serialize-0.13.1-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:1b158f1c9e3a0d386913924c57995d6df78224868a4d0f215bdd41587c97b34a", size = 1229729, upload-time = "2026-10-17T00:03:52.825Z" }, + { url = "https://files.pythonhosted.org/packages/d8/8b/2d7ffed76addd9d3fcf37fb171400942735c8912264c763561a85407f6a8/ast_serialize-0.13.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77a6201b69ce42e919f2fd9a559138d5410b5d8afff7c3a6b1f500b0481ff7d8", size = 1292255, upload-time = "2026-10-17T00:03:54.148Z" }, + { url = "https://files.pythonhosted.org/packages/6b/2a/bb9e0e719d89cc950fadfcfcc9cb4bc7640419c4228c852f031ab8abf440/ast_serialize-0.13.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:6eb0be64c9b8f1ed26637eef345abe75ea90351c92c85a8aec7838b3af971011", size = 1298501, upload-time = "2026-10-17T00:03:55.559Z" }, + { url = "https://files.pythonhosted.org/packages/7a/32/13ce07dce48226f5bd9cfd8f708ec101a8be05aa430cda4918ce31ce8c82/ast_serialize-0.13.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7f2427bddfca208e84de700044fadf9aef2769a70bae740a1bdabb89ee9e1117", size = 1553758, upload-time = "2026-10-17T00:03:56.952Z" }, + { url = "https://files.pythonhosted.org/packages/e2/fb/9b51d186db0c20ca28cbaaefd50f03b573c89327b9a2627820cbce22196b/ast_serialize-0.13.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:88df960e67184a71874e5b2ee014f87d1254a0dbc1f903c7bd7b1ab7733ecaef", size = 1318258, upload-time = "2026-10-17T00:03:58.418Z" }, + { url = "https://files.pythonhosted.org/packages/c5/fa/da311559dd3dae9af5825cf21660775a929b970f72e3786af3f2cd667944/ast_serialize-0.13.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9f99786e0d62082a5b121b3437f3167562133711df22128de1e9886f57f0b226", size = 1313260, upload-time = "2026-10-17T00:04:00.194Z" }, + { url = "https://files.pythonhosted.org/packages/2b/11/97a4b9e5b4776d72f47fcd9a09a497bbf68ec8c1ae074307a2c51e410d85/ast_serialize-0.13.1-cp39-abi3-manylinux_2_31_riscv64.whl", hash = "sha256:a01b515b25a03184eff4acef25b981ae007916379682e908fc8785b342a0bf3e", size = 1309992, upload-time = "2026-10-17T00:04:01.575Z" }, + { url = "https://files.pythonhosted.org/packages/2e/c4/62f85121a80cd451ef04f550cf0f7ea0ad9ff46cc4e9a5b9ae439b6527b1/ast_serialize-0.13.1-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:29422d7bcd9e7f39411571c36cec45ce8a7a9b3ad4b2e7aa64497c15a9e397f6", size = 1362715, upload-time = "2026-10-17T00:04:02.881Z" }, + { url = "https://files.pythonhosted.org/packages/c1/fa/c5f4a545f72a7681e3295bab6e3600ee0862ec4391bed961fe9f735b67e0/ast_serialize-0.13.1-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:6ffb0f548a7dc126067fdfb7b2325ab5dfcdeecc29faf5e0f0461c96d6ebfa3d", size = 1469931, upload-time = "2026-10-17T00:04:04.181Z" }, + { url = "https://files.pythonhosted.org/packages/38/a9/65aed4f8fa7a001a7cfdc03e68e844517ab041ba6fb614b7d78a1d6ac056/ast_serialize-0.13.1-cp39-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:2876444a5f87a7c76f371af3c07c2fda563a08bc8af52568df812e8aba4bf568", size = 1570945, upload-time = "2026-10-17T00:04:05.778Z" }, + { url = "https://files.pythonhosted.org/packages/fb/8c/44b2da991cede79bfbf52089f33a5f0168945466b3d9cd38b5dcf08e7130/ast_serialize-0.13.1-cp39-abi3-musllinux_1_2_i686.whl", hash = "sha256:885a62ec6481ce58ab24c6357360d7a82023b62dd7e5e7ceccf59e9662a3272b", size = 1569978, upload-time = "2026-10-17T00:04:07.347Z" }, + { url = "https://files.pythonhosted.org/packages/46/e4/109b2a5beca700237767d5add920c2f8e1ba9bd5799b0faf143d0e9cf4ef/ast_serialize-0.13.1-cp39-abi3-musllinux_1_2_ppc64le.whl", hash = "sha256:2015fd0165e463aac3b1aadc6a1fa1e5820c14ca950821f4fe02f8a3f6a388d6", size = 1676082, upload-time = "2026-10-17T00:04:08.7Z" }, + { url = "https://files.pythonhosted.org/packages/73/e0/7df70f6dbb11b5762da5416318f08316a1c51348e0d69ec79ca5f98f836a/ast_serialize-0.13.1-cp39-abi3-musllinux_1_2_riscv64.whl", hash = "sha256:eb41e1906502ac80d24ff343f45008552a3f5b5158607959fe6a07dbfc6eb037", size = 1483207, upload-time = "2026-10-17T00:04:10.162Z" }, + { url = "https://files.pythonhosted.org/packages/1f/bc/523aa1c08bd69b5654621beb3dc1a9035715a4a63762fb8d219d6fb3eb81/ast_serialize-0.13.1-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:ca9acc67f796aa2554fa3037dccc022a4b08b38b2ad153edfac9c9bb7cb1f3c6", size = 1512140, upload-time = "2026-10-17T00:04:11.589Z" }, + { url = "https://files.pythonhosted.org/packages/66/83/6607060659998f00afdea0d8375c1e6e2b7d515ab905090d9a5a02f48851/ast_serialize-0.13.1-cp39-abi3-win32.whl", hash = "sha256:4f98da562e5901d69c7dd30885594c5438f859edf354e9ac7517d188fb026c3a", size = 1131889, upload-time = "2026-10-17T00:04:12.953Z" }, + { url = "https://files.pythonhosted.org/packages/9f/6f/bafd6490fe7b355627fabe95f4417e3d02da93102c8552550eb9a0774e1e/ast_serialize-0.13.1-cp39-abi3-win_amd64.whl", hash = "sha256:ddf7cbc9c8abf70102c4a088efe154bb86bfb825b0a10e556d2b15972cf99bd7", size = 1171153, upload-time = "2026-10-17T00:04:14.362Z" }, + { url = "https://files.pythonhosted.org/packages/11/25/4235f4b375a67a37ac595bf478a5407a744eaf7b64113c1c3a5432b8d954/ast_serialize-0.13.1-cp39-abi3-win_arm64.whl", hash = "sha256:48f11d96c9ec71119612f8e79a8c55c12f2b136716d68347433c561d27a25f43", size = 1139035, upload-time = "2026-10-17T00:04:15.767Z" }, +] + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, +] + +[[package]] +name = "exceptiongroup" +version = "1.3.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/50/79/66800aadf48771f6b62f7eb014e352e5d06856655206165d775e675a02c9/exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219", size = 30371, upload-time = "2025-11-21T23:01:54.787Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/8a/0e/97c33bf5009bdbac74fd2beace167cab3f978feb69cc36f1ef79360d6c4e/exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598", size = 16740, upload-time = "2025-11-21T23:01:53.443Z" }, +] + +[[package]] +name = "iniconfig" +version = "2.3.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/01/e1/2069291243c926a2ff1cd706c7f3eeb9b62144bf60f77c9fb9ff2fb26bd3/iniconfig-2.3.1.tar.gz", hash = "sha256:67f4b9c50da0dedf52af349e7749a80a9057a5031199791b906c3bb3ae878960", size = 21209, upload-time = "2026-10-06T22:48:38.076Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/56/43/4ca9e49d27a1fcf6bece6f6aec0ea46bb9112489b93d4b688fb415457bdb/iniconfig-2.3.1-py3-none-any.whl", hash = "sha256:9121e2c1fdb355232495be3194c8dfe87ccc2d5dee45947b78e68f499790d7a7", size = 7552, upload-time = "2026-10-06T22:48:36.959Z" }, +] + +[[package]] +name = "librt" +version = "0.16.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/04/f5/9dc696772d241814bacac7880bac32f2930b5a6ebc1f85317b83161a011c/librt-0.16.0.tar.gz", hash = "sha256:ac38d6d8d66bf3d744148dbbc0b8e193e195a51e364ed55e224631f5721891fc", size = 219839, upload-time = "2026-09-29T00:55:32.891Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ec/77/900294b3c9a81415323d81b3f3f271a7f5d7ed9d01e824fc38ffa49470b6/librt-0.16.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:96f576f2711f8519152ec76d0e599243555c1f07679fa73606ca8c8c868c0be6", size = 148668, upload-time = "2026-09-29T00:44:20.282Z" }, + { url = "https://files.pythonhosted.org/packages/55/3b/c301e8cc47758e4518b93e926a0111080155cc79fa03651d202ac2025065/librt-0.16.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2bec3818c7da7c96ceae0ef5915a3d16c52dd08f3ea913bf1fe8568c447c7978", size = 153562, upload-time = "2026-09-29T00:44:21.672Z" }, + { url = "https://files.pythonhosted.org/packages/62/b1/4d5b98114a58bf17e3832cd33400e40f2582f68c2fb7ce25b4468cb1afd3/librt-0.16.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:64c79520414a3fdfc6aabd7593e6169afa14d5f8d9908d4b498db068868b08dd", size = 494337, upload-time = "2026-09-29T00:44:23.096Z" }, + { url = "https://files.pythonhosted.org/packages/88/36/14223c9b0dc38982eb4f399732c8cb27b19c7e027ae0faef5ca51d08d19f/librt-0.16.0-cp310-cp310-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:f81b5b19ce748ef68d4746656b7929762eb2fe99269b266e4be07e2ee4de7144", size = 485440, upload-time = "2026-09-29T00:44:24.555Z" }, + { url = "https://files.pythonhosted.org/packages/ec/9e/d7155e6800d0c33e297e529b217649f7361d706491ebf9d2fc0fc627309e/librt-0.16.0-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c71d1b76210a36729fedfc5115069b50a3d8619054745f8758fe5d6f19e86671", size = 498363, upload-time = "2026-09-29T00:44:26.03Z" }, + { url = "https://files.pythonhosted.org/packages/d3/ce/d5f1fb9f913ac0979d6fc5db9fb9c0bf28cc3470988528957922f15ed40c/librt-0.16.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:473eebc7866bb0a0c8849a292b5e7157c1aba5d14d0f0f610c52158d6d964262", size = 515453, upload-time = "2026-09-29T00:44:27.566Z" }, + { url = "https://files.pythonhosted.org/packages/b4/d4/ca0fca1a27c26080d1a25b2b31f271e532078a5719878c3daca0c3d4c539/librt-0.16.0-cp310-cp310-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:4eb1313a19847089ee81e88742abedf285c60538816640b99742d8534b81d26a", size = 509537, upload-time = "2026-09-29T00:44:29.14Z" }, + { url = "https://files.pythonhosted.org/packages/ee/c0/26807bf2221a53a2c66f2e23a5c4d57f1c0eaa4afed7cb81d841cf3d1903/librt-0.16.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:ebefd60b42e2a82b32d136bb5f7c94eadfcd29f772b547df6f3291d1ed855a1c", size = 532541, upload-time = "2026-09-29T00:44:30.745Z" }, + { url = "https://files.pythonhosted.org/packages/0e/50/c329d509907e1bc061abeec3796f94d255d43ba25d28c3854d2138ed5ab2/librt-0.16.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:6c5da27e8056439f927ea896735da60e616c477a8293feaa3233d4e7781a6726", size = 537059, upload-time = "2026-09-29T00:44:32.102Z" }, + { url = "https://files.pythonhosted.org/packages/84/d6/4571b9c9e65d98e5503734166dce2fd3e216f526dc3c59a3773faa8a60e3/librt-0.16.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:67e718c7a43f8db325abbbf1404e2d535f12f8f7a1a82259568385cc5274b82a", size = 536614, upload-time = "2026-09-29T00:44:33.653Z" }, + { url = "https://files.pythonhosted.org/packages/c8/d3/a2ed8a292e4ab7889792a9c3f4ad5d1caf6557afce7f6b452e77f8ed20b7/librt-0.16.0-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:314e703f0c19320dc8094e7a784b9cf29e1b67402515abf580069a6363c0b4f1", size = 517199, upload-time = "2026-09-29T00:44:35.115Z" }, + { url = "https://files.pythonhosted.org/packages/9e/24/276e5218b4b7adb6258a42b7403cb1b7cef25616238d0c2152288a9d2f53/librt-0.16.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:943c6bbecbdf7fa575a4f2952fcfd848c88ef95507c3fca411e89d4ac3ff8143", size = 558746, upload-time = "2026-09-29T00:44:36.656Z" }, + { url = "https://files.pythonhosted.org/packages/7c/5c/9156df81a1726e1efc9567379def2b8777a6d56f464d2f1b760bf951b8af/librt-0.16.0-cp310-cp310-win32.whl", hash = "sha256:7cc365f006891afb006b52d5ee5ee74c09306ffa20e2f8705a32a4450af2f3ba", size = 104424, upload-time = "2026-09-29T00:44:38.123Z" }, + { url = "https://files.pythonhosted.org/packages/0b/62/4fd172cb3f49ab2cf5ef17de519a93cfb935202c1270ba9d44c6a64178c3/librt-0.16.0-cp310-cp310-win_amd64.whl", hash = "sha256:0314058469f4d2fd279ce7c62ac274ac82c3918ef7db62ef0697c4c359370155", size = 124267, upload-time = "2026-09-29T00:44:39.455Z" }, + { url = "https://files.pythonhosted.org/packages/ba/0e/b04fd2d76b6a78a02286938251b2c119fb36ddece92c76cb4886ef7d44b8/librt-0.16.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fe4372c52d4849096c6cc1cda2817d293ec51440c890474ed59ef38d46556f18", size = 148058, upload-time = "2026-09-29T00:44:40.903Z" }, + { url = "https://files.pythonhosted.org/packages/a3/fc/e1ed24aadb32d38603c0c07f579d739eb4d90e64e90d525b024e4a999b4d/librt-0.16.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c72c5295a84bd249526da9bdca38f2e176d15c31c13bb0063c5053f4ca023421", size = 153073, upload-time = "2026-09-29T00:44:42.165Z" }, + { url = "https://files.pythonhosted.org/packages/be/38/133ab655409420e0c34a9a9836a7f4e5ae75fba758d7fe177099130d58ba/librt-0.16.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:be56ba9c884143495b517f23fe794ae367d58cd89ea0fdd6d437e3c024a87f9f", size = 493052, upload-time = "2026-09-29T00:44:44.043Z" }, + { url = "https://files.pythonhosted.org/packages/94/42/aaa663bc9421f5bf7bbbe9d3316d7219749698ec7688ac3b519770a89c04/librt-0.16.0-cp311-cp311-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:ef46c1a29ffb8c72e882e22618ec618778eacd0578fb22c6e7cf9c11d15f357b", size = 485506, upload-time = "2026-09-29T00:44:45.479Z" }, + { url = "https://files.pythonhosted.org/packages/7b/59/83a6eb5087ba8b45b083859e2085256963e06d4c2531944cdd962670bfb5/librt-0.16.0-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:d3c94211ee0c4f8d649ec06b7c115c0ec4eadb873a0e3154ca15cef3f814b071", size = 498708, upload-time = "2026-09-29T00:44:46.916Z" }, + { url = "https://files.pythonhosted.org/packages/a0/e4/15a8d62b2bc12935080ec7277e2e0b9b233047781eb784a51d3e25af669a/librt-0.16.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:94aed6a8308818b91677957d1bd03188869cd7aeb23c5dba7912a6c0402f7602", size = 515981, upload-time = "2026-09-29T00:44:48.316Z" }, + { url = "https://files.pythonhosted.org/packages/46/4f/287cc282ac5dd815204c0779e79401bb0a568c3a1335fb319bf0838fb566/librt-0.16.0-cp311-cp311-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:349c0bcb87ebd07481b6ff781e25cdc699723dbe2212e57dabb27f7a13b7b87d", size = 508670, upload-time = "2026-09-29T00:44:49.726Z" }, + { url = "https://files.pythonhosted.org/packages/bf/5b/ab7292add898ade0d2b5b75d32a923aae315861671aa5c39f5491309f7ae/librt-0.16.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:001bfd59a7d45b17e3e75f2a8c6405280b35e7b84471792778e718c4f368950e", size = 530393, upload-time = "2026-09-29T00:44:51.356Z" }, + { url = "https://files.pythonhosted.org/packages/7a/9e/8e6bcf027d4bcbc16a4e864b3d158a1d3e5f55ffa53af0238020cad89271/librt-0.16.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:28e038895b998d7a0c7798922ce8a1dc157675df5cf1c9ef0aca809ed804b7a1", size = 534302, upload-time = "2026-09-29T00:44:52.893Z" }, + { url = "https://files.pythonhosted.org/packages/96/a4/8c5ab4f3b3a8e905ff8305d76976a2e666f52fe049edd398aed2402beb36/librt-0.16.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:0dbe4096a7ecc00fa835d24510ad8545a4efef738dac96e0e63516783ccde905", size = 536150, upload-time = "2026-09-29T00:44:54.421Z" }, + { url = "https://files.pythonhosted.org/packages/ea/5e/7c4bc267e3cd4b8bd288de9f62d61fff203829c9cc649ea2aa12e9218cf0/librt-0.16.0-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:5cd5b092441053364af968ea12084692cb9d4a22f3ce9524e377880bf028761e", size = 514316, upload-time = "2026-09-29T00:44:55.998Z" }, + { url = "https://files.pythonhosted.org/packages/e0/75/c8bc6b50f43c73819334233f5a3259c81216742cef56d2140c3dd377c3f0/librt-0.16.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:3ddeb3c9dedb461bb457c6c7d9aa7fbf35329da313d1a7543d00c8d0f3473c96", size = 557731, upload-time = "2026-09-29T00:44:57.581Z" }, + { url = "https://files.pythonhosted.org/packages/93/fb/e241f91bc8de6c7ac1c6a20ea6dd381bc52312b44d711ffcd97140db1e57/librt-0.16.0-cp311-cp311-win32.whl", hash = "sha256:e05108e0849966f53a8d2d3112a7af881d0efaa479bc735bba91108f9f2350a7", size = 104922, upload-time = "2026-09-29T00:44:59.078Z" }, + { url = "https://files.pythonhosted.org/packages/d1/38/c892383d2bb1a6a80b2ec8ede84970a265a792c56614a06282bf3008517c/librt-0.16.0-cp311-cp311-win_amd64.whl", hash = "sha256:5f49cff01bd608ef7d97104cb035c75455e79c2d70bf4a506cf773338ac1860d", size = 125093, upload-time = "2026-09-29T00:49:01.621Z" }, + { url = "https://files.pythonhosted.org/packages/e4/56/8bbde1ed0b21480163617648f638fdaec9374cf5e9c846ebcee34ec02a42/librt-0.16.0-cp311-cp311-win_arm64.whl", hash = "sha256:1d28ae980ae2218f9c5b95d191e947296f918c9bf0b400d467a9430275bbe678", size = 115910, upload-time = "2026-09-29T00:52:40.131Z" }, + { url = "https://files.pythonhosted.org/packages/ad/76/bbdaeb87b7c47b5c7343e90222b9bfa4e4a8a83f647e02933ad0129225b1/librt-0.16.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:fe52bf4641069e7978a14253b036cb9002def1926317e710f2e249f8a8c47742", size = 151028, upload-time = "2026-09-29T00:52:41.508Z" }, + { url = "https://files.pythonhosted.org/packages/fd/0c/ab8ed3dab0085931aec4a792c7eaac8dc6c5ff4691fda3a5360d9d8a9cd2/librt-0.16.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:5bcc2c4726ced915b00de0c9856a4eeabfb3fddb93e10e0b8f735b7709358b6d", size = 155283, upload-time = "2026-09-29T00:52:42.873Z" }, + { url = "https://files.pythonhosted.org/packages/eb/36/494e79d460c80c1f030661e8287c9eca5e1ad652dc2b2180b6cd42abce0a/librt-0.16.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ff7baa55f8e7c69851419e50a666015d02a74198716fd45c0125a2112e0a389f", size = 503185, upload-time = "2026-09-29T00:52:44.638Z" }, + { url = "https://files.pythonhosted.org/packages/9b/34/a8464038dd9db6e4381fa2b6eb73dc9a50888d77102c4c139304ac35cddc/librt-0.16.0-cp312-cp312-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:b95d5d92ab83d39e760a52091bb1baba664f3a2351e39b1e16801e5747c2f0e9", size = 496738, upload-time = "2026-09-29T00:52:46.441Z" }, + { url = "https://files.pythonhosted.org/packages/6a/53/e0e5e334ef0c6ed27039d323819368b9ef6712be87d55ee2bf9799398afd/librt-0.16.0-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:b6d085d70bce51d43c5c7c36d63490770180d8779e71c49305c87b4213918de7", size = 513818, upload-time = "2026-09-29T00:52:48.068Z" }, + { url = "https://files.pythonhosted.org/packages/ad/f7/7ce72cbf19d0addd05090b339152fd0548a02562c2866a603e6e3b3da2df/librt-0.16.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:36e53948e99bbe3ffea257124cfcae1cfb01831555c9a9c903c9f9a72db7fd07", size = 531952, upload-time = "2026-09-29T00:52:49.816Z" }, + { url = "https://files.pythonhosted.org/packages/83/22/0b1bcb6a8e723c8b4fd60dfc8ae8ec6461c54073fbc8685efeb8d900d407/librt-0.16.0-cp312-cp312-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:54d11f726aae9df5a6ffbbf0a03a52449bbac84a53ef03669cb41cdfd4ae41bf", size = 524465, upload-time = "2026-09-29T00:52:51.354Z" }, + { url = "https://files.pythonhosted.org/packages/64/2e/e9c23b8b9df1813da1be205deca9606beb7ddd033972246cd426d05374a0/librt-0.16.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:4323193ac0cd025f85af531df8ba91bf24d1973b401697347a6282e8fd3fcf5e", size = 543191, upload-time = "2026-09-29T00:52:53.284Z" }, + { url = "https://files.pythonhosted.org/packages/bc/e5/6a8b21b342c03ed7e230fa3afbfd2edc58e6e87ef1f0d11fa2b9a748c252/librt-0.16.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:e42f8e098b9c5396fefa05fb1cc7e33b0e08fc51da106b5de4a45fd22aac6743", size = 546979, upload-time = "2026-09-29T00:52:54.932Z" }, + { url = "https://files.pythonhosted.org/packages/84/9e/b5129023eced1be01e01c22757f53be551d463b1bb7264f787927404c1d6/librt-0.16.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:39ec1d5a14e37baf1450a6cabf03fe552340808bf1ad9d71824ab90117716459", size = 555317, upload-time = "2026-09-29T00:52:56.869Z" }, + { url = "https://files.pythonhosted.org/packages/71/89/28bba5938c725fe91f06bf93f7fa6c6b150229df53a87b454b0d5c2a796e/librt-0.16.0-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:d1aabe3925cbb4a08d15b7b20ba4011b53019da0c4173a25155139b7b1baed65", size = 535846, upload-time = "2026-09-29T00:52:58.475Z" }, + { url = "https://files.pythonhosted.org/packages/22/92/63773026614f888c5d4e370e395ce42ca604b89f70b3acdfedbf94851b80/librt-0.16.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:300c3ffdc459f4a779a8411ecb188e3ac0b1ff3a3a7b099642555dedae06c69b", size = 573700, upload-time = "2026-09-29T00:53:00.127Z" }, + { url = "https://files.pythonhosted.org/packages/66/8f/347d4677eefb57cd9f8e01d95a1dcee9a91b4e44e664173c32ff6f3752e5/librt-0.16.0-cp312-cp312-win32.whl", hash = "sha256:c17194318e4c0c0348b36f36c2ec7534436fe0a4c15582403162a4f08c80797a", size = 106158, upload-time = "2026-09-29T00:53:02.031Z" }, + { url = "https://files.pythonhosted.org/packages/f0/2c/5193dc81127cd5ddfad031391b046bf32dda219b38463ab872407ca30646/librt-0.16.0-cp312-cp312-win_amd64.whl", hash = "sha256:25a58a19ea8d83b68209f04912df765e9260635ef77646542ed4b4abe6bc7940", size = 126176, upload-time = "2026-09-29T00:53:03.445Z" }, + { url = "https://files.pythonhosted.org/packages/ff/3d/9668a400c8dd81d162eba38b33fa49fa6205f1a64493570a13fbb815c3ee/librt-0.16.0-cp312-cp312-win_arm64.whl", hash = "sha256:f7be7cf555bc30ec12622e9447299cc4a9b8ff307548b634794353db0c2065dc", size = 116572, upload-time = "2026-09-29T00:53:04.815Z" }, + { url = "https://files.pythonhosted.org/packages/46/cd/ae5e0e9dba45d1399aa04a5395bcc0bead40d9fa06dc903634a7b4d7473d/librt-0.16.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:c5e6144e68b577f157519f2ba88ca20e3ed61c29b00e5cdfa76cd2d45acf059a", size = 151036, upload-time = "2026-09-29T00:53:06.284Z" }, + { url = "https://files.pythonhosted.org/packages/41/5a/48a16e323c5f9447a94cce7b59babf60fa04e62c3365ecf060c77ed8b320/librt-0.16.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:33f41443a1f4e1f099331b3d8120e409fbff84b9760bc1cc9ea496f37ddaa5cc", size = 155211, upload-time = "2026-09-29T00:53:07.72Z" }, + { url = "https://files.pythonhosted.org/packages/3f/29/0f59299eb4251a409b2e690ad4b7d9f8a676db829d7817ec961f32b44f7e/librt-0.16.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7e510b7770bee609617a3374a96548eb114cae048023e3f049ee449e7ff2db32", size = 502587, upload-time = "2026-09-29T00:53:09.191Z" }, + { url = "https://files.pythonhosted.org/packages/de/ba/d6fb4ef8d1537c396079d72289f16be7cd35a366e5065c51253fea2760b6/librt-0.16.0-cp313-cp313-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:efc49c462d4516b8a58b00b490078fa64689fd1fe66970cc190131d7afb8027e", size = 496146, upload-time = "2026-09-29T00:53:11.016Z" }, + { url = "https://files.pythonhosted.org/packages/52/fc/8c50dd4d7cc97c0ee8f252c8a3104980f234391cf1519b554e8b9de08b60/librt-0.16.0-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:92caf82ebef5e12d21c72242b70d1e92536f1711cf2a727a4c276de4b4469087", size = 513336, upload-time = "2026-09-29T00:53:12.655Z" }, + { url = "https://files.pythonhosted.org/packages/a9/59/16c409c56f708eda2db9a0553662845d45e3871c77d70a240dae3f3bdc56/librt-0.16.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:17bac7f7a16b328fff77e440287693eb017abde913595b5827ebccbc21ecd8a6", size = 531689, upload-time = "2026-09-29T00:53:14.39Z" }, + { url = "https://files.pythonhosted.org/packages/88/82/d34772a6c29d1446dcca6e64d74062efd508523ab351aa16625a4689d5cc/librt-0.16.0-cp313-cp313-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:5b976054553670829985ed767feb78fb6bcede0175327c4844dd5c281c1be659", size = 524537, upload-time = "2026-09-29T00:53:16.064Z" }, + { url = "https://files.pythonhosted.org/packages/77/8f/24c5631313746131ccee53bc91fdc8374f9cf25e0082a1fee9c93bb98acc/librt-0.16.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:0058f9d68721094105917254c72ac0569117bb7b13b9769cf45d26d89f9d21cd", size = 543231, upload-time = "2026-09-29T00:53:17.939Z" }, + { url = "https://files.pythonhosted.org/packages/f2/cb/5f8e0d41dbd8b499c2265e939c31acc9ba59845565bf99539ad1c06aebcf/librt-0.16.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:30b7beaf3f4487b7d8adef1f158b49067cb4d5a19fa7a3bf31a4e7a820e435c5", size = 546499, upload-time = "2026-09-29T00:53:19.666Z" }, + { url = "https://files.pythonhosted.org/packages/be/61/063052de441d1385f59cea4223f184bf9e5d125de1ae3239b490aa1e486e/librt-0.16.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:468df902df016a06eb0e40b0747dc8d14e47d7a38b18b63b1fb167d85cb94d63", size = 555261, upload-time = "2026-09-29T00:53:21.292Z" }, + { url = "https://files.pythonhosted.org/packages/14/11/a2ada0529372268d6401afa9d457a095b68cd7753532b6f7f33049a19b43/librt-0.16.0-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:aea7b1f2b125dad5de85f049136651bff256c883c65e6b9209b2da0a1ac3cdef", size = 536029, upload-time = "2026-09-29T00:53:23.07Z" }, + { url = "https://files.pythonhosted.org/packages/23/9d/5bb6d38853382986dca702fc7e06c8256d30f5fa0676d882773b744610dc/librt-0.16.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a8afb6557920860b7a3a596eb804cf37e09e7cf8a803db2478c202acc72d8c2e", size = 573748, upload-time = "2026-09-29T00:53:24.696Z" }, + { url = "https://files.pythonhosted.org/packages/99/f6/0025cde35ff7f607684dc775a2b2d732cce2561cec050a6ee1fb2e1fc6fe/librt-0.16.0-cp313-cp313-pyemscripten_2025_0_wasm32.whl", hash = "sha256:77c7a2b4fe2c1369e0d5aa1cade26740a7b14be32fbc9a5535d617d20065c39d", size = 79861, upload-time = "2026-09-29T00:53:26.089Z" }, + { url = "https://files.pythonhosted.org/packages/93/93/303b8592909bd583f83f02818ffbea3f7647ca1e22b1cd5465d04b8145fe/librt-0.16.0-cp313-cp313-win32.whl", hash = "sha256:02d89c813d5ff74b17df72d3a34819d132cd168e56b81bf755b809bd9e46b8c4", size = 106236, upload-time = "2026-09-29T00:53:27.43Z" }, + { url = "https://files.pythonhosted.org/packages/cf/24/80bbb463c60ed18e29cb26aba386ddb76609580e4e7160710e550587018c/librt-0.16.0-cp313-cp313-win_amd64.whl", hash = "sha256:14ed6ebe3e4f85f326d7920011ad30ff49ed9334e62cf88caef9ba973d9e3a92", size = 126180, upload-time = "2026-09-29T00:53:28.7Z" }, + { url = "https://files.pythonhosted.org/packages/43/80/b1a6fbdd7da825cdd55c71aa81eb6cfa82c513c360774152eacb50b4a771/librt-0.16.0-cp313-cp313-win_arm64.whl", hash = "sha256:83d4041a3d9b2fd053a8a4e1f22878b3e5833e2712956382d5c048d791454e91", size = 116557, upload-time = "2026-09-29T00:53:30.012Z" }, + { url = "https://files.pythonhosted.org/packages/1e/93/9e0cf7da129a93c3dc7f45bc3cd4a660f2aaa995aa8a6f95c2583ef41239/librt-0.16.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:931a0bb0fcac88f263e269e46eb30ba8e21402cd3c62ca40cb97034c0693fab1", size = 149844, upload-time = "2026-09-29T00:53:31.391Z" }, + { url = "https://files.pythonhosted.org/packages/8f/26/8a90d2a8f2b2e471bb486b7aec117b8ae622715ed6c39853aec48ea20073/librt-0.16.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1bc17e54e5305f8d40b7ca203671ff5a9e59c1d0f8ea0f625dcca53a3984de11", size = 154111, upload-time = "2026-09-29T00:53:32.718Z" }, + { url = "https://files.pythonhosted.org/packages/35/ce/67abb46258da4d3e42ff5b141db6f38c59357bef84c7979f183b22f924f1/librt-0.16.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:877698bf6bca5721d8be345f2fe09778e40ecadea8b58c73075f2b1a53666bf2", size = 494234, upload-time = "2026-09-29T00:53:34.466Z" }, + { url = "https://files.pythonhosted.org/packages/12/f9/ea7162414a16f8f1bbd3b493ad6d22b926c5471916e078350bdbca8c4e5f/librt-0.16.0-cp314-cp314-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:5981c011b306781ce561e18e14230a14524a3d8109b97553666c942c18f31a96", size = 491173, upload-time = "2026-09-29T00:53:36.124Z" }, + { url = "https://files.pythonhosted.org/packages/b1/09/9b3e869060dd33f9989b80ba4fea306f6db8cecefcdfe6d7346ef0603f65/librt-0.16.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:afced3dfc17cd805ecf7a3d77996a71cf5f2c75aa66eb0c21a9930f4fc992f86", size = 505547, upload-time = "2026-09-29T00:53:37.686Z" }, + { url = "https://files.pythonhosted.org/packages/50/07/79007d2165f649ea93e08c0962d1d62c70af9cde77965255095bf9d96f9a/librt-0.16.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ca8052401c55d7511dda6760719fda7618067e83535d7d0010096d216c34b667", size = 523057, upload-time = "2026-09-29T00:53:39.301Z" }, + { url = "https://files.pythonhosted.org/packages/61/0c/8fbaff66d0ba376d8864653f5acce1569bae27e89648671f26f7eca67ab8/librt-0.16.0-cp314-cp314-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:1e511762a074005bb0aa569166779834e75e438370226930d0ce1866d4b6a33b", size = 515158, upload-time = "2026-09-29T00:53:41.012Z" }, + { url = "https://files.pythonhosted.org/packages/df/2e/23ff0dece76f07a4124413a57682efa0bbeb5765ac0122bc0955513f82ca/librt-0.16.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:f1e8591bd8a5a628cd7f07954c6a1592359a878bf032957a8e9057a41d644311", size = 534183, upload-time = "2026-09-29T00:53:42.451Z" }, + { url = "https://files.pythonhosted.org/packages/26/c4/e11dea21d9a29486eba78887380374189d472734fa32cc50cb37ca44d3d0/librt-0.16.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:a4aaefb4ba6c07e1aeebb2795c8958148f1d6f9af3b555b53d23d766edb6d67a", size = 540663, upload-time = "2026-09-29T00:53:44.272Z" }, + { url = "https://files.pythonhosted.org/packages/44/75/e873ae158a8b7f5359be33e7fd6c1fbe02d9a78a3e89a77de6b0e837f476/librt-0.16.0-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:d92db7a0f6aee44f1baee94750457e8d2d1c6ccea41842de6268d34e8dc7eddd", size = 545908, upload-time = "2026-09-29T00:53:45.812Z" }, + { url = "https://files.pythonhosted.org/packages/ba/36/8939d3f6a93e11bd9592e6fe28d2b44f1c2dc4bed6e22e72359a91e18ffb/librt-0.16.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:378dfaffb38e59c24a87cde5713cd865d51ff7383fa12947f3907f306ea1ca55", size = 523302, upload-time = "2026-09-29T00:53:47.596Z" }, + { url = "https://files.pythonhosted.org/packages/71/14/35309f44a077f0f42ade0e2e7cd88c0cea760c661af205c01ea90d3c0e1f/librt-0.16.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:3e0c39bdc85370422e8b637be76eb1fd07d30967551b03e62267dd156f553152", size = 565911, upload-time = "2026-09-29T00:53:49.278Z" }, + { url = "https://files.pythonhosted.org/packages/78/0c/df6255b94967f3159ebc46f08d8e783c12da6ee269ddb74b2efed63c640c/librt-0.16.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:1b384b90ab79a7bc30b566895809a636e0666f21f3cf12b54823d025b7e83839", size = 79119, upload-time = "2026-09-29T00:53:50.938Z" }, + { url = "https://files.pythonhosted.org/packages/6b/44/d30d5a5461378c9d33f36736c6791c3b4c4ba4b1ffe0da7350aedcb2c9a0/librt-0.16.0-cp314-cp314-win32.whl", hash = "sha256:52327da75a94012e7f932f913d20d3876bed3c102be00e6c3e8600ff7bdd58a7", size = 100140, upload-time = "2026-09-29T00:53:52.205Z" }, + { url = "https://files.pythonhosted.org/packages/c2/98/769712f356a1e897df3581bb0c3100375d054a000de26099360ea65b5111/librt-0.16.0-cp314-cp314-win_amd64.whl", hash = "sha256:3f0b8114c44b2ac06ff5dacd08e07e8e807ff4f46083f2a1602685122559be41", size = 120464, upload-time = "2026-09-29T00:53:53.495Z" }, + { url = "https://files.pythonhosted.org/packages/bf/d3/ae2abccc8bdc8b063c1613a77686e17b74e9d3d60cfe6f12c63fa2821b9f/librt-0.16.0-cp314-cp314-win_arm64.whl", hash = "sha256:8caf96a4ef8fb27d0ac0d1ad8337d26a240acd4a02fe4345d0a8f264753e8f99", size = 110889, upload-time = "2026-09-29T00:53:54.817Z" }, + { url = "https://files.pythonhosted.org/packages/e4/26/0737d4be058dd6376eade7dd8b380d4b869b6394cee929393a5a431c45bb/librt-0.16.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:953107e2f68d0f3512c48f898b0dbf0ce5cc52bba0f318d847c985dc555ee4cc", size = 159838, upload-time = "2026-09-29T00:53:56.22Z" }, + { url = "https://files.pythonhosted.org/packages/01/96/9bc96531d7c620e9949af904470f02e3fa8f35129ab8e8f281c51eaa3788/librt-0.16.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:ad37d5b9abd49c9a655dcda7ea52a8a752884062ef1ee71ae17c2f2a0f81fe6a", size = 162018, upload-time = "2026-09-29T00:53:57.532Z" }, + { url = "https://files.pythonhosted.org/packages/0e/fa/b0289dcb186eb3f97221ba00da5f4bd3ba7fa5e99752d48aa8d336615334/librt-0.16.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2c4aa329c17bd1aaea4f6e89335d8ccd494b3a5830b6654462273e50e11023f0", size = 703983, upload-time = "2026-09-29T00:53:59.024Z" }, + { url = "https://files.pythonhosted.org/packages/d9/ab/05ebbbde7530fc5eeb58fbd1581522a9f64f132fa703c4c595eed6e14760/librt-0.16.0-cp314-cp314t-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:0ead24d2562a49473dddd9efef8581f020007eb0054389c3ee3ffad38b1ca4c9", size = 683847, upload-time = "2026-09-29T00:54:00.671Z" }, + { url = "https://files.pythonhosted.org/packages/a3/75/f52aeecd4dbadbddf80725ba7de126d8bd5d0eb66247eae17a81ed90dd4d/librt-0.16.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:02118f56a9c36ddd07dfd9b919d9ecc117ba20a90987d56aa4c429fa34509188", size = 698045, upload-time = "2026-09-29T00:54:02.247Z" }, + { url = "https://files.pythonhosted.org/packages/e6/55/fa277a835cd6eb42380591ceb85f48c5b4d2b2d7e2cb9869e1e17d24d237/librt-0.16.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4e29522c62e28595ff7e324c6834ade51127707f0e255b18d1c1cf03d39c1048", size = 724640, upload-time = "2026-09-29T00:54:04.078Z" }, + { url = "https://files.pythonhosted.org/packages/25/e4/2cf64354f3fde8ebd591b3b48f96510bee24ac5f7d1e567adbbe210abdbd/librt-0.16.0-cp314-cp314t-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:3ff4b2367926b69c6215635902cccb04048e73094e9862900d27cb2c6bbff143", size = 731748, upload-time = "2026-09-29T00:54:05.741Z" }, + { url = "https://files.pythonhosted.org/packages/f8/c9/c180af3e94e01aa529fa93d7733fec2abc47f222345400cf21d5481d5f8a/librt-0.16.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:c6f1b27bf1632a7e016af9f145f82be95e1edd7721a646505c21059257cb5a04", size = 754960, upload-time = "2026-09-29T00:54:07.38Z" }, + { url = "https://files.pythonhosted.org/packages/95/d6/01073aa78c58f356b10d9c57b3fe9abb143df338142bcd316df417b89db0/librt-0.16.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:5696d7f52e7b37217cb3a8f92c744fe835942602fdd4c1a8bc4741d3bfdce15e", size = 747000, upload-time = "2026-09-29T00:54:09.06Z" }, + { url = "https://files.pythonhosted.org/packages/f7/d8/1de3783908658d697a8cfc00582f61299ffba7796d7260c112e4700b1109/librt-0.16.0-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:6072e92dd876ff6ceeb6cf371e35e51f479349837391341f479b08df4564242b", size = 749569, upload-time = "2026-09-29T00:54:10.702Z" }, + { url = "https://files.pythonhosted.org/packages/b7/32/e817f66c96d6caa8bb8435ff93c4c220624d59efc506be59ab98fcd01d0c/librt-0.16.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:39ca4f2f2fe05de8e63493da592d84311adabe5bef52b193851981da9816b302", size = 729483, upload-time = "2026-09-29T00:54:12.25Z" }, + { url = "https://files.pythonhosted.org/packages/7c/c9/23992ccd2b9d22798fdd0f61353183a47414e651da782ad83eb680f50833/librt-0.16.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:f9807485a908f00355820f18e91e045ffdcdc5adb68aaec40a1e2b88c5f7bba1", size = 776584, upload-time = "2026-09-29T00:54:13.837Z" }, + { url = "https://files.pythonhosted.org/packages/67/3b/e8af957f08e6e2e8e566b099e43d2748418aa565df6ee1d9d3331209fdfe/librt-0.16.0-cp314-cp314t-win32.whl", hash = "sha256:94be5cb7bca4df6201f4183e9e4fa2086c655283d20b38cd84500a69057575a7", size = 104402, upload-time = "2026-09-29T00:54:15.568Z" }, + { url = "https://files.pythonhosted.org/packages/ca/1c/946e6443d7cd32347a086043395e421e52fd603c9163d2ec970ceab8eed6/librt-0.16.0-cp314-cp314t-win_amd64.whl", hash = "sha256:d46ca272b251d033dd4527b0dec5f261a28a52bd5fa0f99c117b0a1f8588cc2d", size = 126227, upload-time = "2026-09-29T00:54:17.165Z" }, + { url = "https://files.pythonhosted.org/packages/c2/a3/bc4f9959d3c62bcbf9e5fd3470a8bbd8bf33224ed4c25d7fba173201b8ac/librt-0.16.0-cp314-cp314t-win_arm64.whl", hash = "sha256:b9d6d4b14e92d876f8026b54c20c445f36425214c1081dc76f74e40db386b82b", size = 116493, upload-time = "2026-09-29T00:54:18.567Z" }, + { url = "https://files.pythonhosted.org/packages/b6/4b/10fdb42dfab4c1533e1570e686b18e86ff4328b406361b39fb3016667638/librt-0.16.0-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:6fe436af2eaf630474f491af5d032cbe45f93fcff5c3b9fe4ab194a7255b20ff", size = 149829, upload-time = "2026-09-29T00:54:19.933Z" }, + { url = "https://files.pythonhosted.org/packages/8e/30/a90ca13f1d3d91af1680000a4038536907018fbd51764767287a05d28b8b/librt-0.16.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:8ff5d26c529336be9bd7ae04483235d77778ee7d6444a95353102b542601ce81", size = 154522, upload-time = "2026-09-29T00:54:21.306Z" }, + { url = "https://files.pythonhosted.org/packages/5c/dd/bcf364eacfa070bb1fc88d503111ae7177914197ba1fa717c748926e7930/librt-0.16.0-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:909d8e3c1faee44cb762b1c519ff8613dcc5ceae5c99987a00917b5a31fd1d6a", size = 497593, upload-time = "2026-09-29T00:54:22.798Z" }, + { url = "https://files.pythonhosted.org/packages/18/c1/2c4e81e347bdabfe8346bfc6dc37ae5e154d61c88e30848ec0606025a5e0/librt-0.16.0-cp315-cp315-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:6d4a64283ee61824b5790de882bc68e2d9d7a5143537cb7a966f7354f71646d4", size = 480459, upload-time = "2026-09-29T00:54:24.364Z" }, + { url = "https://files.pythonhosted.org/packages/ab/d7/fef2a3cb8400701be496f6e459876f650b3451f407e30cb243de571ae615/librt-0.16.0-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:5810ba811297fdf37a1531a57667cb8ace0842013ca8606bf9eb7c24cf4be154", size = 507814, upload-time = "2026-09-29T00:54:25.997Z" }, + { url = "https://files.pythonhosted.org/packages/e1/6f/53762927a32e9dc9eb1d1c1f3528da281290c86d96929a8af652f671266e/librt-0.16.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e56aaf8c167548dc8e5d6f3bd0f48dcdd299a23c73be3f744aab79d99e9c7f5d", size = 525114, upload-time = "2026-09-29T00:54:27.747Z" }, + { url = "https://files.pythonhosted.org/packages/6c/67/0b9d031f303c4e8c691a9a8ef9d272f13b530c11cc563b819df621b6a348/librt-0.16.0-cp315-cp315-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8f36c58e33b304b525c6c9c5076399c6ebf1109e17b9051a05a407b091b9215b", size = 520465, upload-time = "2026-09-29T00:54:29.331Z" }, + { url = "https://files.pythonhosted.org/packages/ae/d5/2056a3a85864e882eb17a203a10ddb26fa748bc9718ec67e79059ab46cae/librt-0.16.0-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:242e00b3d4fa37c3d3c1ca5f5c9adb7d909ddb1eac9c41f2787320d00caa0af2", size = 537257, upload-time = "2026-09-29T00:54:30.915Z" }, + { url = "https://files.pythonhosted.org/packages/54/57/e0d79790c163cbc0909e209a6f62e30bb713b647f905a176cdc64848fd4d/librt-0.16.0-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:0253721561787b8df8443eb347b7a6461015354e5bdd37ee38a41fef220d2bb0", size = 527442, upload-time = "2026-09-29T00:54:32.478Z" }, + { url = "https://files.pythonhosted.org/packages/aa/50/1c0c95aba7af51f4752ea34fbf2eb79b36e7cae3a72536248e8c735de735/librt-0.16.0-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:3e483a8d69ede8067db70c0e83007423b6925de6fd53afed01d66160f2e9398c", size = 548139, upload-time = "2026-09-29T00:54:34.183Z" }, + { url = "https://files.pythonhosted.org/packages/98/91/a8a43dd5138d4f55f88846b8f0c85454a4fad69952cebfcff9948f831290/librt-0.16.0-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:69ba927445cfaaffb4081003ef5224c55a5c2ab67ef956f416ef744916e44121", size = 529708, upload-time = "2026-09-29T00:54:35.761Z" }, + { url = "https://files.pythonhosted.org/packages/2d/41/d5226881ab2b7c20d9d587b37bdd4a0ec8775a96d00ca87ac9f385587db4/librt-0.16.0-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:d6a365f2ab45a984d0e00eee0dd17f599ceab8cadab6ea07b6111c8132fc0e42", size = 567781, upload-time = "2026-09-29T00:54:37.409Z" }, + { url = "https://files.pythonhosted.org/packages/bb/bf/2345ba57a626e8c78c4ddcc724636a8df5a593fe46c1ee76bbf477e32b0d/librt-0.16.0-cp315-cp315-pyemscripten_2026_5_wasm32.whl", hash = "sha256:f01f3805f2dae4781c0c34b440e31740d082950bdaf89a6f601ad589a28af57a", size = 79177, upload-time = "2026-09-29T00:54:38.792Z" }, + { url = "https://files.pythonhosted.org/packages/1e/40/99e77936cc9207f629b077bf7cbc5e2f0827cddd7c29792f04ef881bd2c3/librt-0.16.0-cp315-cp315-win32.whl", hash = "sha256:b0e3e721c75d2e79a76d4422c79d7ba705fe1bbafec907037fe7a657a480a0e3", size = 100127, upload-time = "2026-09-29T00:54:40.251Z" }, + { url = "https://files.pythonhosted.org/packages/56/1e/801fe26bc622061b9dfd010e166d94142cb774b733217e6d98d1c0cf2638/librt-0.16.0-cp315-cp315-win_amd64.whl", hash = "sha256:bc02954b1295de798bbdb0b4e2d8a28c2117de8b5c73dcbeb27dc32572dfb971", size = 120480, upload-time = "2026-09-29T00:54:41.722Z" }, + { url = "https://files.pythonhosted.org/packages/bb/a9/d533983055bd36e112627384c2c038845d1df882540b8bcefb566475640b/librt-0.16.0-cp315-cp315-win_arm64.whl", hash = "sha256:c5db585d43449a5f54303d4b2774e45e1babd975cfe1630a3d708c0b80c3e560", size = 110915, upload-time = "2026-09-29T00:54:43.052Z" }, + { url = "https://files.pythonhosted.org/packages/55/fe/d62238fa9c653b0e0613290349467cb65711b5800e8e474f45e942a0ad95/librt-0.16.0-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:f06c689cb14afd9b612727553a5ec5a40febf113ca41c4413a2b0b334285884b", size = 159714, upload-time = "2026-09-29T00:54:44.497Z" }, + { url = "https://files.pythonhosted.org/packages/f3/ac/f31efe7818700be72ba4f9af8a80fa67c39808c8d26dacc55dc1f6f35172/librt-0.16.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:13b4e8aba90b0b1c82474e9844aa9ffe7ad3faa484350e1da64cb8188d903134", size = 162086, upload-time = "2026-09-29T00:54:45.968Z" }, + { url = "https://files.pythonhosted.org/packages/d9/16/4d7487bf86a9d7e8e18f37ba5538789233ea693637379b75701bd35ec9de/librt-0.16.0-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5a269c46ae327d8e6f8c1f85f7516cb52c0fa48127565a1105a4f4a05ff2a0b4", size = 712727, upload-time = "2026-09-29T00:54:47.486Z" }, + { url = "https://files.pythonhosted.org/packages/77/74/50cd550ccc1a517b9ed62347625c01ddf8c4afad66490312677c011458f6/librt-0.16.0-cp315-cp315t-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:a33e0dae1f8592146a4764d54ce842b278732d21a84e17c3bbe6b1bc158a2248", size = 681106, upload-time = "2026-09-29T00:54:49.126Z" }, + { url = "https://files.pythonhosted.org/packages/df/5d/7293f712975ee6fdd2251411fd9ef1c62bc99c7b83ecbe62dbc999b1fab7/librt-0.16.0-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:47ada6ea32636492c61aa8ad27ae3b9404bfe7a97e3ba946d1984236cc741da0", size = 705921, upload-time = "2026-09-29T00:54:50.905Z" }, + { url = "https://files.pythonhosted.org/packages/67/f7/8aab946f11d59d1bece9ffc65d994b200c789a8ca5a95c17e17e609f912a/librt-0.16.0-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c43bd6e642d8a248c114327f98dd25ac5a7cb5aa168ef02f0559b91874df16b8", size = 731786, upload-time = "2026-09-29T00:54:52.584Z" }, + { url = "https://files.pythonhosted.org/packages/43/76/1c42ab31e7cb8384ebf6d3af607213c495222474f4940443ae7639ab7685/librt-0.16.0-cp315-cp315t-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c3d1bb7841a816ace6449bb26d3f9560dbfa20e71c568d23f0f62bf1e68f50b1", size = 744964, upload-time = "2026-09-29T00:54:54.217Z" }, + { url = "https://files.pythonhosted.org/packages/6f/2e/4b19982d933d2dfced671e840b219e4c1cd3f507df6e6dabb51bbd4e3850/librt-0.16.0-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:3931f7a3db322e7f44e02a280e3949326ce9579ad388ee8d691dc7c76da9fb70", size = 765305, upload-time = "2026-09-29T00:54:55.815Z" }, + { url = "https://files.pythonhosted.org/packages/b8/1b/e872583de2dcb3ac7746e7a2321aeeb168274f3952a87dc66e05ddb29faf/librt-0.16.0-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:f4462528b6000afe8f16907b5c7c2553abf1df005ba5140e6eb394541c3624c3", size = 744959, upload-time = "2026-09-29T00:54:57.532Z" }, + { url = "https://files.pythonhosted.org/packages/10/de/a18c6bcfb297af2674233e90b3c3661c3a0af0f1434a0c966d2ef708a835/librt-0.16.0-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:80039ba9b6a7d5f1a0175a4cca6bbefead87bd854c80abad1cb30afe47a830db", size = 758138, upload-time = "2026-09-29T00:54:59.484Z" }, + { url = "https://files.pythonhosted.org/packages/22/1c/0df1d732539c297bb1a093e1fe3204d2faf76a9022cf4e1d1c2fce059790/librt-0.16.0-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:7a1d272724b581bb6bc769dfdafed6da2ecc9886ba2450311de55a4ac2e1e9cd", size = 744268, upload-time = "2026-09-29T00:55:01.179Z" }, + { url = "https://files.pythonhosted.org/packages/a2/f7/ccaf31331f20c91a5bd9bd48ffc3f743f9c81bb5720cc7b2a720ca204f0a/librt-0.16.0-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:fbe4fb8c5445f7496d7f7f6bb0807875d09d47e6771ffa175fb2df2895fb86ba", size = 785783, upload-time = "2026-09-29T00:55:02.938Z" }, + { url = "https://files.pythonhosted.org/packages/c1/ea/7421d9e6db894cd6cd788b604b3394a163ded6b942052b6f96c23ccf08e1/librt-0.16.0-cp315-cp315t-win32.whl", hash = "sha256:375bfe6b572a8f6cfc398709356046173bf27e64c4c5edaf5f7062f051fb4bf9", size = 104355, upload-time = "2026-09-29T00:55:04.533Z" }, + { url = "https://files.pythonhosted.org/packages/85/6d/7c31a506eb847bc58aeb2402d58e17605e821f68ab5df5e66fe274a6df41/librt-0.16.0-cp315-cp315t-win_amd64.whl", hash = "sha256:bd3150023d3dc2bc70f3784e59ffa1140d56ddba3d8125b3d6f9f85221279bfc", size = 126134, upload-time = "2026-09-29T00:55:06.017Z" }, + { url = "https://files.pythonhosted.org/packages/36/69/7a5d10ac409c4da0355e054a14371871da9b5557fcc42772cd00181c6cce/librt-0.16.0-cp315-cp315t-win_arm64.whl", hash = "sha256:8ceafb70f2a4f0826f11031942e59c0728fd98da112dc346d4352bde1e486866", size = 116391, upload-time = "2026-09-29T00:55:07.484Z" }, +] + +[[package]] +name = "mypy" +version = "2.4.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "ast-serialize" }, + { name = "librt", marker = "platform_python_implementation != 'PyPy'" }, + { name = "mypy-extensions" }, + { name = "pathspec" }, + { name = "tomli", marker = "python_full_version < '3.11'" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/34/4e/64300736cf0a0373a27b94a91b664ee7382e36f77b0621bae6381da3e180/mypy-2.4.0.tar.gz", hash = "sha256:77bdaebd452f43fcfc4cc3ba94352a3ea537cd01e3f2d0879f48673d2ec00d6e", size = 4064425, upload-time = "2026-10-01T20:40:39.229Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/5c/0a/78c9ac93933e2ecd51d807021f78c03ffe98640f33951a8be159f5fd55bc/mypy-2.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ffda5244fd1ad71a1e54405e35f50d09b80c3978efa120f58bd1252ae32c62d2", size = 14408618, upload-time = "2026-10-01T20:39:46.766Z" }, + { url = "https://files.pythonhosted.org/packages/aa/4f/5f5f4429fd5a4218ce6268164a66afeed75c7e2ce5522a4d163faaa5fe85/mypy-2.4.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:615b03922d40e186fd1df73156473db0ba525c639bb4fd1cf28e1694879c9b23", size = 14552749, upload-time = "2026-10-01T20:40:08.325Z" }, + { url = "https://files.pythonhosted.org/packages/54/78/fa1c319cd51db7a6027b46117460d5a361c6bba0c0f0f0670a2dab8ce2a5/mypy-2.4.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:13fa24f439c0e48a290a3922fa14ccd22f2762bae99d2142931b3e40a9055080", size = 15505846, upload-time = "2026-10-01T20:39:15.475Z" }, + { url = "https://files.pythonhosted.org/packages/e2/5a/14c02690776fb04e9fa60b81173cb9ae6315e0745fad3813b303737f2f0c/mypy-2.4.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:3adef556a19eb3b630bf86a79c29d7da3d61e541472d0d897ca01b171c0abf8f", size = 15823059, upload-time = "2026-10-01T20:39:35.429Z" }, + { url = "https://files.pythonhosted.org/packages/76/d8/d29afa819f8cb765018d6e2773e390a41ea4592f75abe417135969646857/mypy-2.4.0-cp310-cp310-win_amd64.whl", hash = "sha256:1dc0f64b0a92ae27a49d2175f0bacfa56e15bdc5b420cf92e0c1f79292219cbb", size = 11312927, upload-time = "2026-10-01T20:39:28.509Z" }, + { url = "https://files.pythonhosted.org/packages/bc/c8/966dec4d80303855d824e6bf67fe1da812d88adfe4d75e24d8545dab4826/mypy-2.4.0-cp310-cp310-win_arm64.whl", hash = "sha256:4a378fc15fb33e321f04652c166ce73eeb8833a97c3d218132844e938cd93220", size = 10879252, upload-time = "2026-10-01T20:38:41.545Z" }, + { url = "https://files.pythonhosted.org/packages/26/67/e53965e67d23d48e78dd603aa7525a8d77e7818c23954cc217ccde5cd5c0/mypy-2.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5d20e6c7c35fcbf2a0ebdd0eaeacfbc243009dfd33ab7822d54e213912e6dbbd", size = 14315745, upload-time = "2026-10-01T20:39:25.03Z" }, + { url = "https://files.pythonhosted.org/packages/b1/5d/a588ccd57625822d8484d7aff4e9c70f88d042a91c2ec84324a2bc14b3f3/mypy-2.4.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3011537be6cf1de4511c0255a324362a812b58184bbe61e15f59c8b31033bd74", size = 14465652, upload-time = "2026-10-01T20:38:57.19Z" }, + { url = "https://files.pythonhosted.org/packages/05/af/b4978a5566cb829ca563dc08e3ad8d944f116078786ad54ba3dff2bcb64d/mypy-2.4.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a96b07a49b7b1d025ce59c1b3acbcf24bead9a83da4523c4a6bde1bb94e7a0e1", size = 15419180, upload-time = "2026-10-01T20:40:27.808Z" }, + { url = "https://files.pythonhosted.org/packages/b2/8c/52c71f31c54d0a749d832cc73b933c6e38c52d9b270d5503e031c73723dc/mypy-2.4.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:7c4f8f8d1d1c0e2832d8ee7113dd08f6df6c7aad9e863fcbed9f25832be0b8c4", size = 15669212, upload-time = "2026-10-01T20:39:20.443Z" }, + { url = "https://files.pythonhosted.org/packages/e8/55/ba63121494404fd7d3787ec176ccd02820d6ec125ac4e7c4c0b79f2cc6c7/mypy-2.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:ba05652540bf12828e52abae807b024b09ca144ff4f75e2450a81d69c376425b", size = 11299572, upload-time = "2026-10-01T20:40:03.627Z" }, + { url = "https://files.pythonhosted.org/packages/9c/9c/385c81b5c0d3a2917f077c4da660d0493f9521ccfd4b058e33b860f72d02/mypy-2.4.0-cp311-cp311-win_arm64.whl", hash = "sha256:6306086b87cf7f8a29aa618d9fd9bffb56c59247166b9660fdb54d86d7714ecd", size = 10869751, upload-time = "2026-10-01T20:40:25.483Z" }, + { url = "https://files.pythonhosted.org/packages/68/ed/e5d7cf4017e74a1c1e1c4058ce8f614fc1e3e7606564f47166e22bfc9f95/mypy-2.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e05ff2925d8b37ad26c80c1b9dc43ae5d455da2df1e23c24c095a6425917c57e", size = 14378593, upload-time = "2026-10-01T20:38:48.222Z" }, + { url = "https://files.pythonhosted.org/packages/30/7d/12d994886a922f0f1997becc9c6625198d61eeb5962558a886af7dd38d54/mypy-2.4.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:29243242cf72582b65f9582ad9e56e8cb281566ed3519f4cd70bb8b9f2977e90", size = 14464697, upload-time = "2026-10-01T20:39:11.059Z" }, + { url = "https://files.pythonhosted.org/packages/f3/9e/bcc9af755425ad17790bf11d73c2ea7592914cf309ee1340997670f9d57a/mypy-2.4.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:29eb0b9427a6b11b992e452f6cceb8af724f4dceb47e779d0b35e405e996ea5e", size = 15552257, upload-time = "2026-10-01T20:39:56.269Z" }, + { url = "https://files.pythonhosted.org/packages/af/0c/3343fc4525d6f00d75ad17a93a9f052d5163641cb8911840d4a12cb59ff2/mypy-2.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e3ebe2f72a2a1156065a9851570ffbf50c0a93cdccadef9c6e05c508a4fd10b1", size = 15800443, upload-time = "2026-10-01T20:38:54.815Z" }, + { url = "https://files.pythonhosted.org/packages/8f/0e/69aac6b8159da7c53e6115a2be1bf48e85503402cadbf506dd708e8b2ad7/mypy-2.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:236e0d68f6941992b0811128e652590f590db444ab29ad8f1324765b9298b946", size = 11381574, upload-time = "2026-10-01T20:39:49.406Z" }, + { url = "https://files.pythonhosted.org/packages/6e/d3/d32ce4feb5993eec09d2024bef16cedc9b93701b1446b86092f08b24491b/mypy-2.4.0-cp312-cp312-win_arm64.whl", hash = "sha256:82d0f94c8587ccb472622ee7795280aaa38a06640d5f45b3f16909d6dd86a989", size = 10944729, upload-time = "2026-10-01T20:40:15.203Z" }, + { url = "https://files.pythonhosted.org/packages/44/f2/eb15183c97c69d7cbfac990a6efd33a19ecfd97dab9e714c742fa78a784f/mypy-2.4.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:7da85fbcff6dac1abcc636707bed38b45598131fb7a605d9719c70b5cc733af8", size = 14213395, upload-time = "2026-10-01T20:40:21.178Z" }, + { url = "https://files.pythonhosted.org/packages/8c/b5/ba91b6ff65e4d6b6ff53b2b3b3ac5f1babf0c7c27d0b43a0196b1c967926/mypy-2.4.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4209da39d85cf240f762af622d8180fcdfcb4727d021f44ade62d613a1a43324", size = 14373009, upload-time = "2026-10-01T20:39:58.86Z" }, + { url = "https://files.pythonhosted.org/packages/d5/c4/484275efc935c0003e55e4e8a33e4b8e99528ee956c12256ece4708f903f/mypy-2.4.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6be721bd4bd57576193653b75b4af3461c9d0bf7dd8b528f782e9be210dc75bb", size = 15465557, upload-time = "2026-10-01T20:39:01.794Z" }, + { url = "https://files.pythonhosted.org/packages/50/30/66eb6fdd0875e3c9025a02f0bb0ea2e524b74274b658c37fde0068c4939d/mypy-2.4.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e1fde197ae65be856a034a91b70ed747a16562ca69577785f06c661548424bf1", size = 15728673, upload-time = "2026-10-01T20:38:43.724Z" }, + { url = "https://files.pythonhosted.org/packages/58/bc/2aa98fd7f49c42dba8e9c065886fadffdd00f3c654cff3f2a7103a797ac8/mypy-2.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:295ecf2e57542cd836ca537486951289678c8c7d1ee6ad74ebe29b2168a003cf", size = 11389803, upload-time = "2026-10-01T20:39:37.547Z" }, + { url = "https://files.pythonhosted.org/packages/49/41/17b60df2d946792ef6af43b89351f5c9ddabc69053206b2304945572a744/mypy-2.4.0-cp313-cp313-win_arm64.whl", hash = "sha256:bc378bdad4e9f12b5bd96466083d1e71acf00594ec9c7b2bdb5e02816f77f303", size = 10951060, upload-time = "2026-10-01T20:39:04.015Z" }, + { url = "https://files.pythonhosted.org/packages/e0/66/924be0b653372ed31ad5c48e26044cc00840e591943a56e61621cf05b60e/mypy-2.4.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:058165f564ccf559c68c70fec2091fca5891110480210c22594635e3f6683437", size = 14234230, upload-time = "2026-10-01T20:39:44.535Z" }, + { url = "https://files.pythonhosted.org/packages/56/39/c4f176880a4177123576de6cec6309feea8f42fca2bf2f6584e88054f656/mypy-2.4.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9fa247e02b505a45a2775f69df38d360d197e3790bc60f717595db9eda358b6e", size = 14392944, upload-time = "2026-10-01T20:40:05.78Z" }, + { url = "https://files.pythonhosted.org/packages/bc/1c/26e16977e25ef2494a74f8ffc872a76ec2c3aa43c3156057cbdf88f352c5/mypy-2.4.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:20e9a5cd875837520c43db98dea0b6d0c2197833d95c30127d8f570fb9b1f00b", size = 15441463, upload-time = "2026-10-01T20:40:32.412Z" }, + { url = "https://files.pythonhosted.org/packages/31/9c/9e4b049f0ecefbfd6817ca2a16eea55dd74a07950268edc6cffd29ccfe98/mypy-2.4.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:9f03a7828cca2b0adcd6662aee8f2711ff8830e1027641fdea3ab0b787483566", size = 15705406, upload-time = "2026-10-01T20:40:34.844Z" }, + { url = "https://files.pythonhosted.org/packages/4a/5e/e861b5f6c5ef9ee6cd24683aed1edecf82a26dbd536049f9b7850b586267/mypy-2.4.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:9279488933040b638c0ab739084c0ca100efeea6db581bf5d7628d8e89de53fe", size = 7897523, upload-time = "2026-10-01T20:39:39.861Z" }, + { url = "https://files.pythonhosted.org/packages/3a/87/61ffee58b25a956532a6006fae84918a2de849ed25f397492b2e815fe7b3/mypy-2.4.0-cp314-cp314-win_amd64.whl", hash = "sha256:2106b55105ba5ea9be4f53a24517fc5fa927ff1585edc9bc1a975abb72caef89", size = 11576345, upload-time = "2026-10-01T20:39:41.553Z" }, + { url = "https://files.pythonhosted.org/packages/a1/88/a331c20698971c2ce8d1c30f317fd61b5be13a85b1f053e12dfa22ac6568/mypy-2.4.0-cp314-cp314-win_arm64.whl", hash = "sha256:528c8744b8b5e3ecb8774f86af38d2376216816e9908317ad055f3c9c2d74799", size = 11172062, upload-time = "2026-10-01T20:38:59.534Z" }, + { url = "https://files.pythonhosted.org/packages/47/c0/4f7daa73270dced8e86c6f4a911c68082d03a84e6c1ec9bd916028d66131/mypy-2.4.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:0bb95cf34899e4619c61ab0a8667804e139e580b30d5df12af2102dfe44d0c97", size = 15711208, upload-time = "2026-10-01T20:39:30.597Z" }, + { url = "https://files.pythonhosted.org/packages/2f/05/f1afa303c678be24cf7a266d38fb24b3de4599a024c2f9ba0d5905a3efa3/mypy-2.4.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:86d616fe84c6eab8026f8c50ab5bcb90db780d2ccd233d971e34e92bede9b359", size = 15935442, upload-time = "2026-10-01T20:39:22.781Z" }, + { url = "https://files.pythonhosted.org/packages/9d/d6/6a1a45459b63716e0d035f4892a926d3054f0a8cbfa02551d228a9946083/mypy-2.4.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a3f86fd1313dd69d013e265f1fdcd12ea7a9d606f9875b2a3db946cd334555f3", size = 17240044, upload-time = "2026-10-01T20:39:32.95Z" }, + { url = "https://files.pythonhosted.org/packages/87/85/ae33bee66c13f98d421964d87bf0888be941063bc75c1204a4cf142cf1cc/mypy-2.4.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:720434d48542ecfe84d32d287b727569d3fc8f5769acd39051130e490a5c295c", size = 17545856, upload-time = "2026-10-01T20:39:08.827Z" }, + { url = "https://files.pythonhosted.org/packages/df/de/eeff209b65c3e267818d79333bb9f058da6e4e73761461bd94748a2eb628/mypy-2.4.0-cp314-cp314t-win_amd64.whl", hash = "sha256:a6e851b82c0661f69f1630fc16172c68787a6a9cf0991e7c6437d60976cdcd76", size = 12369342, upload-time = "2026-10-01T20:40:10.516Z" }, + { url = "https://files.pythonhosted.org/packages/2b/43/e62d8d5c1dd737aa248968302ff7d6eabf997c3301773ed8bcb64932ca77/mypy-2.4.0-cp314-cp314t-win_arm64.whl", hash = "sha256:3bd0e340f0ebe65c548210f53be3fd8192e83964760caf0c28bef368e68b0d37", size = 11849099, upload-time = "2026-10-01T20:39:51.834Z" }, + { url = "https://files.pythonhosted.org/packages/2e/5f/335b8980055118dc131355155883fb676bb2161a0d97e08658e479c776fb/mypy-2.4.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:afa89837d9be67e0cadfa33bca3bb7efdda98c3b07e74dc3b635ebfb1c8a926a", size = 14241302, upload-time = "2026-10-01T20:39:13.227Z" }, + { url = "https://files.pythonhosted.org/packages/18/37/1482fdc49332b145828912b15f16eee0c4ca70a8bce0f6514ece79b14680/mypy-2.4.0-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fb443e81057896132d3642d6be219e6efd158691ac7883e3ba8fcb469865f05d", size = 14408200, upload-time = "2026-10-01T20:38:52.576Z" }, + { url = "https://files.pythonhosted.org/packages/04/09/dce2e8f6c1b31053c430ef6963f6f7a38ccb49b90c5e01e37ed0129b7d5a/mypy-2.4.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7f38f57d344f8b6accb40e01c3d83cfc590498231724d16c07ffb7940f157818", size = 15444409, upload-time = "2026-10-01T20:39:18.1Z" }, + { url = "https://files.pythonhosted.org/packages/43/c5/91b68306da4cd280cb15be35dbb5ffc343cabd67c4b121b6625bf2d13177/mypy-2.4.0-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:e76172710bd4e5eeae061abfd68347e5264632e02778be61784671ae3a2132f5", size = 15731186, upload-time = "2026-10-01T20:40:23.426Z" }, + { url = "https://files.pythonhosted.org/packages/64/71/2d0340182a8f27352fb1e25531355951108b506097c433937e9eec452ffd/mypy-2.4.0-cp315-cp315-pyemscripten_2026_5_wasm32.whl", hash = "sha256:f83353e47ab520bf6fd4df8f5897d9fe081211f2fbc4b7d37736a3e3c166cbcf", size = 7897838, upload-time = "2026-10-01T20:38:50.779Z" }, + { url = "https://files.pythonhosted.org/packages/3e/08/32703c117e134c02efa2a82705bb40cee91eaedea10b6530e20eba651b1f/mypy-2.4.0-cp315-cp315-win_amd64.whl", hash = "sha256:970b221ed5842213d98e3c480c08f795ace4b1f81fb21e1b126bd0476bce1c34", size = 11575700, upload-time = "2026-10-01T20:39:53.982Z" }, + { url = "https://files.pythonhosted.org/packages/ab/08/08bb269feafdaad031046ee2d771528a64467e6a180f962afc28c4a3ccd8/mypy-2.4.0-cp315-cp315-win_arm64.whl", hash = "sha256:502b94b0b331f7dafe32fd6b151797ddbb4f32385b362e722c783a025e5954a3", size = 11172908, upload-time = "2026-10-01T20:40:12.91Z" }, + { url = "https://files.pythonhosted.org/packages/fb/3f/c5c92626006ca92c7686adfbece47fc6a0daa0e54753952a9ad13ce0561c/mypy-2.4.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:c9de622fd397495695d0598ddc789222bfcfec9d7c9ec3a1e385c855e3bc5e01", size = 15705970, upload-time = "2026-10-01T20:40:17.79Z" }, + { url = "https://files.pythonhosted.org/packages/10/f3/863365f7997a76a5a1dd42d7902ab05afa4124e8419089cbca1ce2554db1/mypy-2.4.0-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9f459f0b4f0596d9d51fe7716b404b35287b99e77da98a7af90a65dd5fd61141", size = 15942234, upload-time = "2026-10-01T20:40:37.243Z" }, + { url = "https://files.pythonhosted.org/packages/f6/30/2f45b1f425a2c95dbe1a3f4d076bfd42b76e9615dba5906230703b14e4eb/mypy-2.4.0-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f9b028548b3af480e2b1ed8df14ccaac86f99c9f600d1580770ab7ba3dcd40f0", size = 17218364, upload-time = "2026-10-01T20:39:06.497Z" }, + { url = "https://files.pythonhosted.org/packages/43/8b/5b2bbfc69e84800b78fa2dba16d995b003f93b573558e412c5490d6e6c37/mypy-2.4.0-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:cb734b2668c1f40d07ce093bbeb4407e9527c67901627b0e1679825be3f09975", size = 17557934, upload-time = "2026-10-01T20:38:46.077Z" }, + { url = "https://files.pythonhosted.org/packages/df/c0/1a5dc601c22041a7bbfe1ff71cf097fbbd4fb49930867c6789baf5102106/mypy-2.4.0-cp315-cp315t-win_amd64.whl", hash = "sha256:172e30b8fea631fe310f0c665477f52d9ea40bb4e99e0c81dc30118563b13710", size = 12350955, upload-time = "2026-10-01T20:40:01.52Z" }, + { url = "https://files.pythonhosted.org/packages/1c/bc/697e9e26fc2a86c094ad67ee1e419971b7f01ded66ee66231b09e9f3e12e/mypy-2.4.0-cp315-cp315t-win_arm64.whl", hash = "sha256:5786ef987b3767e51aaa53f20aec104c0252b42ecda7aef8e8b4cbae279b05c5", size = 11842738, upload-time = "2026-10-01T20:40:30.026Z" }, + { url = "https://files.pythonhosted.org/packages/81/12/46ae8670c98a3cd0286ca5645c2f918f8f6be65edfed81b916010619f668/mypy-2.4.0-py3-none-any.whl", hash = "sha256:d01c5d26a352acc6d5cf3128225477e1e8465e8d3029d4c345807fbf7f3cf093", size = 2800734, upload-time = "2026-10-01T20:39:26.837Z" }, +] + +[[package]] +name = "mypy-extensions" +version = "1.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a2/6e/371856a3fb9d31ca8dac321cda606860fa4548858c0cc45d9d1d4ca2628b/mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558", size = 6343, upload-time = "2025-04-22T14:54:24.164Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/79/7b/2c79738432f5c924bef5071f933bcc9efd0473bac3b4aa584a6f7c1c8df8/mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505", size = 4963, upload-time = "2025-04-22T14:54:22.983Z" }, +] + +[[package]] +name = "numpy" +version = "2.2.6" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version < '3.11'", +] +sdist = { url = "https://files.pythonhosted.org/packages/76/21/7d2a95e4bba9dc13d043ee156a356c0a8f0c6309dff6b21b4d71a073b8a8/numpy-2.2.6.tar.gz", hash = "sha256:e29554e2bef54a90aa5cc07da6ce955accb83f21ab5de01a62c8478897b264fd", size = 20276440, upload-time = "2025-05-17T22:38:04.611Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9a/3e/ed6db5be21ce87955c0cbd3009f2803f59fa08df21b5df06862e2d8e2bdd/numpy-2.2.6-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b412caa66f72040e6d268491a59f2c43bf03eb6c96dd8f0307829feb7fa2b6fb", size = 21165245, upload-time = "2025-05-17T21:27:58.555Z" }, + { url = "https://files.pythonhosted.org/packages/22/c2/4b9221495b2a132cc9d2eb862e21d42a009f5a60e45fc44b00118c174bff/numpy-2.2.6-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8e41fd67c52b86603a91c1a505ebaef50b3314de0213461c7a6e99c9a3beff90", size = 14360048, upload-time = "2025-05-17T21:28:21.406Z" }, + { url = "https://files.pythonhosted.org/packages/fd/77/dc2fcfc66943c6410e2bf598062f5959372735ffda175b39906d54f02349/numpy-2.2.6-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:37e990a01ae6ec7fe7fa1c26c55ecb672dd98b19c3d0e1d1f326fa13cb38d163", size = 5340542, upload-time = "2025-05-17T21:28:30.931Z" }, + { url = "https://files.pythonhosted.org/packages/7a/4f/1cb5fdc353a5f5cc7feb692db9b8ec2c3d6405453f982435efc52561df58/numpy-2.2.6-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:5a6429d4be8ca66d889b7cf70f536a397dc45ba6faeb5f8c5427935d9592e9cf", size = 6878301, upload-time = "2025-05-17T21:28:41.613Z" }, + { url = "https://files.pythonhosted.org/packages/eb/17/96a3acd228cec142fcb8723bd3cc39c2a474f7dcf0a5d16731980bcafa95/numpy-2.2.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:efd28d4e9cd7d7a8d39074a4d44c63eda73401580c5c76acda2ce969e0a38e83", size = 14297320, upload-time = "2025-05-17T21:29:02.78Z" }, + { url = "https://files.pythonhosted.org/packages/b4/63/3de6a34ad7ad6646ac7d2f55ebc6ad439dbbf9c4370017c50cf403fb19b5/numpy-2.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fc7b73d02efb0e18c000e9ad8b83480dfcd5dfd11065997ed4c6747470ae8915", size = 16801050, upload-time = "2025-05-17T21:29:27.675Z" }, + { url = "https://files.pythonhosted.org/packages/07/b6/89d837eddef52b3d0cec5c6ba0456c1bf1b9ef6a6672fc2b7873c3ec4e2e/numpy-2.2.6-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:74d4531beb257d2c3f4b261bfb0fc09e0f9ebb8842d82a7b4209415896adc680", size = 15807034, upload-time = "2025-05-17T21:29:51.102Z" }, + { url = "https://files.pythonhosted.org/packages/01/c8/dc6ae86e3c61cfec1f178e5c9f7858584049b6093f843bca541f94120920/numpy-2.2.6-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:8fc377d995680230e83241d8a96def29f204b5782f371c532579b4f20607a289", size = 18614185, upload-time = "2025-05-17T21:30:18.703Z" }, + { url = "https://files.pythonhosted.org/packages/5b/c5/0064b1b7e7c89137b471ccec1fd2282fceaae0ab3a9550f2568782d80357/numpy-2.2.6-cp310-cp310-win32.whl", hash = "sha256:b093dd74e50a8cba3e873868d9e93a85b78e0daf2e98c6797566ad8044e8363d", size = 6527149, upload-time = "2025-05-17T21:30:29.788Z" }, + { url = "https://files.pythonhosted.org/packages/a3/dd/4b822569d6b96c39d1215dbae0582fd99954dcbcf0c1a13c61783feaca3f/numpy-2.2.6-cp310-cp310-win_amd64.whl", hash = "sha256:f0fd6321b839904e15c46e0d257fdd101dd7f530fe03fd6359c1ea63738703f3", size = 12904620, upload-time = "2025-05-17T21:30:48.994Z" }, + { url = "https://files.pythonhosted.org/packages/da/a8/4f83e2aa666a9fbf56d6118faaaf5f1974d456b1823fda0a176eff722839/numpy-2.2.6-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f9f1adb22318e121c5c69a09142811a201ef17ab257a1e66ca3025065b7f53ae", size = 21176963, upload-time = "2025-05-17T21:31:19.36Z" }, + { url = "https://files.pythonhosted.org/packages/b3/2b/64e1affc7972decb74c9e29e5649fac940514910960ba25cd9af4488b66c/numpy-2.2.6-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c820a93b0255bc360f53eca31a0e676fd1101f673dda8da93454a12e23fc5f7a", size = 14406743, upload-time = "2025-05-17T21:31:41.087Z" }, + { url = "https://files.pythonhosted.org/packages/4a/9f/0121e375000b5e50ffdd8b25bf78d8e1a5aa4cca3f185d41265198c7b834/numpy-2.2.6-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:3d70692235e759f260c3d837193090014aebdf026dfd167834bcba43e30c2a42", size = 5352616, upload-time = "2025-05-17T21:31:50.072Z" }, + { url = "https://files.pythonhosted.org/packages/31/0d/b48c405c91693635fbe2dcd7bc84a33a602add5f63286e024d3b6741411c/numpy-2.2.6-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:481b49095335f8eed42e39e8041327c05b0f6f4780488f61286ed3c01368d491", size = 6889579, upload-time = "2025-05-17T21:32:01.712Z" }, + { url = "https://files.pythonhosted.org/packages/52/b8/7f0554d49b565d0171eab6e99001846882000883998e7b7d9f0d98b1f934/numpy-2.2.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b64d8d4d17135e00c8e346e0a738deb17e754230d7e0810ac5012750bbd85a5a", size = 14312005, upload-time = "2025-05-17T21:32:23.332Z" }, + { url = "https://files.pythonhosted.org/packages/b3/dd/2238b898e51bd6d389b7389ffb20d7f4c10066d80351187ec8e303a5a475/numpy-2.2.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba10f8411898fc418a521833e014a77d3ca01c15b0c6cdcce6a0d2897e6dbbdf", size = 16821570, upload-time = "2025-05-17T21:32:47.991Z" }, + { url = "https://files.pythonhosted.org/packages/83/6c/44d0325722cf644f191042bf47eedad61c1e6df2432ed65cbe28509d404e/numpy-2.2.6-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:bd48227a919f1bafbdda0583705e547892342c26fb127219d60a5c36882609d1", size = 15818548, upload-time = "2025-05-17T21:33:11.728Z" }, + { url = "https://files.pythonhosted.org/packages/ae/9d/81e8216030ce66be25279098789b665d49ff19eef08bfa8cb96d4957f422/numpy-2.2.6-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:9551a499bf125c1d4f9e250377c1ee2eddd02e01eac6644c080162c0c51778ab", size = 18620521, upload-time = "2025-05-17T21:33:39.139Z" }, + { url = "https://files.pythonhosted.org/packages/6a/fd/e19617b9530b031db51b0926eed5345ce8ddc669bb3bc0044b23e275ebe8/numpy-2.2.6-cp311-cp311-win32.whl", hash = "sha256:0678000bb9ac1475cd454c6b8c799206af8107e310843532b04d49649c717a47", size = 6525866, upload-time = "2025-05-17T21:33:50.273Z" }, + { url = "https://files.pythonhosted.org/packages/31/0a/f354fb7176b81747d870f7991dc763e157a934c717b67b58456bc63da3df/numpy-2.2.6-cp311-cp311-win_amd64.whl", hash = "sha256:e8213002e427c69c45a52bbd94163084025f533a55a59d6f9c5b820774ef3303", size = 12907455, upload-time = "2025-05-17T21:34:09.135Z" }, + { url = "https://files.pythonhosted.org/packages/82/5d/c00588b6cf18e1da539b45d3598d3557084990dcc4331960c15ee776ee41/numpy-2.2.6-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:41c5a21f4a04fa86436124d388f6ed60a9343a6f767fced1a8a71c3fbca038ff", size = 20875348, upload-time = "2025-05-17T21:34:39.648Z" }, + { url = "https://files.pythonhosted.org/packages/66/ee/560deadcdde6c2f90200450d5938f63a34b37e27ebff162810f716f6a230/numpy-2.2.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:de749064336d37e340f640b05f24e9e3dd678c57318c7289d222a8a2f543e90c", size = 14119362, upload-time = "2025-05-17T21:35:01.241Z" }, + { url = "https://files.pythonhosted.org/packages/3c/65/4baa99f1c53b30adf0acd9a5519078871ddde8d2339dc5a7fde80d9d87da/numpy-2.2.6-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:894b3a42502226a1cac872f840030665f33326fc3dac8e57c607905773cdcde3", size = 5084103, upload-time = "2025-05-17T21:35:10.622Z" }, + { url = "https://files.pythonhosted.org/packages/cc/89/e5a34c071a0570cc40c9a54eb472d113eea6d002e9ae12bb3a8407fb912e/numpy-2.2.6-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:71594f7c51a18e728451bb50cc60a3ce4e6538822731b2933209a1f3614e9282", size = 6625382, upload-time = "2025-05-17T21:35:21.414Z" }, + { url = "https://files.pythonhosted.org/packages/f8/35/8c80729f1ff76b3921d5c9487c7ac3de9b2a103b1cd05e905b3090513510/numpy-2.2.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f2618db89be1b4e05f7a1a847a9c1c0abd63e63a1607d892dd54668dd92faf87", size = 14018462, upload-time = "2025-05-17T21:35:42.174Z" }, + { url = "https://files.pythonhosted.org/packages/8c/3d/1e1db36cfd41f895d266b103df00ca5b3cbe965184df824dec5c08c6b803/numpy-2.2.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd83c01228a688733f1ded5201c678f0c53ecc1006ffbc404db9f7a899ac6249", size = 16527618, upload-time = "2025-05-17T21:36:06.711Z" }, + { url = "https://files.pythonhosted.org/packages/61/c6/03ed30992602c85aa3cd95b9070a514f8b3c33e31124694438d88809ae36/numpy-2.2.6-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:37c0ca431f82cd5fa716eca9506aefcabc247fb27ba69c5062a6d3ade8cf8f49", size = 15505511, upload-time = "2025-05-17T21:36:29.965Z" }, + { url = "https://files.pythonhosted.org/packages/b7/25/5761d832a81df431e260719ec45de696414266613c9ee268394dd5ad8236/numpy-2.2.6-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:fe27749d33bb772c80dcd84ae7e8df2adc920ae8297400dabec45f0dedb3f6de", size = 18313783, upload-time = "2025-05-17T21:36:56.883Z" }, + { url = "https://files.pythonhosted.org/packages/57/0a/72d5a3527c5ebffcd47bde9162c39fae1f90138c961e5296491ce778e682/numpy-2.2.6-cp312-cp312-win32.whl", hash = "sha256:4eeaae00d789f66c7a25ac5f34b71a7035bb474e679f410e5e1a94deb24cf2d4", size = 6246506, upload-time = "2025-05-17T21:37:07.368Z" }, + { url = "https://files.pythonhosted.org/packages/36/fa/8c9210162ca1b88529ab76b41ba02d433fd54fecaf6feb70ef9f124683f1/numpy-2.2.6-cp312-cp312-win_amd64.whl", hash = "sha256:c1f9540be57940698ed329904db803cf7a402f3fc200bfe599334c9bd84a40b2", size = 12614190, upload-time = "2025-05-17T21:37:26.213Z" }, + { url = "https://files.pythonhosted.org/packages/f9/5c/6657823f4f594f72b5471f1db1ab12e26e890bb2e41897522d134d2a3e81/numpy-2.2.6-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:0811bb762109d9708cca4d0b13c4f67146e3c3b7cf8d34018c722adb2d957c84", size = 20867828, upload-time = "2025-05-17T21:37:56.699Z" }, + { url = "https://files.pythonhosted.org/packages/dc/9e/14520dc3dadf3c803473bd07e9b2bd1b69bc583cb2497b47000fed2fa92f/numpy-2.2.6-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:287cc3162b6f01463ccd86be154f284d0893d2b3ed7292439ea97eafa8170e0b", size = 14143006, upload-time = "2025-05-17T21:38:18.291Z" }, + { url = "https://files.pythonhosted.org/packages/4f/06/7e96c57d90bebdce9918412087fc22ca9851cceaf5567a45c1f404480e9e/numpy-2.2.6-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:f1372f041402e37e5e633e586f62aa53de2eac8d98cbfb822806ce4bbefcb74d", size = 5076765, upload-time = "2025-05-17T21:38:27.319Z" }, + { url = "https://files.pythonhosted.org/packages/73/ed/63d920c23b4289fdac96ddbdd6132e9427790977d5457cd132f18e76eae0/numpy-2.2.6-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:55a4d33fa519660d69614a9fad433be87e5252f4b03850642f88993f7b2ca566", size = 6617736, upload-time = "2025-05-17T21:38:38.141Z" }, + { url = "https://files.pythonhosted.org/packages/85/c5/e19c8f99d83fd377ec8c7e0cf627a8049746da54afc24ef0a0cb73d5dfb5/numpy-2.2.6-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f92729c95468a2f4f15e9bb94c432a9229d0d50de67304399627a943201baa2f", size = 14010719, upload-time = "2025-05-17T21:38:58.433Z" }, + { url = "https://files.pythonhosted.org/packages/19/49/4df9123aafa7b539317bf6d342cb6d227e49f7a35b99c287a6109b13dd93/numpy-2.2.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1bc23a79bfabc5d056d106f9befb8d50c31ced2fbc70eedb8155aec74a45798f", size = 16526072, upload-time = "2025-05-17T21:39:22.638Z" }, + { url = "https://files.pythonhosted.org/packages/b2/6c/04b5f47f4f32f7c2b0e7260442a8cbcf8168b0e1a41ff1495da42f42a14f/numpy-2.2.6-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:e3143e4451880bed956e706a3220b4e5cf6172ef05fcc397f6f36a550b1dd868", size = 15503213, upload-time = "2025-05-17T21:39:45.865Z" }, + { url = "https://files.pythonhosted.org/packages/17/0a/5cd92e352c1307640d5b6fec1b2ffb06cd0dabe7d7b8227f97933d378422/numpy-2.2.6-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:b4f13750ce79751586ae2eb824ba7e1e8dba64784086c98cdbbcc6a42112ce0d", size = 18316632, upload-time = "2025-05-17T21:40:13.331Z" }, + { url = "https://files.pythonhosted.org/packages/f0/3b/5cba2b1d88760ef86596ad0f3d484b1cbff7c115ae2429678465057c5155/numpy-2.2.6-cp313-cp313-win32.whl", hash = "sha256:5beb72339d9d4fa36522fc63802f469b13cdbe4fdab4a288f0c441b74272ebfd", size = 6244532, upload-time = "2025-05-17T21:43:46.099Z" }, + { url = "https://files.pythonhosted.org/packages/cb/3b/d58c12eafcb298d4e6d0d40216866ab15f59e55d148a5658bb3132311fcf/numpy-2.2.6-cp313-cp313-win_amd64.whl", hash = "sha256:b0544343a702fa80c95ad5d3d608ea3599dd54d4632df855e4c8d24eb6ecfa1c", size = 12610885, upload-time = "2025-05-17T21:44:05.145Z" }, + { url = "https://files.pythonhosted.org/packages/6b/9e/4bf918b818e516322db999ac25d00c75788ddfd2d2ade4fa66f1f38097e1/numpy-2.2.6-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:0bca768cd85ae743b2affdc762d617eddf3bcf8724435498a1e80132d04879e6", size = 20963467, upload-time = "2025-05-17T21:40:44Z" }, + { url = "https://files.pythonhosted.org/packages/61/66/d2de6b291507517ff2e438e13ff7b1e2cdbdb7cb40b3ed475377aece69f9/numpy-2.2.6-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:fc0c5673685c508a142ca65209b4e79ed6740a4ed6b2267dbba90f34b0b3cfda", size = 14225144, upload-time = "2025-05-17T21:41:05.695Z" }, + { url = "https://files.pythonhosted.org/packages/e4/25/480387655407ead912e28ba3a820bc69af9adf13bcbe40b299d454ec011f/numpy-2.2.6-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:5bd4fc3ac8926b3819797a7c0e2631eb889b4118a9898c84f585a54d475b7e40", size = 5200217, upload-time = "2025-05-17T21:41:15.903Z" }, + { url = "https://files.pythonhosted.org/packages/aa/4a/6e313b5108f53dcbf3aca0c0f3e9c92f4c10ce57a0a721851f9785872895/numpy-2.2.6-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:fee4236c876c4e8369388054d02d0e9bb84821feb1a64dd59e137e6511a551f8", size = 6712014, upload-time = "2025-05-17T21:41:27.321Z" }, + { url = "https://files.pythonhosted.org/packages/b7/30/172c2d5c4be71fdf476e9de553443cf8e25feddbe185e0bd88b096915bcc/numpy-2.2.6-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e1dda9c7e08dc141e0247a5b8f49cf05984955246a327d4c48bda16821947b2f", size = 14077935, upload-time = "2025-05-17T21:41:49.738Z" }, + { url = "https://files.pythonhosted.org/packages/12/fb/9e743f8d4e4d3c710902cf87af3512082ae3d43b945d5d16563f26ec251d/numpy-2.2.6-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f447e6acb680fd307f40d3da4852208af94afdfab89cf850986c3ca00562f4fa", size = 16600122, upload-time = "2025-05-17T21:42:14.046Z" }, + { url = "https://files.pythonhosted.org/packages/12/75/ee20da0e58d3a66f204f38916757e01e33a9737d0b22373b3eb5a27358f9/numpy-2.2.6-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:389d771b1623ec92636b0786bc4ae56abafad4a4c513d36a55dce14bd9ce8571", size = 15586143, upload-time = "2025-05-17T21:42:37.464Z" }, + { url = "https://files.pythonhosted.org/packages/76/95/bef5b37f29fc5e739947e9ce5179ad402875633308504a52d188302319c8/numpy-2.2.6-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:8e9ace4a37db23421249ed236fdcdd457d671e25146786dfc96835cd951aa7c1", size = 18385260, upload-time = "2025-05-17T21:43:05.189Z" }, + { url = "https://files.pythonhosted.org/packages/09/04/f2f83279d287407cf36a7a8053a5abe7be3622a4363337338f2585e4afda/numpy-2.2.6-cp313-cp313t-win32.whl", hash = "sha256:038613e9fb8c72b0a41f025a7e4c3f0b7a1b5d768ece4796b674c8f3fe13efff", size = 6377225, upload-time = "2025-05-17T21:43:16.254Z" }, + { url = "https://files.pythonhosted.org/packages/67/0e/35082d13c09c02c011cf21570543d202ad929d961c02a147493cb0c2bdf5/numpy-2.2.6-cp313-cp313t-win_amd64.whl", hash = "sha256:6031dd6dfecc0cf9f668681a37648373bddd6421fff6c66ec1624eed0180ee06", size = 12771374, upload-time = "2025-05-17T21:43:35.479Z" }, + { url = "https://files.pythonhosted.org/packages/9e/3b/d94a75f4dbf1ef5d321523ecac21ef23a3cd2ac8b78ae2aac40873590229/numpy-2.2.6-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:0b605b275d7bd0c640cad4e5d30fa701a8d59302e127e5f79138ad62762c3e3d", size = 21040391, upload-time = "2025-05-17T21:44:35.948Z" }, + { url = "https://files.pythonhosted.org/packages/17/f4/09b2fa1b58f0fb4f7c7963a1649c64c4d315752240377ed74d9cd878f7b5/numpy-2.2.6-pp310-pypy310_pp73-macosx_14_0_x86_64.whl", hash = "sha256:7befc596a7dc9da8a337f79802ee8adb30a552a94f792b9c9d18c840055907db", size = 6786754, upload-time = "2025-05-17T21:44:47.446Z" }, + { url = "https://files.pythonhosted.org/packages/af/30/feba75f143bdc868a1cc3f44ccfa6c4b9ec522b36458e738cd00f67b573f/numpy-2.2.6-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ce47521a4754c8f4593837384bd3424880629f718d87c5d44f8ed763edd63543", size = 16643476, upload-time = "2025-05-17T21:45:11.871Z" }, + { url = "https://files.pythonhosted.org/packages/37/48/ac2a9584402fb6c0cd5b5d1a91dcf176b15760130dd386bbafdbfe3640bf/numpy-2.2.6-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:d042d24c90c41b54fd506da306759e06e568864df8ec17ccc17e9e884634fd00", size = 12812666, upload-time = "2025-05-17T21:45:31.426Z" }, +] + +[[package]] +name = "numpy" +version = "2.4.6" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version == '3.11.*' and sys_platform == 'win32'", + "python_full_version == '3.11.*' and sys_platform == 'emscripten'", + "python_full_version == '3.11.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", +] +sdist = { url = "https://files.pythonhosted.org/packages/d0/ad/fed0499ce6a338d2a03ebae59cd15093910c8875328855781952abf6c2fe/numpy-2.4.6.tar.gz", hash = "sha256:f3a3570c4a2a16746ac2c31a7c7c7b0c186b95ce902e33db6f28094ed7387dda", size = 20735807, upload-time = "2026-05-18T23:37:14.07Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b3/49/ec46835a70be8fa6446c495126ac84fdb28cb2558e1620ffb87a10c8b64c/numpy-2.4.6-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0280e0356c0829a18d9de1cb7eee50ec22ca639878d7240307ca0943d73cd2c4", size = 16969194, upload-time = "2026-05-18T23:33:13.503Z" }, + { url = "https://files.pythonhosted.org/packages/0e/0d/f5957185c0ee2f3e12f78715aa9e3b353fd83633316c8532b38faa37e3f6/numpy-2.4.6-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:110f8b71aacb688ec69062bb7f6938a0f8acb01b7c1c4beb453c65b6d234584d", size = 14964111, upload-time = "2026-05-18T23:33:17.795Z" }, + { url = "https://files.pythonhosted.org/packages/ad/40/40a40ee0ddf7ceb782c49af278894b686e586d65d8c1889c8b5da01a3d7d/numpy-2.4.6-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:4cfe66903cc32a9921a6733d96b19bb6abf310397581bbad89c228f5abaf0ee8", size = 5469159, upload-time = "2026-05-18T23:33:20.654Z" }, + { url = "https://files.pythonhosted.org/packages/63/13/f9a8046535cb21deae82f8d03de9617e08882d274fad2539630761888228/numpy-2.4.6-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:8155154c7c691289fe18f510b5d4657c68c67989f293f0535a91360392ff6538", size = 6798936, upload-time = "2026-05-18T23:33:22.987Z" }, + { url = "https://files.pythonhosted.org/packages/33/a8/6fa8c1a345a8c85dbb21932c447bee07c30a2c2a3f31e369c0a84b300147/numpy-2.4.6-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0ab0a9c4ffb1a6d95ef519fe4247dba8eb6b18ad93999f76b7f657039acabd47", size = 15966692, upload-time = "2026-05-18T23:33:26.62Z" }, + { url = "https://files.pythonhosted.org/packages/02/03/74fe2a4cb3817d94d86402f2506554130a2f01414e299b5a843e5a8a957f/numpy-2.4.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:89cd468399cfd2504718f0ba50e410dca55a170b61a02ad92bb18c8a65186e93", size = 16918164, upload-time = "2026-05-18T23:33:29.955Z" }, + { url = "https://files.pythonhosted.org/packages/c5/80/3615be3313f7e7696609bc194b9f0101da809df79e859bdb84e0cd043f46/numpy-2.4.6-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c2d37ab77531417474168eb79d6d80b14f821a966818505d03013d0833edb7a8", size = 17322877, upload-time = "2026-05-18T23:33:34.724Z" }, + { url = "https://files.pythonhosted.org/packages/ca/ac/a691e0fe2675e370d0e08ff905adc49a1c8830e8cae03efe4477e92cd55d/numpy-2.4.6-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:f407cb6b8e9d6d8c626bc73c945db1706035af8fd632295547bf1c9e46d092d6", size = 18651487, upload-time = "2026-05-18T23:33:38.217Z" }, + { url = "https://files.pythonhosted.org/packages/15/a7/9bc1cd626d7bf6869bfedf27b91b6ab5dd607758bf8e959d6fa80c6a59cb/numpy-2.4.6-cp311-cp311-win32.whl", hash = "sha256:ddea102b48f9e339f3948bf22040944184627a30fdf7f858667673b9c5f033c8", size = 6233945, upload-time = "2026-05-18T23:33:41.331Z" }, + { url = "https://files.pythonhosted.org/packages/c5/31/7fc6239c12bce7e931463251cca4426c465e1876ba3cc785402ef4dd8f4e/numpy-2.4.6-cp311-cp311-win_amd64.whl", hash = "sha256:1e254a00cdf42b1e4d5b3d68d33af63268d41340d8885df2ab6470f2e1500147", size = 12608406, upload-time = "2026-05-18T23:33:44.131Z" }, + { url = "https://files.pythonhosted.org/packages/27/83/140f85a466595a16382996a1bf06b2b54bcd597488921b0c9daaeeda72af/numpy-2.4.6-cp311-cp311-win_arm64.whl", hash = "sha256:ed9749eef4cbd126da3dc1d6bcb3a57f5eb7ac6a6484146bdbf743f552dfc577", size = 10479528, upload-time = "2026-05-18T23:33:50.725Z" }, + { url = "https://files.pythonhosted.org/packages/95/2a/3d7b5ac8aac24feaf9ad7ed58f45b0bbc06d37e4338ae84c9f2298b570f9/numpy-2.4.6-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:001fbb8e08d942dd57599e781f2472269ee7f2755fae407b4f67b2f0b17da3f1", size = 16689119, upload-time = "2026-05-18T23:33:54.065Z" }, + { url = "https://files.pythonhosted.org/packages/ea/12/92c4c131527599e8288d6918e888d88726f84d805d784b771f32408aeaef/numpy-2.4.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ebfb099f8dcf083deef3ac1ca4c1503f387cf76296fcb3816b66f5ecb5f54fdb", size = 14699246, upload-time = "2026-05-18T23:33:57.621Z" }, + { url = "https://files.pythonhosted.org/packages/ad/fe/c0a6b7b2ca128a8fb228575147073b660656734b8ebe4d76c8fd748dcc79/numpy-2.4.6-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:3213d622a0283a39a93d188f3cf72b26862df52fbb4ca3697f51705016523d41", size = 5204410, upload-time = "2026-05-18T23:34:00.302Z" }, + { url = "https://files.pythonhosted.org/packages/f3/d4/9770d14ba719432bb90a421bfd443872ed0f70f7264b64bec12ea363d5fd/numpy-2.4.6-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:357cc07a6d7b0b182ff02249616a03742827ebb1277546b5c7cd7f7620a45698", size = 6551240, upload-time = "2026-05-18T23:34:02.852Z" }, + { url = "https://files.pythonhosted.org/packages/c9/c6/50a46a6205feba2343f1d6d17438107c5dc491ed1c736e6ea68689fd906b/numpy-2.4.6-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5f9fb9157b4ce2971008323afe46053787b526ef624fea915b261468a8421a0f", size = 15671012, upload-time = "2026-05-18T23:34:05.485Z" }, + { url = "https://files.pythonhosted.org/packages/99/60/14115e6364fa676c5397c2ad3004e527e9aa487abf5d0706ec81bbd08529/numpy-2.4.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:90f9849678c75fe7afa2d348ac842c168b0a4d3d61919687216dfc547976d853", size = 16645538, upload-time = "2026-05-18T23:34:09.265Z" }, + { url = "https://files.pythonhosted.org/packages/ae/c5/693cbe59e57db94d2231fa519ca3978dc9e19da5a8f088588f5c6e947ff2/numpy-2.4.6-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:c1a2af6c6ef86344a6b0db6b97834208bf598db514f2b155042439b62605601a", size = 17020706, upload-time = "2026-05-18T23:34:13.053Z" }, + { url = "https://files.pythonhosted.org/packages/ef/fc/85b7c4eff9b4966ade25c2273cf7e7012e92366c032058653934b37de044/numpy-2.4.6-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e5805d5a22fd19c8ccff10a9561f9df94436b0545619ea579db2d3c35294bce2", size = 18368541, upload-time = "2026-05-18T23:34:17.024Z" }, + { url = "https://files.pythonhosted.org/packages/f6/81/e1b27545deedce7f4a0b348618c6b62d74e36a4dc9ccd42f3eb2f85eee32/numpy-2.4.6-cp312-cp312-win32.whl", hash = "sha256:e3eeb0aabd6bd5ce64faae67e9935203a6991b4bc2a485a767fbafb2c5125f45", size = 5962825, upload-time = "2026-05-18T23:34:20.3Z" }, + { url = "https://files.pythonhosted.org/packages/ab/ca/feab00bd44aa5fe1ad2c18f08b4d3bb92e26484b0b1d1443897809ed528c/numpy-2.4.6-cp312-cp312-win_amd64.whl", hash = "sha256:d8e8286dd7cea7895157318d1b91cdacac64c479f3cbc8dce548331728484751", size = 12321687, upload-time = "2026-05-18T23:34:23.095Z" }, + { url = "https://files.pythonhosted.org/packages/63/cf/5a6d34850a39d1093558564f77ee8e8e0bee5061151b8f05a55711001ec7/numpy-2.4.6-cp312-cp312-win_arm64.whl", hash = "sha256:4081eb135ac24158bd51cdfbef16f1c64df7063b1143f24731387137c092bec8", size = 10221482, upload-time = "2026-05-18T23:34:25.876Z" }, + { url = "https://files.pythonhosted.org/packages/fb/82/bdab26d7438c6791ca31b7c024ca37c1eab8b726ba236129005cd4a06e45/numpy-2.4.6-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:511dbaf848decaaaf4b4ca48032619fb3138710c4bf7da7617765edad1ef96b0", size = 16684648, upload-time = "2026-05-18T23:34:29.41Z" }, + { url = "https://files.pythonhosted.org/packages/1b/30/a80189bcc7f5e4258b3fbc3968d909d1756f54d023299ecc39ad6fdb9ef8/numpy-2.4.6-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:bf162abab1c1a736333192707cef898e735a5ca00f38f27eeedf44b39d9e85eb", size = 14693902, upload-time = "2026-05-18T23:34:33.013Z" }, + { url = "https://files.pythonhosted.org/packages/97/12/70b5d0d7c15e1ebb8a6a84a8caa1d19e181d84fb58bb6d70aca29099dec1/numpy-2.4.6-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:043191bfa8eab18c776647b62723ac9dddece59743b13f49b2016094129c2b3f", size = 5198992, upload-time = "2026-05-18T23:34:36.132Z" }, + { url = "https://files.pythonhosted.org/packages/ba/8c/ebd2a8f8a83541f8d38cc5667e8c2b69cecfd30da6e45693e8158857d44b/numpy-2.4.6-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:6180d8b35af935aed8ece3a85e0a43f87393ae0ac87c8d2c8bd2c993f7270ef3", size = 6546944, upload-time = "2026-05-18T23:34:38.484Z" }, + { url = "https://files.pythonhosted.org/packages/bb/c5/7b863a97a91671a0338f4253bd3b5a3d3852f0692dae91711c9f4a10e787/numpy-2.4.6-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:72fbe16c6fac95aedf5937fa873445cec2110be35d8a4e9433d7501fd98dae6b", size = 15669392, upload-time = "2026-05-18T23:34:41.257Z" }, + { url = "https://files.pythonhosted.org/packages/a5/9d/3584b9984ca4c047aea75214ce1a4c4c73d849bd71b604264b7f5653f8a8/numpy-2.4.6-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a7830bab239b79cda9c08c2da014761cafb48da6150e1da17ac06283f43b6089", size = 16633220, upload-time = "2026-05-18T23:34:45.075Z" }, + { url = "https://files.pythonhosted.org/packages/05/ae/7c67fba23bd98caec7c99261f3a16072ade14813486b0282cb29846de832/numpy-2.4.6-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ef4aea96ce4d3b074422cb4f2f64e216bf9e213004bb58ecfdf50ea02ea8eb9a", size = 17020800, upload-time = "2026-05-18T23:34:49.065Z" }, + { url = "https://files.pythonhosted.org/packages/d9/5d/3b6725cb31d983c5e66916f5d36f6d7e5521129e4c4404d64f918292a5b6/numpy-2.4.6-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:dfa20cc6ca228e6b155b11da03825975ce66aea520985dbbddf0f2a5a495c605", size = 18357600, upload-time = "2026-05-18T23:34:52.709Z" }, + { url = "https://files.pythonhosted.org/packages/f7/da/2ccc6c2fe8898dee01d90c75c5f5f914a23daf99e3e0f59516a08760c8b5/numpy-2.4.6-cp313-cp313-win32.whl", hash = "sha256:56b39e5e0622a09a25bf5baf62f4bcf0cb8a41ae6e2819cf49bbc5a74c083f91", size = 5961134, upload-time = "2026-05-18T23:34:55.618Z" }, + { url = "https://files.pythonhosted.org/packages/b5/cd/9cc4dc876fb065d5c220aae4d5e14826b2715331bb7618ce1fb07a679d99/numpy-2.4.6-cp313-cp313-win_amd64.whl", hash = "sha256:c4fc99836233ea196540b17ab0983aff60ed07941751930f5f4d05bc3b3b7359", size = 12318598, upload-time = "2026-05-18T23:34:58.928Z" }, + { url = "https://files.pythonhosted.org/packages/39/1e/c0bcba1f8694116485fe28fd1be698c278fcda4141c5b0e53a2aed8b12a8/numpy-2.4.6-cp313-cp313-win_arm64.whl", hash = "sha256:a7c711e21628b52034bb5ab8d1bce291f752fcc5e92accc615778acee1ff4778", size = 10222272, upload-time = "2026-05-18T23:35:02.167Z" }, + { url = "https://files.pythonhosted.org/packages/63/6d/cc5619247c8f4204e507f5883528372e4ac4bb189e579fb859a12e480b1f/numpy-2.4.6-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:112b06a867b235ef466ed3508ddf0238050df9c727cafb5301ac385b899189a1", size = 14821197, upload-time = "2026-05-18T23:35:05.468Z" }, + { url = "https://files.pythonhosted.org/packages/00/58/f1c39161c87d9e9bed660f1ed4bafc0e403d5ec9650b6dd77aead07d489b/numpy-2.4.6-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:eaf7fa2de5c0be8ae6ff8e9bea2ccd725e980541244521d8d4b5f3354a27babe", size = 5326287, upload-time = "2026-05-18T23:35:08.693Z" }, + { url = "https://files.pythonhosted.org/packages/af/57/3917ab0fd97f271a8694513581b8a36c655f111c446852c302f04ccdb6fc/numpy-2.4.6-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:7265a2f3d436e54ef9f2b52b5c937e6be778781bd97a590319d7348f1c1ca997", size = 6646763, upload-time = "2026-05-18T23:35:11.459Z" }, + { url = "https://files.pythonhosted.org/packages/eb/0f/037e64c494b67581ae18193d770adef354c41f3f2c8ebf865602d949bf8f/numpy-2.4.6-cp313-cp313t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f74a575920ab21fe304421a3fc28793d82e299cae9eccb37084e9fc7f3617c20", size = 15728070, upload-time = "2026-05-18T23:35:14.79Z" }, + { url = "https://files.pythonhosted.org/packages/21/a6/5d2bae9c9542eb4df16dc9c46dc79c186e9bad53805dfa5399a6023c6db0/numpy-2.4.6-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ede83e07a75dd06bc501566c1eca2afc0d61677c1472ac9ad93fdee6e638a48d", size = 16681752, upload-time = "2026-05-18T23:35:18.836Z" }, + { url = "https://files.pythonhosted.org/packages/92/14/23d1dfb410ae362cd59ce53e936b1513d545eb40db3949ced632e19a459e/numpy-2.4.6-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:68bb27509ac1b9a3443094260f6326150663b06abe40b73a2f81160623da5b67", size = 17086024, upload-time = "2026-05-18T23:35:22.52Z" }, + { url = "https://files.pythonhosted.org/packages/4b/6e/23595a2c642cdf3bc567877064bdd7f91c8b0038a4453cf2daf7248eafe9/numpy-2.4.6-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:a0df0043bdb289bde1f62da130d20df23d58b45429f752bc7a8fc5325a225ecd", size = 18403398, upload-time = "2026-05-18T23:35:26.398Z" }, + { url = "https://files.pythonhosted.org/packages/8a/90/0ac3bc947217e66dec77e7cbc6a1979d1af70b6461b82f620d3bccd5e4c8/numpy-2.4.6-cp313-cp313t-win32.whl", hash = "sha256:29a287e0cf63ff528da061de6b9f64a4618da591ca1046aafc54062e40ca7eab", size = 6084971, upload-time = "2026-05-18T23:35:29.387Z" }, + { url = "https://files.pythonhosted.org/packages/77/71/5673e351671a1d2bd6063b91b44f70c0affea7d1516fa7a6572941ba4aa1/numpy-2.4.6-cp313-cp313t-win_amd64.whl", hash = "sha256:25c692919ac5a01f170a3bfcd62d745b24fd095c353d50812637d6fcab442e75", size = 12458532, upload-time = "2026-05-18T23:35:32.175Z" }, + { url = "https://files.pythonhosted.org/packages/3f/88/19d3503c5046e688f049274b27a3ef3d771152fa80d3ba3d01a3dff61abe/numpy-2.4.6-cp313-cp313t-win_arm64.whl", hash = "sha256:1e978ec1e8bd0e0e4de6bb75de9d30cbb74db6b6a2bb727618613703ca0167dd", size = 10291881, upload-time = "2026-05-18T23:35:35.465Z" }, + { url = "https://files.pythonhosted.org/packages/f8/91/3ab2044d05fd16d343c5ac2e69b127f1b2854040dd20b193257c78028bd3/numpy-2.4.6-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:06ca2f61ec4385a07a6977c55ba998a4466c123642b4a32694d3128fce18c079", size = 16683458, upload-time = "2026-05-18T23:35:38.353Z" }, + { url = "https://files.pythonhosted.org/packages/8e/62/764ce66fa4147ae6d73071a3abf804ffe606f174618697c571acdf26a7c9/numpy-2.4.6-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:38efbc8de75c7a0fc1ac190162d892787f3f47b57cc291231aafee36b80982b7", size = 14704559, upload-time = "2026-05-18T23:35:42.14Z" }, + { url = "https://files.pythonhosted.org/packages/60/61/23f27c172f022e04025b7dc2367f4d63c1a398120607ec896228649a6f48/numpy-2.4.6-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:d581b735e177fdcdce6fed8e7e8880a3fb6ee4e3653a3ac6af01c6f4c03effc5", size = 5209716, upload-time = "2026-05-18T23:35:45.377Z" }, + { url = "https://files.pythonhosted.org/packages/03/71/21cf70dc6ea3e3acb95fc53a265b2fc248b981f0194ceb5b475271b8809d/numpy-2.4.6-cp314-cp314-macosx_14_0_x86_64.whl", hash = "sha256:0a041d3d761dc3c35cc56ce0351506a02bcbc25f7b169f652435141a17db9096", size = 6543947, upload-time = "2026-05-18T23:35:47.926Z" }, + { url = "https://files.pythonhosted.org/packages/d5/91/64288395ee1799bd2e0b04a305dce9666da90c961e1f3fe982a05ee1c036/numpy-2.4.6-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:40fdc1ae7125e518ea98e53e69a4ebc27e1fd50510c47b7ea130cf21e5e1d42b", size = 15685197, upload-time = "2026-05-18T23:35:50.863Z" }, + { url = "https://files.pythonhosted.org/packages/f3/eb/ebffaa97dc55502df69584a8f0dcf07f69a3e0b3e2323670a2722db9aa39/numpy-2.4.6-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a2c306dea656c12c68f51f4cea133cbe78ca7435eb28c735eac1d3ebe73be6e8", size = 16638245, upload-time = "2026-05-18T23:35:54.752Z" }, + { url = "https://files.pythonhosted.org/packages/b8/0b/54f9da33128d7e350fab89c7455902eeae70349ee52bddb448dc4a576f45/numpy-2.4.6-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:33111801a01c12a8a1e3721f0a9232f8cfc8ae2c6b7098167e6f623c6073f402", size = 17036587, upload-time = "2026-05-18T23:35:58.355Z" }, + { url = "https://files.pythonhosted.org/packages/b6/f0/fdebc1052db1cc37c64beb22072d67cd6d1c71adca1299f53dec2b5e20d3/numpy-2.4.6-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:ae506e6902902557576a26ff33eda8695e7ecb3cb36c3b573a0765dee114ebdb", size = 18363226, upload-time = "2026-05-18T23:36:02.845Z" }, + { url = "https://files.pythonhosted.org/packages/aa/b4/298628d98c72b57e57f7165ae6a481a1deaf6f3c28262a6e4c739c275930/numpy-2.4.6-cp314-cp314-win32.whl", hash = "sha256:aaf159caa35993cb1f56fb9b8e4610d35758e7ca005412eb1daa856a78c9c4b1", size = 6010196, upload-time = "2026-05-18T23:36:05.92Z" }, + { url = "https://files.pythonhosted.org/packages/df/ac/46de6dda46478f7942f839e094970be2d4a861e005c4b3bf07c92e291a09/numpy-2.4.6-cp314-cp314-win_amd64.whl", hash = "sha256:b507f5c4c1d508876d1819b6bf9a49d365b96320b5d4993426b33a23ca4b8261", size = 12450334, upload-time = "2026-05-18T23:36:09.107Z" }, + { url = "https://files.pythonhosted.org/packages/78/92/b8b798ac784102c0da830d2257d59358e3d3d90d1e2b3f2575dad976c5cf/numpy-2.4.6-cp314-cp314-win_arm64.whl", hash = "sha256:6f41ae150c4e32db4f3310cdaf64b1593a03dbabe29eec77fc9b50fe64061df6", size = 10495678, upload-time = "2026-05-18T23:36:12.766Z" }, + { url = "https://files.pythonhosted.org/packages/30/34/ec28d1aa8115971537c01469ab2011ee96827930f0a124de1000cc2a7ed7/numpy-2.4.6-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:ece3d2cfe132e7d51f44a832b303895e6f2d499c5e74dfbdb06ee246147a304a", size = 14823672, upload-time = "2026-05-18T23:36:16.473Z" }, + { url = "https://files.pythonhosted.org/packages/16/bd/f6d1fede4e54e8042a7ff97bb495510f3c220f94bcd9e8b228e87c92cc0d/numpy-2.4.6-cp314-cp314t-macosx_14_0_arm64.whl", hash = "sha256:e3e5193ef5a3dc73bceee50f7fdc2c90dbb76c42df8d8fae3d1067a583df579e", size = 5328731, upload-time = "2026-05-18T23:36:19.767Z" }, + { url = "https://files.pythonhosted.org/packages/f4/f0/e105b9e2fd728a9910103884decd6951d9dd73896b914a98d9a231de02ee/numpy-2.4.6-cp314-cp314t-macosx_14_0_x86_64.whl", hash = "sha256:17f9ade344e7d9b464a084d69bcf18fc691cb1db67c62ed80820bf4926d78f0e", size = 6649805, upload-time = "2026-05-18T23:36:22.266Z" }, + { url = "https://files.pythonhosted.org/packages/82/dd/1206a7ca6ab15e3f02069707ca96222e202af681bb73756da7527f3cb837/numpy-2.4.6-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9cd5ffd25db4e7ba6a375693b3fc0fc1791ec636c17db3720da19bde7180ec43", size = 15730496, upload-time = "2026-05-18T23:36:25.713Z" }, + { url = "https://files.pythonhosted.org/packages/51/e7/38d3ea825dcab85a591734decb2f6c67caa7c8367d374df1a1c3842f9b07/numpy-2.4.6-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7d92c3819208a60205a12a245c91ad70cb0a85336659b19b834205573ac8456e", size = 16679616, upload-time = "2026-05-18T23:36:29.652Z" }, + { url = "https://files.pythonhosted.org/packages/93/b7/caabfdf53edf663e0b4eb74d7d405d83baef09eb5e83bcd32d601d72b93e/numpy-2.4.6-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:e85b752a1e912b70eaad4fafbd4d1238007ab221de2009b9a2f5ae7461239895", size = 17085145, upload-time = "2026-05-18T23:36:33.449Z" }, + { url = "https://files.pythonhosted.org/packages/f9/45/68d7c33a6bcf3e5aa3bdbd57a367e6f615286dfd6482f97e8ffeb734306e/numpy-2.4.6-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:29cb7f67d10b479ff07c17d33e39f78c07f71c40ef30d63c153d340e96cd3fb4", size = 18403813, upload-time = "2026-05-18T23:36:37.369Z" }, + { url = "https://files.pythonhosted.org/packages/9c/50/0753655aa844c99cd9e018aacf76f130f1bd81d881bb74bc0aef5d73a8ba/numpy-2.4.6-cp314-cp314t-win32.whl", hash = "sha256:260a5d70215b61ab4fadf5c7baacd64821842975eea312125ed3c39a6391b063", size = 6156982, upload-time = "2026-05-18T23:36:40.817Z" }, + { url = "https://files.pythonhosted.org/packages/b2/d4/7c67becf668f973cb490cec3e98dfd799d866f9c989a54d355672cfa0db6/numpy-2.4.6-cp314-cp314t-win_amd64.whl", hash = "sha256:81a1cca95ed5bb92aa8b10dd2cdc9a0d3853a50fad926c28b5d7e8ea54389627", size = 12638908, upload-time = "2026-05-18T23:36:43.996Z" }, + { url = "https://files.pythonhosted.org/packages/43/bb/e1c71a4295b1b1d1393d50dbb4f2a36283c6859d9d3892e84f00ec5a91d5/numpy-2.4.6-cp314-cp314t-win_arm64.whl", hash = "sha256:0c9136e14ed34a9e343a31c533d78a9813a69a3148332bce5e9821cb2f996e66", size = 10565867, upload-time = "2026-05-18T23:36:47.114Z" }, + { url = "https://files.pythonhosted.org/packages/de/12/b422cc84439adc0d00de605bf4a308890ae5c26f2c71fbd73e5d08fbb0dd/numpy-2.4.6-pp311-pypy311_pp73-macosx_10_15_x86_64.whl", hash = "sha256:55cced7c52e981362f708ad635198e97a752dfba412cc03c23bbf3bd8d5cd662", size = 16847511, upload-time = "2026-05-18T23:36:50.673Z" }, + { url = "https://files.pythonhosted.org/packages/44/53/f481bef68011740f8849418d82db07230e825013f31f4eef5ba5b805316a/numpy-2.4.6-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:d6da64deb6b8ed903e7560180a92f2d804ee1ba5eeb849ac2748b8c1aba1f6d7", size = 14889064, upload-time = "2026-05-18T23:36:53.879Z" }, + { url = "https://files.pythonhosted.org/packages/7f/57/42ed575c10ced8af951d426bc4e1f8aff16fd851db33f067036215a7f860/numpy-2.4.6-pp311-pypy311_pp73-macosx_14_0_arm64.whl", hash = "sha256:68a5124b13fa6cc2086764a20005d30bc0548146f7f5322f02fce212ca14317f", size = 5394157, upload-time = "2026-05-18T23:36:57.194Z" }, + { url = "https://files.pythonhosted.org/packages/6a/ef/f66cc724fcc36c1e364c67f51ae9146090b8b584f27d58b97fdae3edd737/numpy-2.4.6-pp311-pypy311_pp73-macosx_14_0_x86_64.whl", hash = "sha256:948424b06129ce883307e8cff868c31396d8dc7630a59c61d70d98dbe70f222c", size = 6708728, upload-time = "2026-05-18T23:36:59.575Z" }, + { url = "https://files.pythonhosted.org/packages/1a/9c/c531f2293b91265d8b48e9b329f54fdd7ffae73cb4134ea10cca4237e9cc/numpy-2.4.6-pp311-pypy311_pp73-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5dbbdb29840ca3d91ee0fece42fc29278886d908280bfec0a5846c6f901a3eb0", size = 15798374, upload-time = "2026-05-18T23:37:02.674Z" }, + { url = "https://files.pythonhosted.org/packages/1a/b0/413077f6b1153ed3cba361401c6783bbad6114804a000cc22eb71c13e190/numpy-2.4.6-pp311-pypy311_pp73-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8ad03c0965fb3c692200e74d458ca28c1dbb4ce96f9a479a8aa041ad5fabca02", size = 16747286, upload-time = "2026-05-18T23:37:06.327Z" }, + { url = "https://files.pythonhosted.org/packages/15/ce/e5ec180bc41812edcd8daeb8639d205622c0e8c02259d8ab25a0201b3c2a/numpy-2.4.6-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:2803abfebfc990042cd494d8ce2d5f82e9d847af6d35ec486923aa19dbad5e73", size = 12504263, upload-time = "2026-05-18T23:37:09.715Z" }, +] + +[[package]] +name = "numpy" +version = "2.5.4" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.15' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version >= '3.15' and sys_platform == 'emscripten'", + "python_full_version == '3.14.*' and sys_platform == 'emscripten'", + "python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.14.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'win32'", + "python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'emscripten'", + "python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'", +] +sdist = { url = "https://files.pythonhosted.org/packages/95/b0/c7453d0b6e2073c3264468b106ee1563750cecc910965e67357e3698c83e/numpy-2.5.4.tar.gz", hash = "sha256:9a94cf751c9ad8ebaa835bcd3d40dacf8534ad086b88c38029b65123c7999d2a", size = 20866315, upload-time = "2026-10-10T20:05:31.422Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d0/97/ba2074e92b7befea137e77ea8471e768bbd87c339b7e8c9f5a931949f977/numpy-2.5.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:c6342f54c67093cae5c0227eb0eb772fdb79f2a2c37a6eb278b9909ee06aa356", size = 17001609, upload-time = "2026-10-10T20:02:40.843Z" }, + { url = "https://files.pythonhosted.org/packages/ff/a9/bac826765e971d8e16e2064e9ac7525fd69b40ac17c905033a7f5442023f/numpy-2.5.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b11e8fda06a7d69f15ebf542660b74466c2e51094800c1fb794f47ad4faeef17", size = 12015718, upload-time = "2026-10-10T20:02:43.45Z" }, + { url = "https://files.pythonhosted.org/packages/31/2f/5ea3570fcb8ccd0882bea99436a513b2c85dad8f774a2057849130a8fb99/numpy-2.5.4-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:9cb18a327b49c5c337f972b03682f6a49855525faaf3c0d3e9c96cd0fd8880a8", size = 5451717, upload-time = "2026-10-10T20:02:46.169Z" }, + { url = "https://files.pythonhosted.org/packages/34/f2/b4fc1bafca03868220b5eaf729d2f21ebd7d7b151c0f9e144fe212bbca35/numpy-2.5.4-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:aec3fc4b32ff82421274f5d205c559c51c840c8df66a78efd7f3612dd005a26a", size = 6789926, upload-time = "2026-10-10T20:02:48.139Z" }, + { url = "https://files.pythonhosted.org/packages/dc/96/8319e2457ae4333c62c815c7006b869a4f60985c1e01024c2f8c6c040fe5/numpy-2.5.4-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fe4d21ab149f15e4e6043dfb0de87e6e5f34ac176cde83060e9802981fca2ac2", size = 15695312, upload-time = "2026-10-10T20:02:50.115Z" }, + { url = "https://files.pythonhosted.org/packages/43/a3/c799c62e19c337e6d3770b08e475887fb30ce8477d3c09efca6b2f0228a6/numpy-2.5.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fbde6962867ee75b48b0ee29b2b9372ec5d617799dbaf38e82dc0596f2f7738a", size = 16727283, upload-time = "2026-10-10T20:02:53.186Z" }, + { url = "https://files.pythonhosted.org/packages/39/6b/3604e53fb00314d0dc1b94ec9125a1484f649c0a17480b1f0f0c7a9d6250/numpy-2.5.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:381a7a3d2e65e64c0ec302795ab9dc12bb1e73f150904699c153716177eebdaf", size = 17047890, upload-time = "2026-10-10T20:02:56.038Z" }, + { url = "https://files.pythonhosted.org/packages/4a/7a/e8b58a5289a0d464c52885de47c35a935cdd70c03a4c3ab94a5126416dd0/numpy-2.5.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b89d0aaae2fe498c648f4c4795c084db535af5bd98ef942b2a3681fb74ce8645", size = 18485839, upload-time = "2026-10-10T20:02:59.018Z" }, + { url = "https://files.pythonhosted.org/packages/6f/c9/47094f597015009f310b8c900def59065ef1ff5a6fe7b51fc65ec58ec2c6/numpy-2.5.4-cp312-cp312-win32.whl", hash = "sha256:9968ab7e49b93ac6e1c3b2239732183152c9150f16308d30b66a372cffe3483c", size = 6138936, upload-time = "2026-10-10T20:03:01.626Z" }, + { url = "https://files.pythonhosted.org/packages/12/33/fefe62073dc8acfd0f2b9ed7c003af2f50aa61555e113e6db02b8f79f145/numpy-2.5.4-cp312-cp312-win_amd64.whl", hash = "sha256:a7b1b6353e36a7e50de2973a38d705c88ee93adcf120673cee7f45a4a3fa223a", size = 12573091, upload-time = "2026-10-10T20:03:04.349Z" }, + { url = "https://files.pythonhosted.org/packages/1a/07/161270b0c2eec56e4c905f6d6d22e1b836887b2cb189d3f5820aa588e9dd/numpy-2.5.4-cp312-cp312-win_arm64.whl", hash = "sha256:aa1cce2ff3f8d953de38b76bf44602caeb69f101430208f64a10067f7cb4b1d3", size = 10521630, upload-time = "2026-10-10T20:03:06.767Z" }, + { url = "https://files.pythonhosted.org/packages/67/14/1c3ee0118a8fce08565a5d8482631608426a33af10a01077fada5dc7c119/numpy-2.5.4-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:2377da2dd3ba2c1200956acbab2a358c83b8e1f8531191672d1cd6ad83250d53", size = 16997729, upload-time = "2026-10-10T20:03:09.291Z" }, + { url = "https://files.pythonhosted.org/packages/83/8c/b0ea9477fb1f0d4484bbc5cba21678cc9969704d8d7f3f158d1db35f8e14/numpy-2.5.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:7415db95818b39ec475a5eea54d9e3b6bc83e3912158e46da3438cdce399804d", size = 12009826, upload-time = "2026-10-10T20:03:11.946Z" }, + { url = "https://files.pythonhosted.org/packages/e2/84/6a3d75b3ba3dfe84ac0053450753d1e6d250a8bf80f66474cc46d1fb643f/numpy-2.5.4-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:6d6a71b9d9a97c03633aa12565ef2825ffa036cc1d99cfd50dacf0f128af4fe2", size = 5445803, upload-time = "2026-10-10T20:03:14.329Z" }, + { url = "https://files.pythonhosted.org/packages/61/18/bb993f267ca20b376e07092a16793a5b31ed3138751e9ba480011a14d742/numpy-2.5.4-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:d8200f16437b289a5bb927c6e184eccc3e8389bc0070fea4cd5b9e13c1757959", size = 6786220, upload-time = "2026-10-10T20:03:16.602Z" }, + { url = "https://files.pythonhosted.org/packages/db/b6/135bb0953b61dc21c6cafa14b424ae666944e4899cf140e00c2b322a1a45/numpy-2.5.4-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1c2e71b04c6cad90026e544501bbe0ab9290fa8a4d845e7e8c0d124fb429c988", size = 15689178, upload-time = "2026-10-10T20:03:18.721Z" }, + { url = "https://files.pythonhosted.org/packages/da/24/3bd070f3269dc609d8f26b2643f62ef91bb415841c0b294805aaf7fe06da/numpy-2.5.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6ffa07666f8da0eef81d149934a626d0d95fbd6838432a33e66245423a9062c0", size = 16718044, upload-time = "2026-10-10T20:03:21.386Z" }, + { url = "https://files.pythonhosted.org/packages/c7/8e/9d15bd356b0a019c965312b1a3c6a727cac4cae5bc40045fbc12ce4cff9c/numpy-2.5.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:2fa3328f784fc8277fc48026f6cad516f5c561c5d8e2e39b3c9e0c8f23223b34", size = 17048364, upload-time = "2026-10-10T20:03:24.468Z" }, + { url = "https://files.pythonhosted.org/packages/dc/fe/9d5b560db964f15871885f2250795d15945f8699e17ef90c0c2ff4c875b2/numpy-2.5.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:b86966fbe4ad7de710422175572bcdc75fdedadfb54bc6fab7deabccddd7780b", size = 18474904, upload-time = "2026-10-10T20:03:27.895Z" }, + { url = "https://files.pythonhosted.org/packages/e9/98/d27552990f1bd611ef3e7466adadc78312ea2df63b83aad47fdc3d3ca8df/numpy-2.5.4-cp313-cp313-win32.whl", hash = "sha256:5258bc06526964be5face2fc6f756857a3f24f21ec3e72ca131337a75b165d6c", size = 6134537, upload-time = "2026-10-10T20:03:30.511Z" }, + { url = "https://files.pythonhosted.org/packages/90/8c/140a40398a66b4471211be1affdb6ed24c486d581bd28d07b7f2fcb69540/numpy-2.5.4-cp313-cp313-win_amd64.whl", hash = "sha256:8b4d2fd2d34e5f8c9235ee787de5631a37a28402b15cb80814df973d2be54129", size = 12566113, upload-time = "2026-10-10T20:03:32.612Z" }, + { url = "https://files.pythonhosted.org/packages/34/52/01d205e5e8ccb27b2b0b141e801f22b830198c979111b0fa44771438d9a9/numpy-2.5.4-cp313-cp313-win_arm64.whl", hash = "sha256:bc39ac66a7a9a3fbd6134fda43136b60ffde99c8f4501e64e0d2b24da137babf", size = 10519523, upload-time = "2026-10-10T20:03:35.163Z" }, + { url = "https://files.pythonhosted.org/packages/99/ba/005cb5edd580d2f84d7ca3206b92dc17d4388e56e6f87ffe8f2762f83139/numpy-2.5.4-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:c668b2f0d651605b58892644b0e302c7157f7159544227758c896982ef384b18", size = 17005499, upload-time = "2026-10-10T20:03:37.961Z" }, + { url = "https://files.pythonhosted.org/packages/f3/49/fee7587c33ee35f7977f9051d7f2023d4e7246d62710c80f20c2361ea232/numpy-2.5.4-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:ffa6ce09a1c6a08e9667dd9c97aa0b14184e8d18f2a14b78b2a2328c9147f076", size = 12019666, upload-time = "2026-10-10T20:03:40.606Z" }, + { url = "https://files.pythonhosted.org/packages/d5/b2/c6ce165acffceb15a82c07b9cc77d391f86b3f379ba62911908ae5d34b91/numpy-2.5.4-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:956555e0603a4d38019ae6925711cb9dc43195c076a928accf7ea5d50bddfe53", size = 5455617, upload-time = "2026-10-10T20:03:43.138Z" }, + { url = "https://files.pythonhosted.org/packages/77/7f/dd85ce260a669a89be06842cf355d7353a33e6cfbc590fb8ebb947d88dc9/numpy-2.5.4-cp314-cp314-macosx_14_0_x86_64.whl", hash = "sha256:2c2c4afffdeb7920e445028dd71eb932cac3e704792e964bc2a232426d4f1255", size = 6791932, upload-time = "2026-10-10T20:03:44.874Z" }, + { url = "https://files.pythonhosted.org/packages/63/d6/34b0a2b0741386a63025a65a2c09caaaaaad6d0ca95b66cd65c30dd7fcb5/numpy-2.5.4-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4054173604cd8658796053f1f3bc0befb68ec1c0762c57fdad61e199256a8617", size = 15710899, upload-time = "2026-10-10T20:03:46.839Z" }, + { url = "https://files.pythonhosted.org/packages/16/d5/928078d2b28f26829b138b4a6c3980045022fb409f570657a224ae60ef4e/numpy-2.5.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d549420b8858885cea8838a727842249218b9c1da24dd517e25c9c7a948310a3", size = 16721710, upload-time = "2026-10-10T20:03:49.489Z" }, + { url = "https://files.pythonhosted.org/packages/f9/cf/673fd1b8f4cd78eb6320e87ec4c90ac19c095644259e3749853a405c70f4/numpy-2.5.4-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:823874a507a84af050493b622affde94b6f7c3a0dc22cb2801381bc03b871c00", size = 17066182, upload-time = "2026-10-10T20:03:52.25Z" }, + { url = "https://files.pythonhosted.org/packages/f3/92/a77b5061b1b3e2643928c37976d79ee173e1b171ed158b7a3c61056b41bc/numpy-2.5.4-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:4e263278bfb5ee6409db8aedbc4cc32973b1b82bc1e8d3c668551d04d83a7e37", size = 18480315, upload-time = "2026-10-10T20:03:55.39Z" }, + { url = "https://files.pythonhosted.org/packages/bb/1d/1486ef3d3fb2279fd93c4c43c1bbbf1ca389a19816696684409f71babaab/numpy-2.5.4-cp314-cp314-win32.whl", hash = "sha256:cfd73180400042a7c532d30c5e287bdd03c59ff9ee1b4c0316af0539e29dfe23", size = 6185739, upload-time = "2026-10-10T20:03:58.186Z" }, + { url = "https://files.pythonhosted.org/packages/52/9a/e1e512ebc948d5b9dd33b08736760f0ebbed2848fd4eda1f553088a6dcee/numpy-2.5.4-cp314-cp314-win_amd64.whl", hash = "sha256:2ca144f15135b6212a5c47b1e2aeca6e412f102f95a2d5d88d8aec77eb255de3", size = 12703552, upload-time = "2026-10-10T20:04:00.28Z" }, + { url = "https://files.pythonhosted.org/packages/2c/05/de709a982d7bbcd688a3fad71f002e9ff80c2db39e03ee726609b610f1d1/numpy-2.5.4-cp314-cp314-win_arm64.whl", hash = "sha256:468397ba3c64427474706e5c9123fe266395496714dc684294eac75cd4930d1e", size = 10803901, upload-time = "2026-10-10T20:04:02.659Z" }, + { url = "https://files.pythonhosted.org/packages/13/34/083570ada3bb2a30fbe5d77c8c6fef9141144a15d33e6f793a67e9749ab8/numpy-2.5.4-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:1ef3aa6d7e29bb13677323114280b05acc57607fa2300e66432d665d5418a162", size = 12138695, upload-time = "2026-10-10T20:04:05.012Z" }, + { url = "https://files.pythonhosted.org/packages/94/06/1f9c24db48eef0c2d1207e3b11fffb0478e39dfd8c1e1be7476936885eed/numpy-2.5.4-cp314-cp314t-macosx_14_0_arm64.whl", hash = "sha256:98b053943e5a0474ec0da309d2cb9d3f18ea57f8a2067c2ab7b5f763d1068380", size = 5574615, upload-time = "2026-10-10T20:04:07.316Z" }, + { url = "https://files.pythonhosted.org/packages/da/0f/593fba2e1560e949123bc7d2fc48b5893d56e58cd4bd5a273d2fbf60b220/numpy-2.5.4-cp314-cp314t-macosx_14_0_x86_64.whl", hash = "sha256:b64a85f40e154983960a4167d4c1d57a50c7f109b3d3264a3a984154e90a8454", size = 6889383, upload-time = "2026-10-10T20:04:09.918Z" }, + { url = "https://files.pythonhosted.org/packages/eb/9f/b799dfdce4e05e80ed4bc815c71ff343a11533b2c0ffc221cae8538cda63/numpy-2.5.4-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a813ed7719bf45463c51779e6a98d0385fe905e48447526938a4b8337333d551", size = 15753763, upload-time = "2026-10-10T20:04:12.278Z" }, + { url = "https://files.pythonhosted.org/packages/34/88/16c5f12f86f5ad2817c4d103205131fc6c8acb3d1878af05a1a4f23ec859/numpy-2.5.4-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c9b80cdf5cedba0e90d93fa5f9a333c4d65bd545cd669b71bb97ce2b703c9d73", size = 16757212, upload-time = "2026-10-10T20:04:14.799Z" }, + { url = "https://files.pythonhosted.org/packages/ff/4f/a1fe40e18a898e6a5089f4f0d891f0a493eb0574d5b34458f0fbe5aa3e5c/numpy-2.5.4-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:2199ed071f460487c8db2c0e5c0b564494190edb4772fe80f9aad88b2604def5", size = 17116471, upload-time = "2026-10-10T20:04:17.58Z" }, + { url = "https://files.pythonhosted.org/packages/aa/46/e923a11c78e65c1722e7aaad817c06bd591324174b9d28ce5d31eee4d432/numpy-2.5.4-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:64f9c9878c1938476365e11ccfb6b770f3b9e5f045ccddc514235041e6959365", size = 18524063, upload-time = "2026-10-10T20:04:20.365Z" }, + { url = "https://files.pythonhosted.org/packages/5a/fa/84ab064514440c1f64a1b21088f2c82756defdd05e07c75ab233899565b2/numpy-2.5.4-cp314-cp314t-win32.whl", hash = "sha256:64d1c8ac28a4077cf987e0a71a7a0ef7e2df70722f07f0baa42dbb7eb6938647", size = 6340926, upload-time = "2026-10-10T20:04:22.865Z" }, + { url = "https://files.pythonhosted.org/packages/7e/7e/6cd886876f435b10685db9b9f7eeb70356f99e052116f4e5f11c5792c714/numpy-2.5.4-cp314-cp314t-win_amd64.whl", hash = "sha256:067374eb538c34c745436365cf7b0112595c1d326f21ce4ff340f61230239fbb", size = 12901584, upload-time = "2026-10-10T20:04:24.99Z" }, + { url = "https://files.pythonhosted.org/packages/38/1b/3c1684f6a06f7307f2335fca6e486cb162847fb97e91d65f8eb5cabad213/numpy-2.5.4-cp314-cp314t-win_arm64.whl", hash = "sha256:e94aef2c639da4a960ad0db8e06471208d8589974953d78b61d345b4eb99e394", size = 10891152, upload-time = "2026-10-10T20:04:27.52Z" }, + { url = "https://files.pythonhosted.org/packages/08/f4/3224deff3af2bef6bc0b175369698d8cb348f3d91d9bb0286cd5c9eae9e0/numpy-2.5.4-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:8dddfbee2e68d26d0d7d7d9cb247b1fd4409241cce32d815a11d97ec2cfde179", size = 17003231, upload-time = "2026-10-10T20:04:30.021Z" }, + { url = "https://files.pythonhosted.org/packages/be/75/fee0b8c6d94b44b2fdfae74f6a4ad5a138739589a8aebaec28ce4e713ed5/numpy-2.5.4-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:81e3420b27048b65eb14c3acf0c174a8cb0e023277716110347d2dcb26026dad", size = 12018300, upload-time = "2026-10-10T20:04:32.519Z" }, + { url = "https://files.pythonhosted.org/packages/47/c0/d0b335a499a04b65f532c3f034346ef390f81299060f928492dabc1e0272/numpy-2.5.4-cp315-cp315-macosx_14_0_arm64.whl", hash = "sha256:0b4724a19de67bea8cfc4970798efa78bcbbe2ac2613cfac16721a42d44de2a5", size = 5454250, upload-time = "2026-10-10T20:04:34.943Z" }, + { url = "https://files.pythonhosted.org/packages/5a/0e/461b3783c03d668052e6a21b01b673db6ffcb7831fd32d9aa5368c1cd426/numpy-2.5.4-cp315-cp315-macosx_14_0_x86_64.whl", hash = "sha256:2132418bf8dd124a427ca9e6a1daf9ee1a87185344c95119ceae868b99466da1", size = 6789644, upload-time = "2026-10-10T20:04:37.258Z" }, + { url = "https://files.pythonhosted.org/packages/b3/02/5dad269b02166965a7b4ca14adaddd75dbee0de42435bfecf561b84ba5a6/numpy-2.5.4-cp315-cp315-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:325518d4245b9e331387702aa58c2ce1dc4cdcbb41dfb4ccd5dcbc7e08db1266", size = 15704353, upload-time = "2026-10-10T20:04:39.616Z" }, + { url = "https://files.pythonhosted.org/packages/93/3a/01360c8036822ed9f7aa32189a77d1476567ec1e8e1383522389e4faac45/numpy-2.5.4-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:56733449d2544178beaa4545cee357370440cf056c197f9c7bfb19dbfdd0e86d", size = 16718648, upload-time = "2026-10-10T20:04:42.383Z" }, + { url = "https://files.pythonhosted.org/packages/7d/5c/b863a2c093c4d6f21a597fcaf24ead0835c09ab16a8312d5a5a8868af683/numpy-2.5.4-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:5ec3753760c1a6d8bb91200666e545c3a9728e6269dfb5d6ce02340996698aa3", size = 17059053, upload-time = "2026-10-10T20:04:44.976Z" }, + { url = "https://files.pythonhosted.org/packages/0a/60/ced4f57f9a1258a0af74f17cb0b0c2700b5c67cd6678823c803b263e4df3/numpy-2.5.4-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:b1185012870173de7ae33d370bd45b1cf5baee747ea4b97036b65f4e93016877", size = 18477406, upload-time = "2026-10-10T20:04:47.863Z" }, + { url = "https://files.pythonhosted.org/packages/f9/bd/0ef22dafaafcc7d4bb3ca26b8d2afbd55dedad8eaba99a8c864e1997456f/numpy-2.5.4-cp315-cp315-win32.whl", hash = "sha256:298eca75243f2cbbfdb460560b9fb2a1792a33cf2ab4286efd43d92e8d3df508", size = 6185133, upload-time = "2026-10-10T20:04:50.467Z" }, + { url = "https://files.pythonhosted.org/packages/50/bc/d2651b155ecc608a77e6f4d15495c11f14f19bb98f8bf0c5b0d38f86dda1/numpy-2.5.4-cp315-cp315-win_amd64.whl", hash = "sha256:332f3378fe077dd850e677ec01bdcc4f22368fb5d50ef10b2c79230b1bf5a592", size = 12703085, upload-time = "2026-10-10T20:04:52.63Z" }, + { url = "https://files.pythonhosted.org/packages/dc/d2/45e404f8abb26fb9eda12b94012936873e827b1be76f2ee7890be128312e/numpy-2.5.4-cp315-cp315-win_arm64.whl", hash = "sha256:d4cccbbc78717966f764cd3af4fb70276fa01fc7a2688af11c78901fa5c04f05", size = 10801451, upload-time = "2026-10-10T20:04:55.677Z" }, + { url = "https://files.pythonhosted.org/packages/c6/c3/2ae14e09cfdb67dc187a342e15308a21c15bf4d2071f8079e6aee5fe56dc/numpy-2.5.4-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:950ea81d57ef070665581b6e1b5f6a029306423cd1739c5b95fe78aa30db6b9d", size = 17097121, upload-time = "2026-10-10T20:04:58.403Z" }, + { url = "https://files.pythonhosted.org/packages/f5/cf/305ae624ef8a039414317224abe9ec9c2fe7ea3c2e1cf204d43ff6b2ffb9/numpy-2.5.4-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:c05ede731b03fb1b7591faca9389ade3267d2bddf1ad8882bb3f2cc5e101694f", size = 12135439, upload-time = "2026-10-10T20:05:01.65Z" }, + { url = "https://files.pythonhosted.org/packages/a9/a8/f75c63813aef95827bb2c0d13b12803016853056e8792c280058cdbfe783/numpy-2.5.4-cp315-cp315t-macosx_14_0_arm64.whl", hash = "sha256:5fbf7141bbfd63aea22f435c9062a032b9ea0082fe9845dad7f021d3f1234e71", size = 5571451, upload-time = "2026-10-10T20:05:04.135Z" }, + { url = "https://files.pythonhosted.org/packages/6f/0f/f17763f983868b5c49b4101ebd7e00760bd1769478a6bb6a8de6e085bbac/numpy-2.5.4-cp315-cp315t-macosx_14_0_x86_64.whl", hash = "sha256:3573cd22564692a5b899ec344e5d5b9cc4576f2985b96f22af3564ed54f2710f", size = 6883356, upload-time = "2026-10-10T20:05:06.249Z" }, + { url = "https://files.pythonhosted.org/packages/67/a7/8af04c5a79e047996cfa38854dcfbececdd0343a7c933a46fdd03ef6f5da/numpy-2.5.4-cp315-cp315t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6c109eac9cd439193678f69d70733c1108487546ca8eafc107b510ae10c1aecd", size = 15750991, upload-time = "2026-10-10T20:05:08.376Z" }, + { url = "https://files.pythonhosted.org/packages/57/7a/648254290d0c504faa8f2d07aa206660c728802c781a6f3fc68ab7cb5d71/numpy-2.5.4-cp315-cp315t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:80d6ef6e8620eb2c2b4c4caad50b5935d6db3cde2d51581b55dcc79e14016d1d", size = 16757675, upload-time = "2026-10-10T20:05:11.393Z" }, + { url = "https://files.pythonhosted.org/packages/b8/fe/4a8c3cdb0c70400cfe4c5bec42d3099a5673802a95064614b33e07b82aa1/numpy-2.5.4-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:77045a4b175bbf5316ec08003880804336c78f92281a1b72222b274ea85ec5ac", size = 17113846, upload-time = "2026-10-10T20:05:14.49Z" }, + { url = "https://files.pythonhosted.org/packages/1b/7e/619692bb67778702c0e9eb2d468568a7573f4e269386ea61aed01ee4e557/numpy-2.5.4-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:0f02a46e49cfb6c73bdb7aea1c0d3461dbae9aba613542b65f657cd3d17b9fab", size = 18522915, upload-time = "2026-10-10T20:05:17.33Z" }, + { url = "https://files.pythonhosted.org/packages/b7/b5/4da41c328788f575838f97a098fe8ca691ebc6f6fd73ad4a262ee40b184d/numpy-2.5.4-cp315-cp315t-win32.whl", hash = "sha256:ad62a416ddcf863bf44bba76fbf6b53366ab0692e294f51cae4b5fbe0d246788", size = 6335804, upload-time = "2026-10-10T20:05:19.921Z" }, + { url = "https://files.pythonhosted.org/packages/98/94/6482ddfa3d312490cb9358f375bf2ad56427dbea8769187158e94d653753/numpy-2.5.4-cp315-cp315t-win_amd64.whl", hash = "sha256:38f47be9f74ab870d2633b5456ae519c43758a8d1fd05342f0ce4ecc034396ee", size = 12890095, upload-time = "2026-10-10T20:05:21.875Z" }, + { url = "https://files.pythonhosted.org/packages/48/7f/c2d1b436b6e7cfebac140c2579a298344b85f2991a2ce5c3615cefb29400/numpy-2.5.4-cp315-cp315t-win_arm64.whl", hash = "sha256:7a14a461d9340f1b46b8648578aed9cdb8b3b018a8fac6c1dde2c9192a01a87f", size = 10883718, upload-time = "2026-10-10T20:05:28.547Z" }, +] + +[[package]] +name = "packaging" +version = "26.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79", size = 313412, upload-time = "2026-08-04T18:15:28.737Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956, upload-time = "2026-08-04T18:15:27.159Z" }, +] + +[[package]] +name = "pandas" +version = "2.3.3" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version < '3.11'", +] +dependencies = [ + { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" } }, + { name = "python-dateutil" }, + { name = "pytz" }, + { name = "tzdata" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/33/01/d40b85317f86cf08d853a4f495195c73815fdf205eef3993821720274518/pandas-2.3.3.tar.gz", hash = "sha256:e05e1af93b977f7eafa636d043f9f94c7ee3ac81af99c13508215942e64c993b", size = 4495223, upload-time = "2025-09-29T23:34:51.853Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3d/f7/f425a00df4fcc22b292c6895c6831c0c8ae1d9fac1e024d16f98a9ce8749/pandas-2.3.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:376c6446ae31770764215a6c937f72d917f214b43560603cd60da6408f183b6c", size = 11555763, upload-time = "2025-09-29T23:16:53.287Z" }, + { url = "https://files.pythonhosted.org/packages/13/4f/66d99628ff8ce7857aca52fed8f0066ce209f96be2fede6cef9f84e8d04f/pandas-2.3.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e19d192383eab2f4ceb30b412b22ea30690c9e618f78870357ae1d682912015a", size = 10801217, upload-time = "2025-09-29T23:17:04.522Z" }, + { url = "https://files.pythonhosted.org/packages/1d/03/3fc4a529a7710f890a239cc496fc6d50ad4a0995657dccc1d64695adb9f4/pandas-2.3.3-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5caf26f64126b6c7aec964f74266f435afef1c1b13da3b0636c7518a1fa3e2b1", size = 12148791, upload-time = "2025-09-29T23:17:18.444Z" }, + { url = "https://files.pythonhosted.org/packages/40/a8/4dac1f8f8235e5d25b9955d02ff6f29396191d4e665d71122c3722ca83c5/pandas-2.3.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:dd7478f1463441ae4ca7308a70e90b33470fa593429f9d4c578dd00d1fa78838", size = 12769373, upload-time = "2025-09-29T23:17:35.846Z" }, + { url = "https://files.pythonhosted.org/packages/df/91/82cc5169b6b25440a7fc0ef3a694582418d875c8e3ebf796a6d6470aa578/pandas-2.3.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:4793891684806ae50d1288c9bae9330293ab4e083ccd1c5e383c34549c6e4250", size = 13200444, upload-time = "2025-09-29T23:17:49.341Z" }, + { url = "https://files.pythonhosted.org/packages/10/ae/89b3283800ab58f7af2952704078555fa60c807fff764395bb57ea0b0dbd/pandas-2.3.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:28083c648d9a99a5dd035ec125d42439c6c1c525098c58af0fc38dd1a7a1b3d4", size = 13858459, upload-time = "2025-09-29T23:18:03.722Z" }, + { url = "https://files.pythonhosted.org/packages/85/72/530900610650f54a35a19476eca5104f38555afccda1aa11a92ee14cb21d/pandas-2.3.3-cp310-cp310-win_amd64.whl", hash = "sha256:503cf027cf9940d2ceaa1a93cfb5f8c8c7e6e90720a2850378f0b3f3b1e06826", size = 11346086, upload-time = "2025-09-29T23:18:18.505Z" }, + { url = "https://files.pythonhosted.org/packages/c1/fa/7ac648108144a095b4fb6aa3de1954689f7af60a14cf25583f4960ecb878/pandas-2.3.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:602b8615ebcc4a0c1751e71840428ddebeb142ec02c786e8ad6b1ce3c8dec523", size = 11578790, upload-time = "2025-09-29T23:18:30.065Z" }, + { url = "https://files.pythonhosted.org/packages/9b/35/74442388c6cf008882d4d4bdfc4109be87e9b8b7ccd097ad1e7f006e2e95/pandas-2.3.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8fe25fc7b623b0ef6b5009149627e34d2a4657e880948ec3c840e9402e5c1b45", size = 10833831, upload-time = "2025-09-29T23:38:56.071Z" }, + { url = "https://files.pythonhosted.org/packages/fe/e4/de154cbfeee13383ad58d23017da99390b91d73f8c11856f2095e813201b/pandas-2.3.3-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b468d3dad6ff947df92dcb32ede5b7bd41a9b3cceef0a30ed925f6d01fb8fa66", size = 12199267, upload-time = "2025-09-29T23:18:41.627Z" }, + { url = "https://files.pythonhosted.org/packages/bf/c9/63f8d545568d9ab91476b1818b4741f521646cbdd151c6efebf40d6de6f7/pandas-2.3.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b98560e98cb334799c0b07ca7967ac361a47326e9b4e5a7dfb5ab2b1c9d35a1b", size = 12789281, upload-time = "2025-09-29T23:18:56.834Z" }, + { url = "https://files.pythonhosted.org/packages/f2/00/a5ac8c7a0e67fd1a6059e40aa08fa1c52cc00709077d2300e210c3ce0322/pandas-2.3.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1d37b5848ba49824e5c30bedb9c830ab9b7751fd049bc7914533e01c65f79791", size = 13240453, upload-time = "2025-09-29T23:19:09.247Z" }, + { url = "https://files.pythonhosted.org/packages/27/4d/5c23a5bc7bd209231618dd9e606ce076272c9bc4f12023a70e03a86b4067/pandas-2.3.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:db4301b2d1f926ae677a751eb2bd0e8c5f5319c9cb3f88b0becbbb0b07b34151", size = 13890361, upload-time = "2025-09-29T23:19:25.342Z" }, + { url = "https://files.pythonhosted.org/packages/8e/59/712db1d7040520de7a4965df15b774348980e6df45c129b8c64d0dbe74ef/pandas-2.3.3-cp311-cp311-win_amd64.whl", hash = "sha256:f086f6fe114e19d92014a1966f43a3e62285109afe874f067f5abbdcbb10e59c", size = 11348702, upload-time = "2025-09-29T23:19:38.296Z" }, + { url = "https://files.pythonhosted.org/packages/9c/fb/231d89e8637c808b997d172b18e9d4a4bc7bf31296196c260526055d1ea0/pandas-2.3.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:6d21f6d74eb1725c2efaa71a2bfc661a0689579b58e9c0ca58a739ff0b002b53", size = 11597846, upload-time = "2025-09-29T23:19:48.856Z" }, + { url = "https://files.pythonhosted.org/packages/5c/bd/bf8064d9cfa214294356c2d6702b716d3cf3bb24be59287a6a21e24cae6b/pandas-2.3.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:3fd2f887589c7aa868e02632612ba39acb0b8948faf5cc58f0850e165bd46f35", size = 10729618, upload-time = "2025-09-29T23:39:08.659Z" }, + { url = "https://files.pythonhosted.org/packages/57/56/cf2dbe1a3f5271370669475ead12ce77c61726ffd19a35546e31aa8edf4e/pandas-2.3.3-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ecaf1e12bdc03c86ad4a7ea848d66c685cb6851d807a26aa245ca3d2017a1908", size = 11737212, upload-time = "2025-09-29T23:19:59.765Z" }, + { url = "https://files.pythonhosted.org/packages/e5/63/cd7d615331b328e287d8233ba9fdf191a9c2d11b6af0c7a59cfcec23de68/pandas-2.3.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b3d11d2fda7eb164ef27ffc14b4fcab16a80e1ce67e9f57e19ec0afaf715ba89", size = 12362693, upload-time = "2025-09-29T23:20:14.098Z" }, + { url = "https://files.pythonhosted.org/packages/a6/de/8b1895b107277d52f2b42d3a6806e69cfef0d5cf1d0ba343470b9d8e0a04/pandas-2.3.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a68e15f780eddf2b07d242e17a04aa187a7ee12b40b930bfdd78070556550e98", size = 12771002, upload-time = "2025-09-29T23:20:26.76Z" }, + { url = "https://files.pythonhosted.org/packages/87/21/84072af3187a677c5893b170ba2c8fbe450a6ff911234916da889b698220/pandas-2.3.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:371a4ab48e950033bcf52b6527eccb564f52dc826c02afd9a1bc0ab731bba084", size = 13450971, upload-time = "2025-09-29T23:20:41.344Z" }, + { url = "https://files.pythonhosted.org/packages/86/41/585a168330ff063014880a80d744219dbf1dd7a1c706e75ab3425a987384/pandas-2.3.3-cp312-cp312-win_amd64.whl", hash = "sha256:a16dcec078a01eeef8ee61bf64074b4e524a2a3f4b3be9326420cabe59c4778b", size = 10992722, upload-time = "2025-09-29T23:20:54.139Z" }, + { url = "https://files.pythonhosted.org/packages/cd/4b/18b035ee18f97c1040d94debd8f2e737000ad70ccc8f5513f4eefad75f4b/pandas-2.3.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:56851a737e3470de7fa88e6131f41281ed440d29a9268dcbf0002da5ac366713", size = 11544671, upload-time = "2025-09-29T23:21:05.024Z" }, + { url = "https://files.pythonhosted.org/packages/31/94/72fac03573102779920099bcac1c3b05975c2cb5f01eac609faf34bed1ca/pandas-2.3.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:bdcd9d1167f4885211e401b3036c0c8d9e274eee67ea8d0758a256d60704cfe8", size = 10680807, upload-time = "2025-09-29T23:21:15.979Z" }, + { url = "https://files.pythonhosted.org/packages/16/87/9472cf4a487d848476865321de18cc8c920b8cab98453ab79dbbc98db63a/pandas-2.3.3-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e32e7cc9af0f1cc15548288a51a3b681cc2a219faa838e995f7dc53dbab1062d", size = 11709872, upload-time = "2025-09-29T23:21:27.165Z" }, + { url = "https://files.pythonhosted.org/packages/15/07/284f757f63f8a8d69ed4472bfd85122bd086e637bf4ed09de572d575a693/pandas-2.3.3-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:318d77e0e42a628c04dc56bcef4b40de67918f7041c2b061af1da41dcff670ac", size = 12306371, upload-time = "2025-09-29T23:21:40.532Z" }, + { url = "https://files.pythonhosted.org/packages/33/81/a3afc88fca4aa925804a27d2676d22dcd2031c2ebe08aabd0ae55b9ff282/pandas-2.3.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:4e0a175408804d566144e170d0476b15d78458795bb18f1304fb94160cabf40c", size = 12765333, upload-time = "2025-09-29T23:21:55.77Z" }, + { url = "https://files.pythonhosted.org/packages/8d/0f/b4d4ae743a83742f1153464cf1a8ecfafc3ac59722a0b5c8602310cb7158/pandas-2.3.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:93c2d9ab0fc11822b5eece72ec9587e172f63cff87c00b062f6e37448ced4493", size = 13418120, upload-time = "2025-09-29T23:22:10.109Z" }, + { url = "https://files.pythonhosted.org/packages/4f/c7/e54682c96a895d0c808453269e0b5928a07a127a15704fedb643e9b0a4c8/pandas-2.3.3-cp313-cp313-win_amd64.whl", hash = "sha256:f8bfc0e12dc78f777f323f55c58649591b2cd0c43534e8355c51d3fede5f4dee", size = 10993991, upload-time = "2025-09-29T23:25:04.889Z" }, + { url = "https://files.pythonhosted.org/packages/f9/ca/3f8d4f49740799189e1395812f3bf23b5e8fc7c190827d55a610da72ce55/pandas-2.3.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:75ea25f9529fdec2d2e93a42c523962261e567d250b0013b16210e1d40d7c2e5", size = 12048227, upload-time = "2025-09-29T23:22:24.343Z" }, + { url = "https://files.pythonhosted.org/packages/0e/5a/f43efec3e8c0cc92c4663ccad372dbdff72b60bdb56b2749f04aa1d07d7e/pandas-2.3.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:74ecdf1d301e812db96a465a525952f4dde225fdb6d8e5a521d47e1f42041e21", size = 11411056, upload-time = "2025-09-29T23:22:37.762Z" }, + { url = "https://files.pythonhosted.org/packages/46/b1/85331edfc591208c9d1a63a06baa67b21d332e63b7a591a5ba42a10bb507/pandas-2.3.3-cp313-cp313t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6435cb949cb34ec11cc9860246ccb2fdc9ecd742c12d3304989017d53f039a78", size = 11645189, upload-time = "2025-09-29T23:22:51.688Z" }, + { url = "https://files.pythonhosted.org/packages/44/23/78d645adc35d94d1ac4f2a3c4112ab6f5b8999f4898b8cdf01252f8df4a9/pandas-2.3.3-cp313-cp313t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:900f47d8f20860de523a1ac881c4c36d65efcb2eb850e6948140fa781736e110", size = 12121912, upload-time = "2025-09-29T23:23:05.042Z" }, + { url = "https://files.pythonhosted.org/packages/53/da/d10013df5e6aaef6b425aa0c32e1fc1f3e431e4bcabd420517dceadce354/pandas-2.3.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:a45c765238e2ed7d7c608fc5bc4a6f88b642f2f01e70c0c23d2224dd21829d86", size = 12712160, upload-time = "2025-09-29T23:23:28.57Z" }, + { url = "https://files.pythonhosted.org/packages/bd/17/e756653095a083d8a37cbd816cb87148debcfcd920129b25f99dd8d04271/pandas-2.3.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:c4fc4c21971a1a9f4bdb4c73978c7f7256caa3e62b323f70d6cb80db583350bc", size = 13199233, upload-time = "2025-09-29T23:24:24.876Z" }, + { url = "https://files.pythonhosted.org/packages/04/fd/74903979833db8390b73b3a8a7d30d146d710bd32703724dd9083950386f/pandas-2.3.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:ee15f284898e7b246df8087fc82b87b01686f98ee67d85a17b7ab44143a3a9a0", size = 11540635, upload-time = "2025-09-29T23:25:52.486Z" }, + { url = "https://files.pythonhosted.org/packages/21/00/266d6b357ad5e6d3ad55093a7e8efc7dd245f5a842b584db9f30b0f0a287/pandas-2.3.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1611aedd912e1ff81ff41c745822980c49ce4a7907537be8692c8dbc31924593", size = 10759079, upload-time = "2025-09-29T23:26:33.204Z" }, + { url = "https://files.pythonhosted.org/packages/ca/05/d01ef80a7a3a12b2f8bbf16daba1e17c98a2f039cbc8e2f77a2c5a63d382/pandas-2.3.3-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6d2cefc361461662ac48810cb14365a365ce864afe85ef1f447ff5a1e99ea81c", size = 11814049, upload-time = "2025-09-29T23:27:15.384Z" }, + { url = "https://files.pythonhosted.org/packages/15/b2/0e62f78c0c5ba7e3d2c5945a82456f4fac76c480940f805e0b97fcbc2f65/pandas-2.3.3-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ee67acbbf05014ea6c763beb097e03cd629961c8a632075eeb34247120abcb4b", size = 12332638, upload-time = "2025-09-29T23:27:51.625Z" }, + { url = "https://files.pythonhosted.org/packages/c5/33/dd70400631b62b9b29c3c93d2feee1d0964dc2bae2e5ad7a6c73a7f25325/pandas-2.3.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:c46467899aaa4da076d5abc11084634e2d197e9460643dd455ac3db5856b24d6", size = 12886834, upload-time = "2025-09-29T23:28:21.289Z" }, + { url = "https://files.pythonhosted.org/packages/d3/18/b5d48f55821228d0d2692b34fd5034bb185e854bdb592e9c640f6290e012/pandas-2.3.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:6253c72c6a1d990a410bc7de641d34053364ef8bcd3126f7e7450125887dffe3", size = 13409925, upload-time = "2025-09-29T23:28:58.261Z" }, + { url = "https://files.pythonhosted.org/packages/a6/3d/124ac75fcd0ecc09b8fdccb0246ef65e35b012030defb0e0eba2cbbbe948/pandas-2.3.3-cp314-cp314-win_amd64.whl", hash = "sha256:1b07204a219b3b7350abaae088f451860223a52cfb8a6c53358e7948735158e5", size = 11109071, upload-time = "2025-09-29T23:32:27.484Z" }, + { url = "https://files.pythonhosted.org/packages/89/9c/0e21c895c38a157e0faa1fb64587a9226d6dd46452cac4532d80c3c4a244/pandas-2.3.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:2462b1a365b6109d275250baaae7b760fd25c726aaca0054649286bcfbb3e8ec", size = 12048504, upload-time = "2025-09-29T23:29:31.47Z" }, + { url = "https://files.pythonhosted.org/packages/d7/82/b69a1c95df796858777b68fbe6a81d37443a33319761d7c652ce77797475/pandas-2.3.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:0242fe9a49aa8b4d78a4fa03acb397a58833ef6199e9aa40a95f027bb3a1b6e7", size = 11410702, upload-time = "2025-09-29T23:29:54.591Z" }, + { url = "https://files.pythonhosted.org/packages/f9/88/702bde3ba0a94b8c73a0181e05144b10f13f29ebfc2150c3a79062a8195d/pandas-2.3.3-cp314-cp314t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a21d830e78df0a515db2b3d2f5570610f5e6bd2e27749770e8bb7b524b89b450", size = 11634535, upload-time = "2025-09-29T23:30:21.003Z" }, + { url = "https://files.pythonhosted.org/packages/a4/1e/1bac1a839d12e6a82ec6cb40cda2edde64a2013a66963293696bbf31fbbb/pandas-2.3.3-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2e3ebdb170b5ef78f19bfb71b0dc5dc58775032361fa188e814959b74d726dd5", size = 12121582, upload-time = "2025-09-29T23:30:43.391Z" }, + { url = "https://files.pythonhosted.org/packages/44/91/483de934193e12a3b1d6ae7c8645d083ff88dec75f46e827562f1e4b4da6/pandas-2.3.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:d051c0e065b94b7a3cea50eb1ec32e912cd96dba41647eb24104b6c6c14c5788", size = 12699963, upload-time = "2025-09-29T23:31:10.009Z" }, + { url = "https://files.pythonhosted.org/packages/70/44/5191d2e4026f86a2a109053e194d3ba7a31a2d10a9c2348368c63ed4e85a/pandas-2.3.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:3869faf4bd07b3b66a9f462417d0ca3a9df29a9f6abd5d0d0dbab15dac7abe87", size = 13202175, upload-time = "2025-09-29T23:31:59.173Z" }, +] + +[[package]] +name = "pandas" +version = "3.0.6" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.15' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version >= '3.15' and sys_platform == 'emscripten'", + "python_full_version == '3.14.*' and sys_platform == 'emscripten'", + "python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.14.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'win32'", + "python_full_version == '3.11.*' and sys_platform == 'win32'", + "python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'emscripten'", + "python_full_version == '3.11.*' and sys_platform == 'emscripten'", + "python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.11.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", +] +dependencies = [ + { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" }, + { name = "numpy", version = "2.5.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, + { name = "python-dateutil" }, + { name = "tzdata", marker = "sys_platform == 'emscripten' or sys_platform == 'win32'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e2/17/d7b106e05bfa642e8694451e7d3d759c6a241c5386a5d962e4f66c047e06/pandas-3.0.6.tar.gz", hash = "sha256:66b07ef7315a31bfe1089cd3d71a7de781c9dca986762d0b4fe7c0ef17465d10", size = 4667686, upload-time = "2026-09-17T23:23:18.345Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7d/48/88e8d250d28efa8163294f6809a71683c7ee67f63ac7c33021c0503b3547/pandas-3.0.6-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:085e3786ae6b2e82b406266bce36690f72b9dc1421903ba9296b2981a9fcf586", size = 10391798, upload-time = "2026-09-17T23:20:20.96Z" }, + { url = "https://files.pythonhosted.org/packages/55/a6/39db5d41f3eb5d7846626312cb30e0cea48e988fc47a3725698bc931ad3c/pandas-3.0.6-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d7564d86a94c2eb8ab290b07f63ddaae5c032fa53897c29a2ff2197d43aee8af", size = 10023718, upload-time = "2026-09-17T23:20:25.094Z" }, + { url = "https://files.pythonhosted.org/packages/54/b7/707e966129f77ee8a39d41a41bbd989b790b3fef581c6e26b821315cba6b/pandas-3.0.6-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1e7c0afdcaf6661d795fcefc2f647ddd1136f62cdc153fba177c685d97a87808", size = 10612800, upload-time = "2026-09-17T23:20:27.99Z" }, + { url = "https://files.pythonhosted.org/packages/63/be/dfb6cc9329d0bbe76dadda8a1113d026bb996ec76c509221368dc68349f4/pandas-3.0.6-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:47121f9571503f724c9b93e297ab6254ac99c77adf5e9ed085ea419fd585c258", size = 11108900, upload-time = "2026-09-17T23:20:30.65Z" }, + { url = "https://files.pythonhosted.org/packages/1a/6f/3d58f15bbe972f3d7bfa13ee06d731785a76fe8d232c92b2655a8de14127/pandas-3.0.6-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:994a79608263fe1c14cc48ffa7300e2b834b7d1cb406ffe96a08828cb0cdd79b", size = 11630226, upload-time = "2026-09-17T23:20:33.582Z" }, + { url = "https://files.pythonhosted.org/packages/58/54/9b494de4a3dd92fc6eb19187db1b21afb50fdc21962f32ea1aca9f270cb2/pandas-3.0.6-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:a3a22e07fe75347eaacc75b0e85297947af4fba6b4aae23916bd8b6828d0bba3", size = 12146942, upload-time = "2026-09-17T23:20:36.792Z" }, + { url = "https://files.pythonhosted.org/packages/d3/dc/d2df02854aec5d47659acfb2be352eecc691845b2f86e99c84f1010a8671/pandas-3.0.6-cp311-cp311-win_amd64.whl", hash = "sha256:2e5fa32ff162dfdbc280157d664f44d23049ae414725af9676df339c501d82cd", size = 9859246, upload-time = "2026-09-17T23:20:43.976Z" }, + { url = "https://files.pythonhosted.org/packages/79/1e/2a30df0d7dede5c195300a1820b0bc21cea3aa24e4c8b6c4431565ecc79a/pandas-3.0.6-cp311-cp311-win_arm64.whl", hash = "sha256:5e75072773c1b2f7cb63faa3a6f562aede11f3976f68ed34cb538bc091a28171", size = 9106923, upload-time = "2026-09-17T23:20:46.611Z" }, + { url = "https://files.pythonhosted.org/packages/77/4c/597d588c055d4373cff19cbbc32d4dd046c7be8fadee957585b5ba9e5b24/pandas-3.0.6-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:7dac2d65e9087e8e7b5a45fe15c4920911a221df061ab629943ce016489145c7", size = 10397411, upload-time = "2026-09-17T23:20:49.465Z" }, + { url = "https://files.pythonhosted.org/packages/18/8f/48907c7c707b61a8e5018c32e1a3f70623209bfb59020a2f6196159d3aa7/pandas-3.0.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:9dab635a549e58a053c7b0fa054dc0bd7be22f0ed9a720f4a85d5fb993276172", size = 10051279, upload-time = "2026-09-17T23:20:52.409Z" }, + { url = "https://files.pythonhosted.org/packages/67/fa/613d867c3d9554a61bafdec6f79565c8a3e73235feb52cc4a72ad2e0fa6a/pandas-3.0.6-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e3dccb584123b399c07562ac4d62543e90ede49ddf8ce3c13ffc64cbe828c281", size = 10303429, upload-time = "2026-09-17T23:20:55.597Z" }, + { url = "https://files.pythonhosted.org/packages/cb/67/0c0f18e38d7f2d2af8c24b3315bc4046e73bbdd4a5540405506671ad0c0d/pandas-3.0.6-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0704044b676496b8350e023b09f174a26772456c974a2b11c36bebb558c9490d", size = 10788193, upload-time = "2026-09-17T23:20:58.617Z" }, + { url = "https://files.pythonhosted.org/packages/39/53/1b57f3162501fe36687e4870e1b918a6458ca7386b173af75663ace95857/pandas-3.0.6-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e7c1905ef02c3d6d43d9dbd5b6ccb4da4870a0b0c821bbc103fbdb6f3ad2707b", size = 11323501, upload-time = "2026-09-17T23:21:01.911Z" }, + { url = "https://files.pythonhosted.org/packages/f2/d2/b1182e8d39100369d7f13f4a125a3fb6b096fef112c46d0566c25781ff68/pandas-3.0.6-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:569e114072b24fc4970c12e2b4bab252671668a40b324318903380cab0254c0c", size = 11838173, upload-time = "2026-09-17T23:21:04.85Z" }, + { url = "https://files.pythonhosted.org/packages/c7/33/5b717af24d2f27995e51e0875a269dddd373045216e34cf62e3aa764eaa1/pandas-3.0.6-cp312-cp312-pyemscripten_2024_0_wasm32.whl", hash = "sha256:2a8fc94be2ee5f1d86f97aacd8cc566f81680b6498e76f3007421bb5d98151bf", size = 7118499, upload-time = "2026-09-17T23:21:07.661Z" }, + { url = "https://files.pythonhosted.org/packages/bd/2a/14b3b17cd75cef4a1ee1af4234eb41cc1afe4103b98c2d80e8916abfd42b/pandas-3.0.6-cp312-cp312-win_amd64.whl", hash = "sha256:3ef908d28590b3f42d7070e7ad8f9b34b442b260b7f3c1afb57e0040c58cdb1b", size = 9661439, upload-time = "2026-09-17T23:21:10.959Z" }, + { url = "https://files.pythonhosted.org/packages/3b/11/3d580a604a1e35d69f6676847bd12db7d14344bc677b717f4413e79c5d0d/pandas-3.0.6-cp312-cp312-win_arm64.whl", hash = "sha256:f4e7c52eb108d752e7592268108fd3e98efd76d83a3125cdd06c621c2e44359b", size = 8959806, upload-time = "2026-09-17T23:21:13.851Z" }, + { url = "https://files.pythonhosted.org/packages/8e/1c/143605a1f6443ad50ebda78a31e5a3a10147fec2590e931584aaa5ff0a09/pandas-3.0.6-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:9ae8073aed8e21d1a7fe263dcdc6840743549722a6738198a0a46000fa9476f2", size = 10418900, upload-time = "2026-09-17T23:21:16.594Z" }, + { url = "https://files.pythonhosted.org/packages/ea/ca/87f8548f73d452aab35e4a90f8b39ae303295e0f2ef0b4055c44d6b3f1be/pandas-3.0.6-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:60d81f9e1799b36f3739e7fff44d1fbb2e8fd5a271b3863e03de9715fccda0fa", size = 10064785, upload-time = "2026-09-17T23:21:19.677Z" }, + { url = "https://files.pythonhosted.org/packages/43/1a/d951442e5607c6e3b2462eff8f420797d428aa74b87c6ecfe4f48553626e/pandas-3.0.6-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:097090508a1dd335013d39106fc10b20f4fd4a171638e47b77d55798ed9dab6c", size = 10245290, upload-time = "2026-09-17T23:21:22.797Z" }, + { url = "https://files.pythonhosted.org/packages/50/fa/96d50e1e6cd0b08b5e2b7c838f65ae644940f75a124063380b5ef73b6866/pandas-3.0.6-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1e92d9fa834c7d877130027cddc0cad8dcff97c1f6cca26bd6310f847228b658", size = 10757657, upload-time = "2026-09-17T23:21:25.673Z" }, + { url = "https://files.pythonhosted.org/packages/7b/12/f82d13a2cb703e1a8acee7e01fdc2b898d9cd0c00f07d1dfce63af43e350/pandas-3.0.6-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:b27c8d890e4aa2171437ae2a39de1d215e674158e4865c4023a8b31c932513b2", size = 11249114, upload-time = "2026-09-17T23:21:28.898Z" }, + { url = "https://files.pythonhosted.org/packages/1a/ce/8aef2e561a2f2c8b38c913c67373c65ba6748174e763d27c80271b24bd17/pandas-3.0.6-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f8029ec0f1f89e4f985929ce1f6626dabf3140d61a4e9c1215afdab34eaf9a5d", size = 11820511, upload-time = "2026-09-17T23:21:32.11Z" }, + { url = "https://files.pythonhosted.org/packages/c0/bd/63cb67e6903ef6d9c2871916dbcbc09d254da0fe8b870cf62e16b21945f2/pandas-3.0.6-cp313-cp313-win_amd64.whl", hash = "sha256:f3ce8a6968045481e91a3990e797e348ce13db45ee164a7095bbc824e26c09dd", size = 9638092, upload-time = "2026-09-17T23:21:34.883Z" }, + { url = "https://files.pythonhosted.org/packages/75/2e/e7b35b712edb068d382ddc8b2bea8a04974100515ba2daa22b478b265842/pandas-3.0.6-cp313-cp313-win_arm64.whl", hash = "sha256:cc39303913e2ea129915670de5d1c9fbd647f543bb72e5543bac8baa94e9e42f", size = 8952032, upload-time = "2026-09-17T23:21:37.729Z" }, + { url = "https://files.pythonhosted.org/packages/75/55/1a8875395b05ccd572cbca0b9255dcd2db6e6508e632a558c1a6884b39ad/pandas-3.0.6-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:ee913a91669056c1de1a6b733fbfeab711de9e54e3bee2dfa5fe79d9457247d1", size = 10492213, upload-time = "2026-09-17T23:21:40.746Z" }, + { url = "https://files.pythonhosted.org/packages/35/61/47ae13476995cc8a40cd609e93e7cf11f273d8692925c2903cb6d38aa0d1/pandas-3.0.6-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:ff51a4459ed036e93d1eb1bb5e6e7b28685d3cb6b7c12b91c05b31024e234729", size = 10156618, upload-time = "2026-09-17T23:21:44.142Z" }, + { url = "https://files.pythonhosted.org/packages/bc/f2/cc5f2adb8d6e86a85d9fb5128f8cf205a61189336f70d1f7faf0d1b53ec9/pandas-3.0.6-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:654aae059295dbba6ecd2328ca12712a2cf1676214c8699f1c29213f7ccf9c34", size = 10375479, upload-time = "2026-09-17T23:21:47.159Z" }, + { url = "https://files.pythonhosted.org/packages/ca/ba/ffdcb19be4ff6bfe7d969e7cef2c567c633df5a3a1cc1053394ad053bca8/pandas-3.0.6-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:62f51d7f651c8054c5e82a69265c98082e795d1442df7ca6edc3a545d61214b1", size = 10783244, upload-time = "2026-09-17T23:21:50.367Z" }, + { url = "https://files.pythonhosted.org/packages/77/5b/e150075b2c6eb69fae896f2d9239bc6ed07db97735971d53d66de6553460/pandas-3.0.6-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:22172a92e7ee678ec0140c7af4fc9366b55413834a1cd86af78b3caa0b0574de", size = 11382223, upload-time = "2026-09-17T23:21:53.355Z" }, + { url = "https://files.pythonhosted.org/packages/d6/8a/b441c587dc7355bf6e1f68a91b4f76a6c29740f0c23be3acc5d4ebbeea6d/pandas-3.0.6-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:583be68728a31d0d750d5b8d9e00f02b153df0d4655f858bde93cb84cfc4227c", size = 11854881, upload-time = "2026-09-17T23:21:56.342Z" }, + { url = "https://files.pythonhosted.org/packages/b7/e9/f43410fada510b43fec09993c08f552086c3d247d3ee801a678f3cb10ea5/pandas-3.0.6-cp314-cp314-win_amd64.whl", hash = "sha256:77ccbe5057aece6fc172b9b77f19c04335af6882bc2e10c8f3ee4e6bfb3da553", size = 9791672, upload-time = "2026-09-17T23:21:59.332Z" }, + { url = "https://files.pythonhosted.org/packages/8b/9e/db14c059c21f9baa1907d436f8bf30e0c76c6288225c5e8b79a08ba8b2c5/pandas-3.0.6-cp314-cp314-win_arm64.whl", hash = "sha256:fb625f426b375bcc96e3a04c5d5d266cd7be6ae5d6866e0e703382ab5164068c", size = 9121246, upload-time = "2026-09-17T23:22:02.123Z" }, + { url = "https://files.pythonhosted.org/packages/67/ba/bad0f8dac020ab38a8637fddab01a57a82da7a496a6e6f19590aad53ab62/pandas-3.0.6-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:9e492cd4bdba6778de4fe0df7f4590c012161ebcf9902dce01b01dc683105514", size = 10920612, upload-time = "2026-09-17T23:22:05.404Z" }, + { url = "https://files.pythonhosted.org/packages/c4/a9/b500982e9aac6d52a58da4ad3f11e14168a315b06906b3f397c427878065/pandas-3.0.6-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:d7dcd21238cbb4828ff148481ba01cac8946dc5121457b5aeba28636f8f99a60", size = 10570213, upload-time = "2026-09-17T23:22:08.44Z" }, + { url = "https://files.pythonhosted.org/packages/4b/fa/e6ecd0073c98be8f840ac3125b955272835d7d9fd69f5944383b164deb5e/pandas-3.0.6-cp314-cp314t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6ff482fa91fa2bafd92e8fe66ce3645c851824310f295c1f0a2f96e928fc4541", size = 10252356, upload-time = "2026-09-17T23:22:11.302Z" }, + { url = "https://files.pythonhosted.org/packages/04/f5/001e230a7a7803590d9275a1a3f7e1bb605e3a495cfe5e8d3a532090621b/pandas-3.0.6-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:db7ec631f26223beee8e5c9e0b8f23c24d8197bbd1d982421d4e3188bea51965", size = 10655952, upload-time = "2026-09-17T23:22:14.283Z" }, + { url = "https://files.pythonhosted.org/packages/ca/ab/bab587148a3852c96aae26c4b5f9e04ce2221801ad94e166b4fbf969ede0/pandas-3.0.6-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:bd75ed0c840f709fc2ae26ddd9534ac77ca1a48ac0cce521a74acaa85f3340a7", size = 11274177, upload-time = "2026-09-17T23:22:17.352Z" }, + { url = "https://files.pythonhosted.org/packages/f3/32/74b48d87df2b80892d713c149abfe36d5db4de41b4eccb042a2bc07dafc1/pandas-3.0.6-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:ef738d71d1059245b6bb03e312be06d8b3821326a83486c1ad03b9aba3710e44", size = 11719041, upload-time = "2026-09-17T23:22:20.227Z" }, + { url = "https://files.pythonhosted.org/packages/f6/c6/d64b72d64d7eb0fad9fe424d34138e45dee70ddbea1360dcd0adf30e28f6/pandas-3.0.6-cp314-cp314t-win_amd64.whl", hash = "sha256:429d9df32731ab01383ed98f2baa7a60368090d1a94fc06019a12062510e8630", size = 10191388, upload-time = "2026-09-17T23:22:23.524Z" }, + { url = "https://files.pythonhosted.org/packages/7a/30/5e5b2ccabeca73ae2b03fc82bca3eabb7466cf43737f05ac08d591665d47/pandas-3.0.6-cp314-cp314t-win_arm64.whl", hash = "sha256:a4dbd4dc65cbe645b92b8785d0f96dd7311010dc6606cf620e51b07b8788a12a", size = 9387796, upload-time = "2026-09-17T23:22:26.64Z" }, + { url = "https://files.pythonhosted.org/packages/b6/77/47c5fb0be8bdd00116814c2c40d9ec42dbeb943865ef95130fe58a898226/pandas-3.0.6-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:50c44cbf5820b6b91a5f74aae04972472aefadd3cd9fbd1010409d85528bd570", size = 10483960, upload-time = "2026-09-17T23:22:30.071Z" }, + { url = "https://files.pythonhosted.org/packages/09/08/a310cb2fefe6d2b4623ab2150da818d93d4e73e33b58e4d163bb74243c5a/pandas-3.0.6-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:eb6900de08ac85f93ac4948aa6b80842eba555875337b8359035ac9c43e92d34", size = 10149432, upload-time = "2026-09-17T23:22:32.818Z" }, + { url = "https://files.pythonhosted.org/packages/54/36/6af478ec3a26d7754555cd62c3101c589c0931b1d85398e4fa5403910a1c/pandas-3.0.6-cp315-cp315-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4e25e2e1adee99ddfada6f7206a79ae8e9c8a8861b0e3eaaba165006d3eef18e", size = 10360981, upload-time = "2026-09-17T23:22:35.621Z" }, + { url = "https://files.pythonhosted.org/packages/43/20/5ece0e9cb79a6473216620db6a90546f578001c2bd857b77c444b27acad1/pandas-3.0.6-cp315-cp315-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4ff44b2cb51cbd691c91f92c4ea6c71e34003f239ebd67c2e857dc898466b49c", size = 10776585, upload-time = "2026-09-17T23:22:38.427Z" }, + { url = "https://files.pythonhosted.org/packages/2f/b6/cd3038f31ade5e8d2b4e1c9549d4b31e4d598469562f47142b2ad9171c0a/pandas-3.0.6-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:5edd0a7abb0986ecce1ac81f56d99b6763f86aa6946dceb6c661224f90af5a19", size = 11385249, upload-time = "2026-09-17T23:22:41.18Z" }, + { url = "https://files.pythonhosted.org/packages/0a/87/05bb3003737f80375d7311774916a24d161e2e591abe8c672aed7813defc/pandas-3.0.6-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:1bcb3e9ed29e74a7439cedff9e2aefd3ea65de84d7de9ccb6c194192541bd60e", size = 11848595, upload-time = "2026-09-17T23:22:44.207Z" }, + { url = "https://files.pythonhosted.org/packages/c0/30/1c0d46acf236d19ef975e9cdd5d1e0dd54924b03f0ed8287096ad4a18152/pandas-3.0.6-cp315-cp315-win_amd64.whl", hash = "sha256:253e12cb9081b0afbac607920f6142975966bc315135e09de275fdbaa415d2de", size = 9783810, upload-time = "2026-09-17T23:22:47.097Z" }, + { url = "https://files.pythonhosted.org/packages/87/03/df3304a9c2833c4810e7f1c887b04105b24731f9deef8b5d5d04522a375b/pandas-3.0.6-cp315-cp315-win_arm64.whl", hash = "sha256:97274c9adf6255bb48c620cd6959805efa7f09ea2167f0e0ae006a448cd2fca7", size = 9116820, upload-time = "2026-09-17T23:22:50.149Z" }, + { url = "https://files.pythonhosted.org/packages/47/25/d5f6cce5efa17c38e4f752a875b4a26d66cfadd529cb8c81672f0376d6a6/pandas-3.0.6-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:265f562fdd1079f69f3de96dd425c3405224038c0af4f920c54bd240ee2c4640", size = 10894614, upload-time = "2026-09-17T23:22:53.223Z" }, + { url = "https://files.pythonhosted.org/packages/ea/8b/e1876bfdc1df06bafc022d33202b5663bd86c81df2a6140aacafd0344669/pandas-3.0.6-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:c6e4aae3e9bea26c6c9a20d88d96c86ec4a99b4db5fd516bcb4e829ab2c0ee36", size = 10546973, upload-time = "2026-09-17T23:22:56.155Z" }, + { url = "https://files.pythonhosted.org/packages/e9/27/e0a27a5a5c27f7db66657b44def9e93121fd0ad4f0808355b9898fcbf204/pandas-3.0.6-cp315-cp315t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a77a1a44e4d88f1c6a2a64d3eb12efec8420875722e14279800b173a7c7c2804", size = 10239717, upload-time = "2026-09-17T23:22:59.603Z" }, + { url = "https://files.pythonhosted.org/packages/d5/4f/4eadb7d86a921c1e8bc70916cfe601ed667c4169118d17d69958611c21f8/pandas-3.0.6-cp315-cp315t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:86fa853a12e0b70927e2b1ee00d56d2224ec9cbb4b9d58348b5ad52d2f21150e", size = 10641275, upload-time = "2026-09-17T23:23:02.81Z" }, + { url = "https://files.pythonhosted.org/packages/c7/d1/eba72e9d905e84e79aefeefdcc6bc1abe15d9077973566643f4211636966/pandas-3.0.6-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:c826e9babb7790142c399f58599d8de679bea059d7b39c5b6efa2096fac37266", size = 11262919, upload-time = "2026-09-17T23:23:06.038Z" }, + { url = "https://files.pythonhosted.org/packages/9d/8a/1c5bd2642b450e374b6191189f47c49538fe41f82348a66de6f647e6ab59/pandas-3.0.6-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:8fe77b408d82e2615674dfed62533b95e18a03610573877422aada4f625d4947", size = 11709148, upload-time = "2026-09-17T23:23:09.082Z" }, + { url = "https://files.pythonhosted.org/packages/73/3d/1b142bd0d0f1326a5d98c91c955b923cd1e06b5eecb428cd9d8817fa01c0/pandas-3.0.6-cp315-cp315t-win_amd64.whl", hash = "sha256:83e91d15738d7783c050197cef2f2cf82fc6353dae9865aa87ed1fa16aa4d55a", size = 10161518, upload-time = "2026-09-17T23:23:12.365Z" }, + { url = "https://files.pythonhosted.org/packages/0b/a3/6419c14da2adc1f09a6a183b8f91d7494d325b287f4ca984ac04f663638a/pandas-3.0.6-cp315-cp315t-win_arm64.whl", hash = "sha256:963ca21199097a84c7827c4678b04e30833084fbf8ef44fde3fa7180a29f8fa0", size = 9364529, upload-time = "2026-09-17T23:23:15.274Z" }, +] + +[[package]] +name = "pathspec" +version = "1.1.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5a/82/42f767fc1c1143d6fd36efb827202a2d997a375e160a71eb2888a925aac1/pathspec-1.1.1.tar.gz", hash = "sha256:17db5ecd524104a120e173814c90367a96a98d07c45b2e10c2f3919fff91bf5a", size = 135180, upload-time = "2026-04-27T01:46:08.907Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f1/d9/7fb5aa316bc299258e68c73ba3bddbc499654a07f151cba08f6153988714/pathspec-1.1.1-py3-none-any.whl", hash = "sha256:a00ce642f577bf7f473932318056212bc4f8bfdf53128c78bbd5af0b9b20b189", size = 57328, upload-time = "2026-04-27T01:46:07.06Z" }, +] + +[[package]] +name = "pluggy" +version = "1.7.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/bf/db/7fc19e6f2dc92a966727031389fc2e08b558f0f25eb7403c1119ad4713cd/pluggy-1.7.0.tar.gz", hash = "sha256:d1eaa46ebb595891b860ab086b4d09c8588af65ebd4361b8e8f4bb8920b90ba8", size = 123304, upload-time = "2026-10-15T09:50:58.343Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/40/9e/2b38731e0fc536806f16490e1a12d7f0dc2a1235aa8cc07bcc75416a7daa/pluggy-1.7.0-py3-none-any.whl", hash = "sha256:7dd7b0d8832ba3cb632c306926ded123429211b83641b35dc5c41ad2d34f9bec", size = 27082, upload-time = "2026-10-15T09:50:56.808Z" }, +] + +[[package]] +name = "psrunner" +source = { editable = "." } + +[package.optional-dependencies] +pandas = [ + { name = "pandas", version = "2.3.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "pandas", version = "3.0.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, +] + +[package.dev-dependencies] +dev = [ + { name = "mypy" }, + { name = "pandas", version = "2.3.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "pandas", version = "3.0.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, + { name = "pytest" }, + { name = "ruff" }, +] + +[package.metadata] +requires-dist = [{ name = "pandas", marker = "extra == 'pandas'", specifier = ">=2.0" }] +provides-extras = ["pandas"] + +[package.metadata.requires-dev] +dev = [ + { name = "mypy", specifier = ">=1.13" }, + { name = "pandas", specifier = ">=2.0" }, + { name = "pytest", specifier = ">=8.3" }, + { name = "ruff", specifier = ">=0.8" }, +] + +[[package]] +name = "pygments" +version = "2.21.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/49/2e/ced460408999b33da6b31b0021b0f37d329e202d4169aeb164493778f25b/pygments-2.21.0.tar.gz", hash = "sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c", size = 5005329, upload-time = "2026-08-17T08:02:48.824Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/71/46/17f022dd3e953bf20a04a028a21ec746d942f8d2af30fa0f124fa0e6a684/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9", size = 1250147, upload-time = "2026-08-17T08:02:44.912Z" }, +] + +[[package]] +name = "pytest" +version = "9.1.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "exceptiongroup", marker = "python_full_version < '3.11'" }, + { name = "iniconfig" }, + { name = "packaging" }, + { name = "pluggy" }, + { name = "pygments" }, + { name = "tomli", marker = "python_full_version < '3.11'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e4/47/b9efed96c114afcfa3c9d3fe98a76a1d14c74a9e266d397cf6eb64be5e01/pytest-9.1.1.tar.gz", hash = "sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313", size = 1636369, upload-time = "2026-06-19T10:58:32.857Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/24/25/1de2678b631f5a49215c6c96fff41ba892b0a34df68d6d80292b1b48aa7f/pytest-9.1.1-py3-none-any.whl", hash = "sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c", size = 386536, upload-time = "2026-06-19T10:58:31.347Z" }, +] + +[[package]] +name = "python-dateutil" +version = "2.9.0.post0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "six" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/66/c0/0c8b6ad9f17a802ee498c46e004a0eb49bc148f2fd230864601a86dcf6db/python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3", size = 342432, upload-time = "2024-03-01T18:36:20.211Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427", size = 229892, upload-time = "2024-03-01T18:36:18.57Z" }, +] + +[[package]] +name = "pytz" +version = "2026.5" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/14/21/d83d6ef28c4c912c4bb4d1dcf591f7b8c6bde87b9c66f9f454677314e16d/pytz-2026.5.tar.gz", hash = "sha256:fa23724b9c486543b9ff54a327ee7569ac83ade54bb9afd0fc18676620401c86", size = 318572, upload-time = "2026-10-04T02:37:58.719Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4f/ef/c66110d46fb800dda0bf33164182dfadabe26a90e4476844d502a23dca8e/pytz-2026.5-py2.py3-none-any.whl", hash = "sha256:e658af3757f9e26a9d25dd2aff38335acd92bc9104f890a894b2c1ba28311b03", size = 506342, upload-time = "2026-10-04T02:37:56.814Z" }, +] + +[[package]] +name = "ruff" +version = "0.17.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f9/e7/e6d5749983b020e6cb1055abec0a6f361a8e94f0184cdcf56d4760995f02/ruff-0.17.1.tar.gz", hash = "sha256:5bb796c5112e9fb9527f2ef2faa0a130d6312d19de92bcfaddd70dbb2d41020f", size = 5323349, upload-time = "2026-10-15T15:23:18.64Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2e/78/90c46ca6250709f7c37e397b60d06061adee8d0f7d13959ed6a8e49b14fd/ruff-0.17.1-py3-none-linux_armv6l.whl", hash = "sha256:1796c41eafec66f4635125dd1e074a7aa27b8d20c187d484360acf11d247fc4a", size = 10147528, upload-time = "2026-10-15T15:22:33.667Z" }, + { url = "https://files.pythonhosted.org/packages/aa/d2/a2e28bc35b083ae51fa07dfba5280a667c8b01ecaee7802fc8849dcd5c46/ruff-0.17.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:8eadb09a788010be29c895418bdfa513e4e1c65e64b94e5b19e4cd381f6cc7fb", size = 10225974, upload-time = "2026-10-15T15:22:36.328Z" }, + { url = "https://files.pythonhosted.org/packages/8e/71/7a9029a81c8206ee01a98f6cfeeb56e6c095af86857581a37045c46d7e94/ruff-0.17.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:29b454f18ca3eeaf37fbf140841dcf27d36109e29dee9aae8acecb68c26c6f74", size = 9270361, upload-time = "2026-10-15T15:22:38.651Z" }, + { url = "https://files.pythonhosted.org/packages/c0/8c/e075e9c917cb0575297880c96768304e881240171c870cbd8d9b7b54bec2/ruff-0.17.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:872e03dd231744d6c5ec5c8af6be52b71323fc6ee096e4c8b34d9f844ee3b978", size = 9938300, upload-time = "2026-10-15T15:22:41.284Z" }, + { url = "https://files.pythonhosted.org/packages/87/27/0b4bb926a49de2383f161272b4d863571a4c7ecdbf595a6bc58813a13367/ruff-0.17.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4c0d6cb5f8fbac77eec9af49f4fc0eaf856b05545e372b0694d24b4e76b1c640", size = 9948464, upload-time = "2026-10-15T15:22:43.681Z" }, + { url = "https://files.pythonhosted.org/packages/14/27/518d57e0e02aecb8ea4acac6b57b51a53173d25fa734952bfdd7d531e88e/ruff-0.17.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:78beced4a3c94dfedbee4b999b95b6a27b35820fdc0afbacc6d37a8da26c1cd1", size = 10638639, upload-time = "2026-10-15T15:22:46.081Z" }, + { url = "https://files.pythonhosted.org/packages/01/82/d89a4e498ade59e6cee52d67f8da569019372212b87468c1fdeae884601c/ruff-0.17.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7feefc63921202894f0e158b0e32f45a5950d70a7fb693ccb9264816c25b1c05", size = 11337238, upload-time = "2026-10-15T15:22:48.894Z" }, + { url = "https://files.pythonhosted.org/packages/a2/7c/3b0fdef9352656317c977086fe1d802902406e4f2a0d8578da90c0e6d1c5/ruff-0.17.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:684154861a819bf1f433669d2a0ce9c3e54677c65b8ebb866cc2a7ec86345785", size = 10896327, upload-time = "2026-10-15T15:22:51.45Z" }, + { url = "https://files.pythonhosted.org/packages/62/86/5566290219708ce2928f3a29c4f843a1185b341ec6111c4631a33c5ceced/ruff-0.17.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a6ef98e51de8ef38082f90653ceeb84944bd7673783eea13e1647c5b9b064189", size = 10350811, upload-time = "2026-10-15T15:22:54.401Z" }, + { url = "https://files.pythonhosted.org/packages/ad/d2/ca8462dabb3c413990d49703ba306c30c862195a75448d080fa8fcce9775/ruff-0.17.1-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:8f9aa5b5bd5fa1937803ea609c8f153b8de39bf3e0e149897ae34b0c5b52f467", size = 10569994, upload-time = "2026-10-15T15:22:57.142Z" }, + { url = "https://files.pythonhosted.org/packages/e3/ad/dd1864c1f1db17c8cfb297ce70b352388e6977620f66f7182c52855407df/ruff-0.17.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:80e53b0e5faa3c5667f035daaa032893ae42b7cfe708c886d39ed131e54688ab", size = 10059672, upload-time = "2026-10-15T15:23:00.084Z" }, + { url = "https://files.pythonhosted.org/packages/65/45/3f56cf1d2168c2165cdd5ac6f9668aee66a4cfdd4caf2b2cc5ccb2b1d568/ruff-0.17.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:056c5d5fa0ac790051ae165d7035c7bf956d02de2db557f2e9b31d877a505fca", size = 9947803, upload-time = "2026-10-15T15:23:03.132Z" }, + { url = "https://files.pythonhosted.org/packages/aa/4b/5457cb2be4c1d1ea5e919558131a0f197a4a454a0530d9e30820e8206e4c/ruff-0.17.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:bd8f5a55b10f371642eacd0e8665a42a8b97da15c9a7187c79e697b77b5e0ce4", size = 10351807, upload-time = "2026-10-15T15:23:05.628Z" }, + { url = "https://files.pythonhosted.org/packages/49/fb/db15b4f8fa24a1e36b99e1401f42ef6df16ee299a48670d5d262b771e7d7/ruff-0.17.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:ce05e6f3973611d9550a600e04bb531061e368baba31610eb57c1509a8f21a0a", size = 10765716, upload-time = "2026-10-15T15:23:08.092Z" }, + { url = "https://files.pythonhosted.org/packages/0a/e8/1e186578076aff7a80735f625005fde678412ab609cd323ed182eb7d6b87/ruff-0.17.1-py3-none-win32.whl", hash = "sha256:1de0030a8aa78c65c5fecb84b2e5c390ac684c0452875a02afc7c083d49a496a", size = 9895093, upload-time = "2026-10-15T15:23:10.582Z" }, + { url = "https://files.pythonhosted.org/packages/6a/2e/da3d9589bae8e8b58f3a48bd5bc0b980232fb14a83bf02c3be7660f87c1b/ruff-0.17.1-py3-none-win_amd64.whl", hash = "sha256:5df76f16580fab58d0f6c98a3ac254a4abceb7b2489b8b678335869cff77b3d7", size = 10097955, upload-time = "2026-10-15T15:23:13.309Z" }, + { url = "https://files.pythonhosted.org/packages/df/c9/0f2a4dea06a5e12c1191ee3d96b1e1233797d0d5e18f97a2b909a95a9836/ruff-0.17.1-py3-none-win_arm64.whl", hash = "sha256:42400b9a6ff8515ff27796f07f92e0195be011c86e81e381606f58ea5502fef4", size = 9853542, upload-time = "2026-10-15T15:23:16.05Z" }, +] + +[[package]] +name = "six" +version = "1.17.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/94/e7/b2c673351809dca68a0e064b6af791aa332cf192da575fd474ed7d6f16a2/six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81", size = 34031, upload-time = "2024-12-04T17:35:28.174Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", size = 11050, upload-time = "2024-12-04T17:35:26.475Z" }, +] + +[[package]] +name = "tomli" +version = "2.5.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/b0/78/9ad63712633ed3ab5cc1a648d863d7e7da371e9425e209555a0fe711b695/tomli-2.5.0.tar.gz", hash = "sha256:264507556cd8b8c8e7c6ee037cdf443a463f03f4c958e57195e3d369711b8ff6", size = 17662, upload-time = "2026-10-07T12:23:37.892Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/22/a6/ab99b60ee52acd949684febabc3005d0045d0f66bebd9cdebd67372d26dd/tomli-2.5.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c4dc1c1781f2f716de763d1e9a7b34c6a894e167e291c7c5d16c72f7a9538545", size = 163901, upload-time = "2026-10-07T12:22:15.601Z" }, + { url = "https://files.pythonhosted.org/packages/bc/00/ee01b7ed4579180fff07142d290257f25ba786f23f3ec6005f620933c2f5/tomli-2.5.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:eff8babca5a7999bc137acbc7482a8b7e17ffca5075ab41f5d770ab408c7bfef", size = 163756, upload-time = "2026-10-07T12:22:16.957Z" }, + { url = "https://files.pythonhosted.org/packages/72/c2/4efebf65372f6583185f79799312109dddb61102d47e5c33dcfd1a297aca/tomli-2.5.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:86665cee9c4835b7a7f1e8ec2c719b5258d4dc782887aded5a8ae7352a96843b", size = 268038, upload-time = "2026-10-07T12:22:18.135Z" }, + { url = "https://files.pythonhosted.org/packages/53/07/5850468e925d898abb36038666f9c333a94d2a223e802a8ba5b6d319d23f/tomli-2.5.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d7e369fd63331746182360977b1892bfc215476a30d61612d732425311639f56", size = 276422, upload-time = "2026-10-07T12:22:19.567Z" }, + { url = "https://files.pythonhosted.org/packages/b4/87/f293984cdcf83c054196d4fd3dad44fc68ae55b4b8c44bc76cef360c3150/tomli-2.5.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:7ad1ea345759240d6463efa0ed1c704402752e49aa21476620738d74d72d8aa1", size = 272616, upload-time = "2026-10-07T12:22:20.794Z" }, + { url = "https://files.pythonhosted.org/packages/ce/ce/db582886b3c1219d3fec93ebd669332482e5aee7a91e0f7838d84f2d1759/tomli-2.5.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:96243987194634bd411066ce40c952e108f86af04db533ecd8ac3ff2a85b1885", size = 276593, upload-time = "2026-10-07T12:22:22.12Z" }, + { url = "https://files.pythonhosted.org/packages/bf/72/7619b87dea4261fc27dd7b54c4461c129c1f7d9bb7ba3aec89c797a431b8/tomli-2.5.0-cp311-cp311-win32.whl", hash = "sha256:610b27d99f28ec5f191c7064a48f3ddb179a1fe6ca73d571483ae859f57b605e", size = 101830, upload-time = "2026-10-07T12:22:23.651Z" }, + { url = "https://files.pythonhosted.org/packages/1e/74/220106da34502304b6751a2a9b8a9fbca6c3fd47e737a2e2e3da7c61c9db/tomli-2.5.0-cp311-cp311-win_amd64.whl", hash = "sha256:c804ae44fe7b4bab5da295e4f980a1ff04670bca9d23fe0a4e887e08ebd741a8", size = 112742, upload-time = "2026-10-07T12:22:24.972Z" }, + { url = "https://files.pythonhosted.org/packages/27/99/7d9c8b41837a7773613e169504147375c157a290167aa59ad74a085f521f/tomli-2.5.0-cp311-cp311-win_arm64.whl", hash = "sha256:cfac177ebd6236003846ea339981f71457cb6eb748f23381eb257e45092e3980", size = 109332, upload-time = "2026-10-07T12:22:26.117Z" }, + { url = "https://files.pythonhosted.org/packages/52/ed/7baa86f87493646a594de388c7c1c40a39dd0461f7e9c0359cbeefc91fe8/tomli-2.5.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:1f4a40d03fb9f63424f0979855bdeaf44dd7696b8d59501822c10ed30ba532df", size = 164854, upload-time = "2026-10-07T12:22:27.444Z" }, + { url = "https://files.pythonhosted.org/packages/a5/b1/44c0341f2224397855723c7a8a39f718ea6fcbcc3dacc66e5aeca0f334e3/tomli-2.5.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:9ebf8d19b17bd0daeb7b7dec81a946a439b753942fd0210d6e96c532249eea6b", size = 164074, upload-time = "2026-10-07T12:22:28.679Z" }, + { url = "https://files.pythonhosted.org/packages/23/04/e2d5b7d3fba47adedb23de616c16d428ea076c79a3d8e1d95d649ffe197e/tomli-2.5.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bf0b5e8e0f68ebb494356e577c06c139161efd8d3b9050f93b39b7c26cc54ff0", size = 274274, upload-time = "2026-10-07T12:22:29.804Z" }, + { url = "https://files.pythonhosted.org/packages/43/90/6090e706ff27a6f89f4a40578e3324b95c3cd8c4150868aabf33a8f414c3/tomli-2.5.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6cf74416bdc94ae458b14e37286c1073081850ac8459a00d0c5efef5d44294c6", size = 286435, upload-time = "2026-10-07T12:22:31.297Z" }, + { url = "https://files.pythonhosted.org/packages/0a/9e/a2c40768df16c408f22430afb0a73e9d7e5f79c950884954649d1146b74d/tomli-2.5.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:61ea1ebe1e55a34ea8199cc8dbff398d35027b82271c8ac4802fd3a1fd5b1bcc", size = 278119, upload-time = "2026-10-07T12:22:32.601Z" }, + { url = "https://files.pythonhosted.org/packages/12/25/3c0cb485b98e9cfac495629b1c93c87ccf0b72fbe9d2689fd8fe62c6d5a3/tomli-2.5.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ed53f7e89bb04f6d9e8e7799112360b0c4d5cbff067de0814c98c37c39b920f7", size = 286177, upload-time = "2026-10-07T12:22:33.745Z" }, + { url = "https://files.pythonhosted.org/packages/77/8b/0144c65f0e37e51c18d04ae15c21b19431c165002d0131fe9aa8b0b8b1e8/tomli-2.5.0-cp312-cp312-win32.whl", hash = "sha256:e7ad033e27a516a233bea839cdb77b80146facb3b4f40bf02cd0cac165cdd5c2", size = 102760, upload-time = "2026-10-07T12:22:34.887Z" }, + { url = "https://files.pythonhosted.org/packages/de/32/5d6d8f42fc9a05fce69354e00ff256484192f5f2fc9a2165718fa0de61ec/tomli-2.5.0-cp312-cp312-win_amd64.whl", hash = "sha256:bd05de8c1698f8413dd7d869492693a0bf2211543b787ac78cd5e7536af1a6d7", size = 112722, upload-time = "2026-10-07T12:22:36.162Z" }, + { url = "https://files.pythonhosted.org/packages/30/65/df18032218db0fb9b769fb23c8039a051f15c811993995ea04c350273a32/tomli-2.5.0-cp312-cp312-win_arm64.whl", hash = "sha256:069435bd5480429b98c5e5afb02ab21c219b6f0064680671c6dc0d46817346ea", size = 109534, upload-time = "2026-10-07T12:22:37.296Z" }, + { url = "https://files.pythonhosted.org/packages/42/e5/51736d70da209350969e15aca5c5ab6e2ce1ea87a0a892a6c13aec172a86/tomli-2.5.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:943276cf269e0071948d9ff697159c1735e623c1151d88abb09b74659ef0cbea", size = 163328, upload-time = "2026-10-07T12:22:38.373Z" }, + { url = "https://files.pythonhosted.org/packages/ec/55/086f80dab4ab497602644274e6dea7ec5dd0b4e262e443a8ad3bb7edee2d/tomli-2.5.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:463b16086865b97facd8d0b3fb4cb7c544e3f58d2a69dc3113d6db9653fdb043", size = 162246, upload-time = "2026-10-07T12:22:39.673Z" }, + { url = "https://files.pythonhosted.org/packages/aa/eb/3ecc94459f3635c92321f4e7bde571323fdb2267c50e19e3188a281eae3b/tomli-2.5.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1245a6638fc4bb0a60af38a7d45413db34a13842027c77597c712c998c62fdf0", size = 272655, upload-time = "2026-10-07T12:22:41.08Z" }, + { url = "https://files.pythonhosted.org/packages/c0/d7/494fd1f0c37a621f1ad9975c2efadb523e8101f144ed6edb2e7fe64738f2/tomli-2.5.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5d8bac3d603c97e6854424e5b2b5b741bdbde387e09f162fb0446812b4a8362b", size = 283595, upload-time = "2026-10-07T12:22:42.222Z" }, + { url = "https://files.pythonhosted.org/packages/70/51/bb8d62b1317e6640866f6949b2d5855e5300f2c99d46de1cd245570bba65/tomli-2.5.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:21e4cae4114aba25aa0d4f85cdf486d290fb35c0954d7bba536248da64d43066", size = 276253, upload-time = "2026-10-07T12:22:43.625Z" }, + { url = "https://files.pythonhosted.org/packages/66/f4/f46bd7f0763cd47de2db697dca9257c6a4adfd1a93b018cc75c8190ed5a8/tomli-2.5.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:bbaefc84548d754be821bba7c4141c4787dda182f9e77f2f87b71213529efa7b", size = 283582, upload-time = "2026-10-07T12:22:44.983Z" }, + { url = "https://files.pythonhosted.org/packages/ac/03/70f2bcb2923a6db37818d917e124270a7f4cfd38ea576f5aa753a91c0ef5/tomli-2.5.0-cp313-cp313-win32.whl", hash = "sha256:abdbf6313b8d9efe157edeb7ab6eae4de064b1300ad31abf73755154b30abe68", size = 102628, upload-time = "2026-10-07T12:22:46.508Z" }, + { url = "https://files.pythonhosted.org/packages/dc/98/d52024bb5b0ff68b4f0d276d867f634c84a67319a7e9f6b7708a37742333/tomli-2.5.0-cp313-cp313-win_amd64.whl", hash = "sha256:fd4dc129784e0c5335bd4e61dfcc4487499a013419e655cf2da1d091b7e0efdc", size = 113301, upload-time = "2026-10-07T12:22:47.647Z" }, + { url = "https://files.pythonhosted.org/packages/6f/f2/540db3a70572a8c23a28aba3e9c358ce0ffffbafc990905c1343aa265b31/tomli-2.5.0-cp313-cp313-win_arm64.whl", hash = "sha256:69491c143d2fe063046e0301e62a810bed338fa4d1ce0fd870c27dc1e09b0d84", size = 109744, upload-time = "2026-10-07T12:22:48.925Z" }, + { url = "https://files.pythonhosted.org/packages/e4/49/caf6b307766eb9567664a8707e9d6be5fcc0e8903f18781c6677a60d80c7/tomli-2.5.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:d3182ee2d887e507bd67319a0a61105d1dd33facc111329559a233b772c1a105", size = 162899, upload-time = "2026-10-07T12:22:50.088Z" }, + { url = "https://files.pythonhosted.org/packages/d3/c8/68cfce773a2733a49c74f99d627fb461bd990756860099eac25617889585/tomli-2.5.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:521345fd1f19d45b8df87657aaa38b6f2ca3800059fadf428e7ebf479a383646", size = 162080, upload-time = "2026-10-07T12:22:51.558Z" }, + { url = "https://files.pythonhosted.org/packages/7e/b2/e5bb8651fdad593f670501a7d718b1a7f73f064d44dea15e04c04dfef45d/tomli-2.5.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6e95c7614e705bfe2b04b27aa124adec59752d15813df37e2156747cab3a006b", size = 273380, upload-time = "2026-10-07T12:22:52.918Z" }, + { url = "https://files.pythonhosted.org/packages/8d/d2/9e2d7f8b1dfe0e2b34c245986ebd55c4c553ea4ce6c47c443b332673253f/tomli-2.5.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7ac2027d37c3afbdf4bdd377f2676f6f1d2122a5be1f1137b49dced590b37e75", size = 283228, upload-time = "2026-10-07T12:22:54.173Z" }, + { url = "https://files.pythonhosted.org/packages/ba/df/ec7b876b7b1a2718bd74a3743c076fff565b04029ba33e8f61fac262739f/tomli-2.5.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:c414be4ed9d3cac80c42e348fa5a956117d1a48227f48026e31f59cb4a7671eb", size = 277189, upload-time = "2026-10-07T12:22:55.342Z" }, + { url = "https://files.pythonhosted.org/packages/7d/7b/e192d9eed0b9cb80da799f4d77052297fb9a2c3cc9b19f571f56ea88add6/tomli-2.5.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:9b03d7dc168353b4132965bde20feceabaa470e570c6f59660dfae59b1f9eeb3", size = 283632, upload-time = "2026-10-07T12:22:56.735Z" }, + { url = "https://files.pythonhosted.org/packages/84/50/ff94454e75461d75623e47401ed323d65c10aab8fe9033242c20cd2fdf32/tomli-2.5.0-cp314-cp314-win32.whl", hash = "sha256:6f041843c4d3a37245c0c056fd955b186bf8b1fb85690cbe40b81230891dc34b", size = 103535, upload-time = "2026-10-07T12:22:58.084Z" }, + { url = "https://files.pythonhosted.org/packages/54/0b/bdacf05f963bd6026ebf6eeb0beda847d1d60e03e440725c64a4e08a0afd/tomli-2.5.0-cp314-cp314-win_amd64.whl", hash = "sha256:f4b653094e18f9031102d3a1da5c729c8f222d85225b18037dac621695e46e1a", size = 114621, upload-time = "2026-10-07T12:22:59.2Z" }, + { url = "https://files.pythonhosted.org/packages/61/99/53f438fa6ae4f9d4ed0ddde3e7242b3bdc34b48c8f9948b72b9e9b127676/tomli-2.5.0-cp314-cp314-win_arm64.whl", hash = "sha256:3f89d10c1ff6a38d992c27fc8a4816af71a909e08a40ec66934240b1e74347c3", size = 111572, upload-time = "2026-10-07T12:23:00.479Z" }, + { url = "https://files.pythonhosted.org/packages/b9/20/1f88f19427d380a40e90a770e087489eaafe4aeee070ae88ed2bbec00acd/tomli-2.5.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:e9e15b4a6c7dd6b85b5fbab29488a73f1f70de516942308daa266bf0e0aeb0d4", size = 171814, upload-time = "2026-10-07T12:23:01.914Z" }, + { url = "https://files.pythonhosted.org/packages/d0/56/cbe5079c9f9a54b9b3e27fc82f08f3cb36edee75561679f53d2380c801d6/tomli-2.5.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:e12bbcd32897272fb05929110362ae9ff4c1b9bb26bd9e971e71dcd3275b4c3d", size = 171324, upload-time = "2026-10-07T12:23:03.18Z" }, + { url = "https://files.pythonhosted.org/packages/2b/30/1d53fd3b0f1cb3ba542e345ec32c26aefdddc4e829e4f3429af8a4f27782/tomli-2.5.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:20aa36de8f2cf87237143bc1fa1aae8d6612c09118f4da21c6a684db5dd1f6f9", size = 297441, upload-time = "2026-10-07T12:23:04.345Z" }, + { url = "https://files.pythonhosted.org/packages/66/d9/0800acb6a111686f764c1b91ef15cc42a20a66a46013bb42220f1d2c61c1/tomli-2.5.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:22185fad8a1e622f064e78008018a0dd3323550dcb479cb7a1d296888d74024f", size = 307476, upload-time = "2026-10-07T12:23:05.671Z" }, + { url = "https://files.pythonhosted.org/packages/e8/63/30a8f3cd51b5bec37f04744bad0b0dc6160df84aad4f27b0e9283d66f221/tomli-2.5.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:984012f71908165449a951de2050d52f276bfe3aa5d5f570f63ddad814370374", size = 296113, upload-time = "2026-10-07T12:23:07.202Z" }, + { url = "https://files.pythonhosted.org/packages/ab/18/0b9ffc597e69c5a1e20a7823cb60d54b39a9f54e91edcb8574f022186758/tomli-2.5.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:f79203b3965b4000e91808aaa7c040206093f2b8bf86f455982f2274c9ccf442", size = 307725, upload-time = "2026-10-07T12:23:08.508Z" }, + { url = "https://files.pythonhosted.org/packages/ab/c7/18f8baae0b5607a60e8e19b4a7fedee43a8ff6458e3896dcbbadeeac9c22/tomli-2.5.0-cp314-cp314t-win32.whl", hash = "sha256:91294a9fb94a75542f6e46e4a2ae709bd8d9b51134098cae5cf3bea5478b6d03", size = 108546, upload-time = "2026-10-07T12:23:09.956Z" }, + { url = "https://files.pythonhosted.org/packages/72/34/4cca9739254130627bde87500b3f2b512154fe2f278efa7e2a5e10ad4bcb/tomli-2.5.0-cp314-cp314t-win_amd64.whl", hash = "sha256:f15e3e0b835a6d68b10c86bf80a3149780498d6911c93c3ffd1861d19f9200f1", size = 117814, upload-time = "2026-10-07T12:23:11.486Z" }, + { url = "https://files.pythonhosted.org/packages/7d/fb/afa530d47dd80a78fce43beac6bc6e00f84558eafcffbc6f37b21e80d056/tomli-2.5.0-cp314-cp314t-win_arm64.whl", hash = "sha256:6664b7ae7af7294256c53960a6103077f4914cec8ff98479c352f622c6f6b2f0", size = 115188, upload-time = "2026-10-07T12:23:12.728Z" }, + { url = "https://files.pythonhosted.org/packages/66/98/316fdc00f8c0939e6fe50461dd343c162d3ad51d1286eb25b7db54361d50/tomli-2.5.0-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:a525685c2f97da40762b8695eb7aa0af4c8344ca1905c73e4e29cb04d34607dc", size = 162775, upload-time = "2026-10-07T12:23:13.941Z" }, + { url = "https://files.pythonhosted.org/packages/c5/22/7b10fa5bb01c9539f53f69b619361b19350acc73657772ea7ac70ba309a8/tomli-2.5.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:9dbb18c1cfb2f6517942fc9314437f66aa06d94436ffb1f06102ef3572f35276", size = 161406, upload-time = "2026-10-07T12:23:15.215Z" }, + { url = "https://files.pythonhosted.org/packages/9c/e7/1a069d86dfd20f1f84f71c63faed9f83c1d890bc06c27d82dc7d888fb573/tomli-2.5.0-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:752e8b1aa6a4367ef8bf6a1a1e005540f7ed055ba36d7193796812ca5404eb52", size = 273855, upload-time = "2026-10-07T12:23:16.471Z" }, + { url = "https://files.pythonhosted.org/packages/ae/83/d1ef43d1687d092ab9c235455c76e6e709483b346b056f086095c7c263a5/tomli-2.5.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c47300f9bf791808f77d82747691c4bb09cb14bdf3060cca99b42cdc4361d5a7", size = 284910, upload-time = "2026-10-07T12:23:18.166Z" }, + { url = "https://files.pythonhosted.org/packages/cc/05/f4d9cf7de61822ece0c3873f30d291e324911c71a378b8bfe5ced13fd9f5/tomli-2.5.0-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:19b0dd8749f4ea2f112c5fcfb3c5248390c899d7e2e173f1d91abee1fa0ff391", size = 277723, upload-time = "2026-10-07T12:23:19.355Z" }, + { url = "https://files.pythonhosted.org/packages/42/28/78262493141fa543151cf005760c3cb01d09fc28a11f993c05109902cb8c/tomli-2.5.0-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:57b1c3b01fab802e2899bc3d168dca320e14165e2fd9fd584760fb4ca5826859", size = 285115, upload-time = "2026-10-07T12:23:20.698Z" }, + { url = "https://files.pythonhosted.org/packages/1a/b9/e1dab9a30bcb677b5cc5cee810609cfd64f24306a3055767dd3fda00b1e0/tomli-2.5.0-cp315-cp315-win32.whl", hash = "sha256:667e521b37a6c5ccaa044202c235b530f90177ffe2cd4a64ecc213c7dd535feb", size = 103475, upload-time = "2026-10-07T12:23:21.941Z" }, + { url = "https://files.pythonhosted.org/packages/4c/bd/31a3790c11d6ea95fcf5e6022ac0f8d0543c9b61120b730fc481bd43d3b4/tomli-2.5.0-cp315-cp315-win_amd64.whl", hash = "sha256:d747252933c8a65ef6bd8da0fbb7ce28a90eb6119d8cd00772cd528aa07b68d5", size = 114589, upload-time = "2026-10-07T12:23:23.098Z" }, + { url = "https://files.pythonhosted.org/packages/47/a2/4f6310fa699364f0e3af7ee3af88dddd9af066d33e716a0265bbe2b3ea84/tomli-2.5.0-cp315-cp315-win_arm64.whl", hash = "sha256:75dbcde8751b0a960aa3de173aa5e894d590755c6d7758b7e774c06f1dc3cbdd", size = 111493, upload-time = "2026-10-07T12:23:24.233Z" }, + { url = "https://files.pythonhosted.org/packages/68/14/00853f0b396d8971107ae1921bb5b322fdee1650d2f16bf06c20adb532e5/tomli-2.5.0-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:2419c2a189551987b59d80e63ec355671283336f41c6b9b89462df679c7d0c57", size = 171380, upload-time = "2026-10-07T12:23:25.512Z" }, + { url = "https://files.pythonhosted.org/packages/89/ad/fa6949321dadee46b27363974fb197b94c911c3b0f7a5fd26d7dc18fc2a0/tomli-2.5.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:0dc598040da8d42cf20f0be588ed7004f46db12a0ac6c32e03a59dccedaaadcd", size = 170553, upload-time = "2026-10-07T12:23:26.855Z" }, + { url = "https://files.pythonhosted.org/packages/53/aa/3056c919eb3e084df3752b2cf5f865dcc04af0b27dba2f66d7b28af4633a/tomli-2.5.0-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:49096930c8d886c9bbdab62d2d0d17ce823ddeea522309a190b36245d5b49e01", size = 294428, upload-time = "2026-10-07T12:23:28.132Z" }, + { url = "https://files.pythonhosted.org/packages/96/b2/faeeb5d8769ea3832021d73e892c8391eae7b4b4f8b55a789127bd8b18a9/tomli-2.5.0-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b8ade5023067f99fe72b88accd30d0ea05a158e9e32a11f124e731ea9695313f", size = 304909, upload-time = "2026-10-07T12:23:29.381Z" }, + { url = "https://files.pythonhosted.org/packages/f6/52/f094c09e73fb654b621716d019acb5d29bdfd1be01df80c281d552bda48d/tomli-2.5.0-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:b69564772b5c8f22ea5f498dff08cfa825045b4d4c4400529000bdf818aa3b2a", size = 293220, upload-time = "2026-10-07T12:23:30.608Z" }, + { url = "https://files.pythonhosted.org/packages/86/f5/0c30541078ca4b505ce3bd76ed931facbfec524dd018535d691d1af0a6d2/tomli-2.5.0-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:8ff3a2ca028c7eee0c777f9a092038d0a594a9fa04e215f929a22c329e2cb142", size = 305705, upload-time = "2026-10-07T12:23:32.181Z" }, + { url = "https://files.pythonhosted.org/packages/05/74/590e7d19d6a118fc5cc5704ff358e21d95b8573f6b9443b1519f29ca8825/tomli-2.5.0-cp315-cp315t-win32.whl", hash = "sha256:62fc1bc8eb03e3a9cadfca713d65614ed8e09d974a283295ffe3a831976b4dc5", size = 108432, upload-time = "2026-10-07T12:23:33.496Z" }, + { url = "https://files.pythonhosted.org/packages/1c/b8/63a75cfb27a17c38550e44025d3a6e7be64516fd8608a3b75703bf37d81b/tomli-2.5.0-cp315-cp315t-win_amd64.whl", hash = "sha256:f3fcbc57b1791fa6cbe5d8434179d51de12be1a4811469529f47f6e7487a2571", size = 117281, upload-time = "2026-10-07T12:23:34.648Z" }, + { url = "https://files.pythonhosted.org/packages/72/01/e8c1debb2173973372934c68fc8e46170ab60ef23ed4592dff4dec6e8993/tomli-2.5.0-cp315-cp315t-win_arm64.whl", hash = "sha256:d2ba24db8a9376921b5e87b4762b9adb0f3f1deaea68f2b8b0bb2c11efb9c3e7", size = 115069, upload-time = "2026-10-07T12:23:35.77Z" }, + { url = "https://files.pythonhosted.org/packages/60/3f/3e3f8fd0919249b0200c80fbc4f9a1e70be19f9883da71dfb7f8b9ab8aca/tomli-2.5.0-py3-none-any.whl", hash = "sha256:32a7b79ac57a2e83670ce329ccf675798bc5a2094783a63676866b70503f2e2b", size = 14765, upload-time = "2026-10-07T12:23:36.875Z" }, +] + +[[package]] +name = "typing-extensions" +version = "4.16.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555, upload-time = "2026-07-02T08:40:05.92Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" }, +] + +[[package]] +name = "tzdata" +version = "2026.5" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d9/68/f1b440335057bfce71b6e50a9d09445aa2ecbd08359a337976627b8409e7/tzdata-2026.5.tar.gz", hash = "sha256:8cc73c0a0bfca7dbfa59235d60b2eff82231dee33f53d206db1acd9173cfc0a7", size = 200404, upload-time = "2026-10-03T09:23:14.143Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/94/21/1e5995a1c920cce14e4bffae20c665ec10e7ed03ab25e006cd741092b718/tzdata-2026.5-py2.py3-none-any.whl", hash = "sha256:b683bd1b6659ddcd810ff02ad09ba821d4bf1065072805063eb35c49617905ac", size = 347996, upload-time = "2026-10-03T09:23:12.535Z" }, +] diff --git a/schemas/stage.v1.json b/schemas/stage.v1.json new file mode 100644 index 0000000..e4a10da --- /dev/null +++ b/schemas/stage.v1.json @@ -0,0 +1,136 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://raw.githubusercontent.com/net0well/PythonScriptRunner/main/schemas/stage.v1.json", + "title": "PythonScriptRunner stage manifest (v1)", + "description": "Declares one Stage: typed inputs, exactly one Python script and typed outputs.", + "type": "object", + "required": ["key", "version", "name", "inputs", "outputs"], + "additionalProperties": false, + "properties": { + "$schema": { "type": "string" }, + "key": { + "description": "Unique slug of the stage.", + "type": "string", + "minLength": 3, + "maxLength": 64, + "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" + }, + "version": { "type": "integer", "minimum": 1 }, + "name": { "type": "string", "minLength": 1, "maxLength": 200 }, + "description": { "type": "string" }, + "python": { + "description": "Python version used to run the script (minimum 3.10). Default: 3.12.", + "type": "string", + "pattern": "^3\\.(1[0-9]|[2-9][0-9])$" + }, + "script": { + "description": "Script file, relative to the stage folder. Default: script.py.", + "type": "string", + "minLength": 1 + }, + "requirements": { + "description": "requirements.txt file, relative to the stage folder. Default: requirements.txt (optional).", + "type": "string", + "minLength": 1 + }, + "timeoutSeconds": { "type": "integer", "minimum": 1, "maximum": 86400 }, + "memoryLimitMb": { "type": "integer", "minimum": 64 }, + "retry": { + "type": "object", + "additionalProperties": false, + "properties": { + "maxAttempts": { "type": "integer", "minimum": 0, "maximum": 20 }, + "initialDelaySeconds": { "type": "integer", "minimum": 0, "maximum": 600 }, + "backoffMultiplier": { "type": "number", "minimum": 1, "maximum": 10 } + } + }, + "idempotent": { "type": "boolean" }, + "secrets": { + "type": "array", + "uniqueItems": true, + "items": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]{0,63}$" } + }, + "inputs": { "type": "array", "items": { "$ref": "#/$defs/field" } }, + "outputs": { "type": "array", "items": { "$ref": "#/$defs/field" } } + }, + "$defs": { + "scalarType": { + "enum": ["number", "integer", "decimal", "string", "bool", "date", "datetime"] + }, + "field": { + "type": "object", + "required": ["name", "type"], + "additionalProperties": false, + "properties": { + "name": { "type": "string", "pattern": "^[a-z_][a-z0-9_]{0,63}$" }, + "type": { + "enum": ["number", "integer", "decimal", "string", "bool", "date", "datetime", "enum", "json", "table", "file", "list"] + }, + "itemType": { + "enum": ["number", "integer", "decimal", "string", "bool", "date", "datetime", "enum", "file"] + }, + "required": { "type": "boolean" }, + "default": {}, + "description": { "type": "string", "maxLength": 500 }, + "enumValues": { + "type": "array", + "minItems": 1, + "maxItems": 200, + "uniqueItems": true, + "items": { "type": "string", "minLength": 1 } + }, + "contentTypes": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { "type": "string", "minLength": 1 } + }, + "columns": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": ["name", "type"], + "additionalProperties": false, + "properties": { + "name": { "type": "string", "minLength": 1 }, + "type": { "$ref": "#/$defs/scalarType" } + } + } + } + }, + "allOf": [ + { + "if": { "properties": { "type": { "const": "list" } } }, + "then": { "required": ["itemType"] }, + "else": { "not": { "required": ["itemType"] } } + }, + { + "if": { + "anyOf": [ + { "properties": { "type": { "const": "enum" } } }, + { "properties": { "type": { "const": "list" }, "itemType": { "const": "enum" } }, "required": ["itemType"] } + ] + }, + "then": { "required": ["enumValues"] }, + "else": { "not": { "required": ["enumValues"] } } + }, + { + "if": { + "anyOf": [ + { "properties": { "type": { "const": "file" } } }, + { "properties": { "type": { "const": "list" }, "itemType": { "const": "file" } }, "required": ["itemType"] } + ] + }, + "then": { "not": { "required": ["default"] } }, + "else": { "not": { "required": ["contentTypes"] } } + }, + { + "if": { "properties": { "type": { "const": "table" } } }, + "then": { "not": { "required": ["default"] } }, + "else": { "not": { "required": ["columns"] } } + } + ] + } + } +} diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 0000000..38cecf1 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,8 @@ + + + + + true + true + + diff --git a/src/PythonScriptRunner.Abstractions/Exceptions.cs b/src/PythonScriptRunner.Abstractions/Exceptions.cs new file mode 100644 index 0000000..ab38d86 --- /dev/null +++ b/src/PythonScriptRunner.Abstractions/Exceptions.cs @@ -0,0 +1,105 @@ +namespace PythonScriptRunner; + +/// Base class of PythonScriptRunner exceptions. +public abstract class PsrException : Exception +{ + /// Creates the exception. + /// Message. + /// Cause. + protected PsrException(string message, Exception? innerException = null) + : base(message, innerException) + { + } +} + +/// The stage does not exist in the catalog. +public sealed class StageNotFoundException : PsrException +{ + /// Creates the exception. + /// Requested key. + public StageNotFoundException(string stageKey) + : base($"Stage '{stageKey}' was not found.") + { + StageKey = stageKey; + } + + /// Requested key. + public string StageKey { get; } +} + +/// The stage exists but not in the requested version. +public sealed class VersionNotFoundException : PsrException +{ + /// Creates the exception. + /// Stage or pipeline key. + /// Requested version. + public VersionNotFoundException(string key, int version) + : base($"Version {version} of '{key}' was not found.") + { + Key = key; + Version = version; + } + + /// Stage or pipeline key. + public string Key { get; } + + /// Requested version. + public int Version { get; } +} + +/// One invalid input. +/// Field path (e.g. coeficientes[2]). +/// Stable code (e.g. MISSING_REQUIRED_INPUT). +/// Human-readable message. +public sealed record InputError(string Field, string Code, string Message); + +/// The inputs of a call do not match the contract; no run was created. +public sealed class InputValidationException : PsrException +{ + /// Creates the exception. + /// Every invalid input. + public InputValidationException(IReadOnlyList errors) + : base("Invalid inputs: " + string.Join("; ", errors.Select(e => $"{e.Field}: {e.Message}"))) + { + Errors = errors; + } + + /// Every invalid input. + public IReadOnlyList Errors { get; } +} + +/// The runner, a catalog or a stage definition is misconfigured. +public sealed class PsrConfigurationException : PsrException +{ + /// Creates the exception. + /// What is wrong. + /// Cause. + public PsrConfigurationException(string message, Exception? innerException = null) + : base(message, innerException) + { + } +} + +/// Thrown by when the run did not succeed. +public sealed class RunFailedException : PsrException +{ + /// Creates the exception. + /// The run result. + public RunFailedException(RunResult result) + : base(BuildMessage(result)) + { + Result = result; + } + + /// The run result. + public RunResult Result { get; } + + private static string BuildMessage(RunResult result) + { + ArgumentNullException.ThrowIfNull(result); + var error = result.Error; + return error is null + ? $"Run {result.Id} ended with status {result.Status}." + : $"Run {result.Id} ended with status {result.Status}: [{error.Kind}{(error.Code is null ? "" : $"/{error.Code}")}] {error.Message}"; + } +} diff --git a/src/PythonScriptRunner.Abstractions/Extensibility/Interfaces.cs b/src/PythonScriptRunner.Abstractions/Extensibility/Interfaces.cs new file mode 100644 index 0000000..b7ed24f --- /dev/null +++ b/src/PythonScriptRunner.Abstractions/Extensibility/Interfaces.cs @@ -0,0 +1,67 @@ +using System.Text.Json.Nodes; + +namespace PythonScriptRunner; + +/// Source of stage definitions (memory, folder or database). +public interface ICatalog +{ + /// Finds a stage version. + /// Stage key. + /// Exact version, or null for the latest published version. + /// Cancellation token. + /// The definition, or null when not found. + ValueTask FindStageAsync(string key, int? version, CancellationToken cancellationToken = default); +} + +/// Resolves the secrets declared by stages. +public interface ISecretProvider +{ + /// Returns the value of a secret, or null when it is not configured. + /// Secret name (e.g. SMTP_PASSWORD). + /// Cancellation token. + ValueTask GetSecretAsync(string name, CancellationToken cancellationToken = default); +} + +/// Receives run transitions so they can be persisted. The default implementation does nothing. +public interface IRunRecorder +{ + /// A run started. + /// Run data. + /// Cancellation token. + ValueTask RunStartedAsync(RunStarted run, CancellationToken cancellationToken); + + /// An attempt finished. + /// Attempt data. + /// Cancellation token. + ValueTask AttemptFinishedAsync(AttemptFinished attempt, CancellationToken cancellationToken); + + /// A run finished. + /// Final data. + /// Cancellation token. + ValueTask RunFinishedAsync(RunFinished run, CancellationToken cancellationToken); +} + +/// A run started. +/// Run identifier. +/// What is executed. +/// Stage or pipeline key. +/// Stage or pipeline version. +/// Who requested the run. +/// Start time. +/// Validated inputs in wire format. +public sealed record RunStarted( + RunId RunId, RunKind Kind, string TargetKey, int TargetVersion, string TriggeredBy, DateTimeOffset StartedAt, JsonObject Inputs); + +/// An attempt finished. +/// Run identifier. +/// Step key. +/// Attempt outcome. +public sealed record AttemptFinished(RunId RunId, string StepKey, AttemptResult Attempt); + +/// A run finished. +/// Run identifier. +/// Final status. +/// End time. +/// Declared outputs in wire format. +/// Failure, when the run did not succeed. +public sealed record RunFinished(RunId RunId, RunStatus Status, DateTimeOffset FinishedAt, JsonObject? Outputs, RunError? Error); diff --git a/src/PythonScriptRunner.Abstractions/Fields/FieldDefinition.cs b/src/PythonScriptRunner.Abstractions/Fields/FieldDefinition.cs new file mode 100644 index 0000000..97491fc --- /dev/null +++ b/src/PythonScriptRunner.Abstractions/Fields/FieldDefinition.cs @@ -0,0 +1,29 @@ +using System.Text.Json.Nodes; + +namespace PythonScriptRunner; + +/// Declaration of one input or output of a stage. +/// Field name (^[a-z_][a-z0-9_]{0,63}$). +/// Field type. +public sealed record FieldDefinition(string Name, FieldType Type) +{ + /// Whether a value must be provided (inputs) or produced (outputs). Default: true. + public bool Required { get; init; } = true; + + /// Default value in wire format; not allowed for files and tables. + public JsonNode? Default { get; init; } + + /// Text shown in the panel and in generated forms (up to 500 chars). + public string? Description { get; init; } + + /// Accepted MIME types for file/list<file> fields (optional). + public IReadOnlyList? ContentTypes { get; init; } + + /// Declared columns of a table field (optional). + public IReadOnlyList? Columns { get; init; } +} + +/// A declared column of a table field. +/// Column name. +/// Scalar type of the column. +public sealed record TableColumn(string Name, FieldType Type); diff --git a/src/PythonScriptRunner.Abstractions/Fields/FieldType.cs b/src/PythonScriptRunner.Abstractions/Fields/FieldType.cs new file mode 100644 index 0000000..8891f9b --- /dev/null +++ b/src/PythonScriptRunner.Abstractions/Fields/FieldType.cs @@ -0,0 +1,212 @@ +namespace PythonScriptRunner; + +/// The kind of value a field carries. +public enum FieldKind +{ + /// 64-bit floating point number. + Number, + /// 64-bit integer. + Integer, + /// Exact decimal number (sent as a JSON string). + Decimal, + /// UTF-8 text. + String, + /// Boolean. + Bool, + /// Calendar date (ISO 8601). + Date, + /// Date and time with a UTC offset (ISO 8601). + DateTime, + /// One value of a closed list of strings. + Enum, + /// Any JSON value. + Json, + /// A list of records (JSON objects). + Table, + /// A file of any format. + File, + /// A list of values of one item type. + List, +} + +/// Type of a stage input or output (one of the 12 supported types). +public sealed class FieldType : IEquatable +{ + private FieldType(FieldKind kind, FieldType? itemType = null, IReadOnlyList? enumValues = null) + { + Kind = kind; + ItemType = itemType; + EnumValues = enumValues; + } + + /// The kind of value. + public FieldKind Kind { get; } + + /// Item type of a ; null otherwise. + public FieldType? ItemType { get; } + + /// Allowed values of an ; null otherwise. + public IReadOnlyList? EnumValues { get; } + + /// number: 64-bit floating point. + public static FieldType Number { get; } = new(FieldKind.Number); + + /// integer: 64-bit integer. + public static FieldType Integer { get; } = new(FieldKind.Integer); + + /// decimal: exact decimal number. + public static FieldType Decimal { get; } = new(FieldKind.Decimal); + + /// string: text. + public static FieldType String { get; } = new(FieldKind.String); + + /// bool: boolean. + public static FieldType Bool { get; } = new(FieldKind.Bool); + + /// date: calendar date. + public static FieldType Date { get; } = new(FieldKind.Date); + + /// datetime: date and time with offset. + public static FieldType DateTime { get; } = new(FieldKind.DateTime); + + /// json: any JSON value. + public static FieldType Json { get; } = new(FieldKind.Json); + + /// table: list of records. + public static FieldType Table { get; } = new(FieldKind.Table); + + /// file: a file of any format. + public static FieldType File { get; } = new(FieldKind.File); + + /// enum with the given allowed values. + /// 1 to 200 unique, non-empty values. + public static FieldType Enum(params IEnumerable values) + { + ArgumentNullException.ThrowIfNull(values); + string[] list = [.. values]; + if (list.Length is 0 or > 200 || list.Distinct(StringComparer.Ordinal).Count() != list.Length + || list.Any(string.IsNullOrEmpty)) + { + throw new ArgumentException("An enum needs 1 to 200 unique, non-empty values.", nameof(values)); + } + + return new FieldType(FieldKind.Enum, enumValues: list); + } + + /// list<T>, where T is a scalar type, an enum or a file. + /// Type of each item. + public static FieldType ListOf(FieldType itemType) + { + ArgumentNullException.ThrowIfNull(itemType); + if (!itemType.IsScalar && itemType.Kind is not (FieldKind.Enum or FieldKind.File)) + { + throw new ArgumentException( + $"List items must be a scalar type, an enum or a file; '{itemType}' is not allowed.", nameof(itemType)); + } + + return new FieldType(FieldKind.List, itemType, itemType.EnumValues); + } + + /// True for number, integer, decimal, string, bool, date and datetime. + public bool IsScalar => Kind <= FieldKind.DateTime; + + /// True for file and list<file>. + public bool IsFile => Kind == FieldKind.File || (Kind == FieldKind.List && ItemType!.Kind == FieldKind.File); + + /// Name used in JSON manifests and in the protocol (e.g. datetime). + public string WireName => WireNameOf(Kind); + + /// Wire name of a kind (e.g. datetime). + /// The kind. + public static string WireNameOf(FieldKind kind) => kind switch + { + FieldKind.DateTime => "datetime", + _ => kind.ToString().ToLowerInvariant(), + }; + + /// Parses the wire representation (type, itemType, enumValues). + /// Wire type name. + /// Item type name for lists. + /// Allowed values for enums. + /// The combination is invalid. + public static FieldType Parse(string type, string? itemType = null, IReadOnlyList? enumValues = null) + { + var kind = ParseKind(type); + if (kind == FieldKind.List) + { + if (itemType is null) + { + throw new ArgumentException("List fields require an item type.", nameof(itemType)); + } + + return ListOf(Parse(itemType, null, enumValues)); + } + + if (itemType is not null) + { + throw new ArgumentException("Only list fields have an item type.", nameof(itemType)); + } + + if (kind == FieldKind.Enum) + { + return Enum(enumValues ?? throw new ArgumentException("Enum fields require values.", nameof(enumValues))); + } + + if (enumValues is not null) + { + throw new ArgumentException("Only enum fields have values.", nameof(enumValues)); + } + + return kind switch + { + FieldKind.Number => Number, + FieldKind.Integer => Integer, + FieldKind.Decimal => Decimal, + FieldKind.String => String, + FieldKind.Bool => Bool, + FieldKind.Date => Date, + FieldKind.DateTime => DateTime, + FieldKind.Json => Json, + FieldKind.Table => Table, + _ => File, + }; + } + + private static FieldKind ParseKind(string type) => type switch + { + "number" => FieldKind.Number, + "integer" => FieldKind.Integer, + "decimal" => FieldKind.Decimal, + "string" => FieldKind.String, + "bool" => FieldKind.Bool, + "date" => FieldKind.Date, + "datetime" => FieldKind.DateTime, + "enum" => FieldKind.Enum, + "json" => FieldKind.Json, + "table" => FieldKind.Table, + "file" => FieldKind.File, + "list" => FieldKind.List, + _ => throw new ArgumentException($"Unknown field type '{type}'.", nameof(type)), + }; + + /// + public bool Equals(FieldType? other) => + other is not null + && Kind == other.Kind + && Equals(ItemType, other.ItemType) + && (EnumValues ?? []).SequenceEqual(other.EnumValues ?? [], StringComparer.Ordinal); + + /// + public override bool Equals(object? obj) => Equals(obj as FieldType); + + /// + public override int GetHashCode() => HashCode.Combine(Kind, ItemType, EnumValues?.Count ?? 0); + + /// + public override string ToString() => Kind switch + { + FieldKind.List => $"list<{ItemType}>", + FieldKind.Enum => $"enum({string.Join('|', EnumValues!)})", + _ => WireName, + }; +} diff --git a/src/PythonScriptRunner.Abstractions/Files/PsrFile.cs b/src/PythonScriptRunner.Abstractions/Files/PsrFile.cs new file mode 100644 index 0000000..da44e0c --- /dev/null +++ b/src/PythonScriptRunner.Abstractions/Files/PsrFile.cs @@ -0,0 +1,190 @@ +using System.Security.Cryptography; +using System.Text; + +namespace PythonScriptRunner; + +/// A file sent to or received from a stage. +public sealed class PsrFile +{ + private static readonly Dictionary KnownTypes = new(StringComparer.OrdinalIgnoreCase) + { + [".html"] = "text/html", + [".htm"] = "text/html", + [".txt"] = "text/plain", + [".csv"] = "text/csv", + [".json"] = "application/json", + [".xml"] = "application/xml", + [".pdf"] = "application/pdf", + [".png"] = "image/png", + [".jpg"] = "image/jpeg", + [".jpeg"] = "image/jpeg", + [".gif"] = "image/gif", + [".svg"] = "image/svg+xml", + [".zip"] = "application/zip", + [".xlsx"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + [".docx"] = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + }; + + private readonly string? _path; + private readonly ReadOnlyMemory? _bytes; + private Stream? _stream; + private string? _sha256; + + private PsrFile(string fileName, string contentType, string? path, ReadOnlyMemory? bytes, Stream? stream, string? sha256) + { + ArgumentException.ThrowIfNullOrWhiteSpace(fileName); + ArgumentException.ThrowIfNullOrWhiteSpace(contentType); + FileName = Path.GetFileName(fileName); + ContentType = contentType; + _path = path; + _bytes = bytes; + _stream = stream; + _sha256 = sha256; + } + + /// A file on disk. + /// File path. + /// MIME type; guessed from the extension when omitted. + /// Name presented to the script; defaults to the file name of . + public static PsrFile FromPath(string path, string? contentType = null, string? fileName = null) + { + var fullPath = Path.GetFullPath(path); + if (!System.IO.File.Exists(fullPath)) + { + throw new FileNotFoundException("File not found.", fullPath); + } + + var name = fileName ?? Path.GetFileName(fullPath); + return new PsrFile(name, contentType ?? GuessContentType(name), fullPath, null, null, null); + } + + /// A file read once from a stream (the stream is consumed when the run starts). + /// Readable stream. + /// File name presented to the script. + /// MIME type. + public static PsrFile FromStream(Stream stream, string fileName, string contentType) + { + ArgumentNullException.ThrowIfNull(stream); + return new PsrFile(fileName, contentType, null, null, stream, null); + } + + /// A file held in memory. + /// Content. + /// File name presented to the script. + /// MIME type. + public static PsrFile FromBytes(ReadOnlyMemory bytes, string fileName, string contentType) => + new(fileName, contentType, null, bytes, null, null); + + /// A text file encoded as UTF-8. + /// Content. + /// File name presented to the script. + /// MIME type. Default: text/plain. + public static PsrFile FromText(string text, string fileName, string contentType = "text/plain") => + FromBytes(Encoding.UTF8.GetBytes(text), fileName, contentType); + + /// A file produced by a stage (path, size and hash already known). + /// File path. + /// File name. + /// MIME type. + /// SHA-256 as lowercase hex. + public static PsrFile FromProducedFile(string path, string fileName, string contentType, string sha256) => + new(fileName, contentType, Path.GetFullPath(path), null, null, sha256); + + /// File name (without directories). + public string FileName { get; } + + /// MIME type. + public string ContentType { get; } + + /// Path on disk, when the file is backed by one. + public string? LocalPath => _path; + + /// Size in bytes; null for a non-seekable stream that was not read yet. + public long? Length + { + get + { + if (_path is not null) + { + return new FileInfo(_path).Length; + } + + if (_bytes is { } bytes) + { + return bytes.Length; + } + + return _stream is { CanSeek: true } stream ? stream.Length - stream.Position : null; + } + } + + /// SHA-256 as lowercase hex; null for a stream that was not read yet. + public string? Sha256 + { + get + { + if (_sha256 is not null) + { + return _sha256; + } + + if (_path is not null) + { + using var file = System.IO.File.OpenRead(_path); + _sha256 = Convert.ToHexStringLower(SHA256.HashData(file)); + } + else if (_bytes is { } bytes) + { + _sha256 = Convert.ToHexStringLower(SHA256.HashData(bytes.Span)); + } + + return _sha256; + } + } + + /// Opens the content for reading. + /// Cancellation token. + /// A stream-backed file was already read. + public Task OpenReadAsync(CancellationToken cancellationToken = default) + { + cancellationToken.ThrowIfCancellationRequested(); + if (_path is not null) + { + Stream file = new FileStream(_path, FileMode.Open, FileAccess.Read, FileShare.Read, 81920, useAsync: true); + return Task.FromResult(file); + } + + if (_bytes is { } bytes) + { + return Task.FromResult(new MemoryStream(bytes.ToArray(), writable: false)); + } + + var stream = Interlocked.Exchange(ref _stream, null) + ?? throw new InvalidOperationException($"The stream of file '{FileName}' was already consumed."); + return Task.FromResult(stream); + } + + /// Copies the content to a file. + /// Destination path (overwritten). + /// Cancellation token. + public async Task SaveAsAsync(string path, CancellationToken cancellationToken = default) + { + var source = await OpenReadAsync(cancellationToken).ConfigureAwait(false); + await using (source.ConfigureAwait(false)) + { + var target = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, 81920, useAsync: true); + await using (target.ConfigureAwait(false)) + { + await source.CopyToAsync(target, cancellationToken).ConfigureAwait(false); + } + } + } + + /// MIME type guessed from the file extension (application/octet-stream when unknown). + /// File name. + public static string GuessContentType(string fileName) => + KnownTypes.TryGetValue(Path.GetExtension(fileName), out var type) ? type : "application/octet-stream"; + + /// + public override string ToString() => $"{FileName} ({ContentType})"; +} diff --git a/src/PythonScriptRunner.Abstractions/Ids.cs b/src/PythonScriptRunner.Abstractions/Ids.cs new file mode 100644 index 0000000..961efe9 --- /dev/null +++ b/src/PythonScriptRunner.Abstractions/Ids.cs @@ -0,0 +1,23 @@ +namespace PythonScriptRunner; + +/// Identifier of a run (time-ordered UUID v7). +/// The underlying GUID. +public readonly record struct RunId(Guid Value) +{ + /// Creates a new time-ordered identifier. + public static RunId New() => new(Guid.CreateVersion7()); + + /// + public override string ToString() => Value.ToString(); +} + +/// Identifier of one attempt of a step (time-ordered UUID v7). +/// The underlying GUID. +public readonly record struct AttemptId(Guid Value) +{ + /// Creates a new time-ordered identifier. + public static AttemptId New() => new(Guid.CreateVersion7()); + + /// + public override string ToString() => Value.ToString(); +} diff --git a/src/PythonScriptRunner.Abstractions/PythonScriptRunner.Abstractions.csproj b/src/PythonScriptRunner.Abstractions/PythonScriptRunner.Abstractions.csproj new file mode 100644 index 0000000..35c6f59 --- /dev/null +++ b/src/PythonScriptRunner.Abstractions/PythonScriptRunner.Abstractions.csproj @@ -0,0 +1,8 @@ + + + + PythonScriptRunner + Contracts and public types of PythonScriptRunner: stage definitions, field types, run results and extension points. + + + diff --git a/src/PythonScriptRunner.Abstractions/Running/IPythonRunner.cs b/src/PythonScriptRunner.Abstractions/Running/IPythonRunner.cs new file mode 100644 index 0000000..53c5bba --- /dev/null +++ b/src/PythonScriptRunner.Abstractions/Running/IPythonRunner.cs @@ -0,0 +1,30 @@ +namespace PythonScriptRunner; + +/// Runs stages synchronously in the current process (one Python process per attempt). +public interface IPythonRunner +{ + /// Runs a published stage and waits for its result. + /// Stage key. + /// Anonymous object, dictionary, JsonObject or record; files as . + /// Version, idempotency key and caller identity. + /// Cancels the run (the Python process tree is stopped). + /// The result; failures during execution are reported in . + /// The stage does not exist. + /// The requested version does not exist. + /// The inputs do not match the contract (no run is created). + Task RunStageAsync( + string stageKey, object? inputs, RunOptions? options = null, CancellationToken cancellationToken = default); +} + +/// Options of one run. +public sealed record RunOptions +{ + /// Version to run; null runs the latest published version. + public int? Version { get; init; } + + /// Deduplicates repeated requests for 24 hours (requires persistence). + public string? IdempotencyKey { get; init; } + + /// Who requested the run. Default: system:library. + public string? TriggeredBy { get; init; } +} diff --git a/src/PythonScriptRunner.Abstractions/Running/PsrJson.cs b/src/PythonScriptRunner.Abstractions/Running/PsrJson.cs new file mode 100644 index 0000000..bf30b20 --- /dev/null +++ b/src/PythonScriptRunner.Abstractions/Running/PsrJson.cs @@ -0,0 +1,27 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace PythonScriptRunner; + +/// JSON settings used to map .NET values to the wire format and back. +/// +/// Property names use snake_case (DesvioPadrao ↔ desvio_padrao), numbers may be read from +/// strings (decimals travel as strings) and enums are written in snake_case. +/// +public static class PsrJson +{ + /// Shared options (do not modify). + public static JsonSerializerOptions Options { get; } = CreateOptions(); + + private static JsonSerializerOptions CreateOptions() + { + var options = new JsonSerializerOptions(JsonSerializerDefaults.Web) + { + PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower, + NumberHandling = JsonNumberHandling.AllowReadingFromString, + Converters = { new JsonStringEnumConverter(JsonNamingPolicy.SnakeCaseLower) }, + }; + options.MakeReadOnly(populateMissingResolver: true); + return options; + } +} diff --git a/src/PythonScriptRunner.Abstractions/Running/Results.cs b/src/PythonScriptRunner.Abstractions/Running/Results.cs new file mode 100644 index 0000000..14bbff3 --- /dev/null +++ b/src/PythonScriptRunner.Abstractions/Running/Results.cs @@ -0,0 +1,242 @@ +using System.Text.Json; +using System.Text.Json.Nodes; + +namespace PythonScriptRunner; + +/// Outcome of one attempt (one Python process). +public sealed record AttemptResult +{ + /// Attempt identifier. + public required AttemptId Id { get; init; } + + /// 1-based attempt number. + public required int Number { get; init; } + + /// Why the attempt was started. + public required AttemptCause Cause { get; init; } + + /// Final status. + public required AttemptStatus Status { get; init; } + + /// When the attempt started. + public required DateTimeOffset StartedAt { get; init; } + + /// Total duration of the attempt. + public required TimeSpan Duration { get; init; } + + /// Time spent by the runner outside the Python process. + public required TimeSpan Overhead { get; init; } + + /// Exit code of the process (null when it did not start). + public int? ExitCode { get; init; } + + /// Failure, when the attempt did not succeed. + public RunError? Error { get; init; } + + /// Tail of stdout. + public LogTail Stdout { get; init; } = LogTail.Empty; + + /// Tail of stderr. + public LogTail Stderr { get; init; } = LogTail.Empty; + + /// Hash of the Python environment used. + public string? EnvironmentHash { get; init; } +} + +/// Outcome of one step (one stage execution, possibly with retries). +public sealed record StepResult +{ + /// Key of the step (the stage key for single-stage runs). + public required string StepKey { get; init; } + + /// 1-based position in the run. + public required int Order { get; init; } + + /// Key of the executed stage. + public required string StageKey { get; init; } + + /// Exact version of the executed stage. + public required int StageVersion { get; init; } + + /// Final status. + public required StepStatus Status { get; init; } + + /// Every attempt, in order. + public required IReadOnlyList Attempts { get; init; } + + /// Validated outputs in wire format (file values carry metadata only). + public JsonObject? Outputs { get; init; } + + /// Output files by field name. + public IReadOnlyDictionary> Files { get; init; } = + new Dictionary>(); + + /// Failure of the last attempt. + public RunError? Error { get; init; } +} + +/// Result of a synchronous run. Dispose it to delete the local output files. +public sealed class RunResult : IAsyncDisposable +{ + private readonly JsonObject _outputs; + private readonly IReadOnlyDictionary> _files; + private readonly Func? _cleanup; + private int _disposed; + + /// Creates a result (used by runner implementations). + /// Run identifier. + /// What was executed. + /// Final status. + /// Total duration. + /// Step results, in order. + /// Declared outputs of the run, in wire format. + /// Output files of the run by field name. + /// Failure, when the run did not succeed. + /// Deletes local files when the result is disposed. + public RunResult( + RunId id, + RunKind kind, + RunStatus status, + TimeSpan duration, + IReadOnlyList steps, + JsonObject? outputs, + IReadOnlyDictionary>? files, + RunError? error, + Func? cleanup = null) + { + Id = id; + Kind = kind; + Status = status; + Duration = duration; + Steps = steps; + _outputs = outputs ?? []; + _files = files ?? new Dictionary>(); + Error = error; + _cleanup = cleanup; + } + + /// Run identifier. + public RunId Id { get; } + + /// What was executed. + public RunKind Kind { get; } + + /// Final status: Succeeded, Failed or Cancelled. + public RunStatus Status { get; } + + /// Failure, when the run did not succeed. + public RunError? Error { get; } + + /// Total duration. + public TimeSpan Duration { get; } + + /// Step results, in order. + public IReadOnlyList Steps { get; } + + /// Declared outputs in wire format. + public JsonObject Outputs => _outputs; + + /// Reads a declared output. + /// Target .NET type (see the type mapping of the protocol). + /// Output name. + /// The output was not produced. + /// The value cannot be converted to . + public T GetOutput(string name) => ReadValue(_outputs, _files, name, scope: null); + + /// Tries to read a declared output. + /// Target .NET type. + /// Output name. + /// The value, when produced. + public bool TryGetOutput(string name, out T? value) + { + if (!_outputs.ContainsKey(name)) + { + value = default; + return false; + } + + value = GetOutput(name); + return true; + } + + /// Reads a file output. + /// Output name. + public PsrFile GetFile(string name) + { + var files = GetFiles(name); + return files.Count == 1 + ? files[0] + : throw new InvalidCastException($"Output '{name}' contains {files.Count} files; use GetFiles."); + } + + /// Reads a file or list<file> output. + /// Output name. + public IReadOnlyList GetFiles(string name) => + _files.TryGetValue(name, out var files) + ? files + : throw new KeyNotFoundException($"Output '{name}' is not a file output or was not produced."); + + /// Reads an output of a specific step (useful to debug pipelines). + /// Target .NET type. + /// Step key. + /// Output name. + public T GetStepOutput(string stepKey, string name) + { + var step = Steps.FirstOrDefault(s => s.StepKey == stepKey) + ?? throw new KeyNotFoundException($"Step '{stepKey}' is not part of this run."); + return ReadValue(step.Outputs ?? [], step.Files, name, stepKey); + } + + /// Throws unless the run succeeded. + public void EnsureSuccess() + { + if (Status != RunStatus.Succeeded) + { + throw new RunFailedException(this); + } + } + + /// + public async ValueTask DisposeAsync() + { + if (Interlocked.Exchange(ref _disposed, 1) == 0 && _cleanup is not null) + { + await _cleanup().ConfigureAwait(false); + } + } + + private static T ReadValue( + JsonObject outputs, IReadOnlyDictionary> files, string name, string? scope) + { + var where = scope is null ? $"Output '{name}'" : $"Output '{name}' of step '{scope}'"; + if (!outputs.TryGetPropertyValue(name, out var node)) + { + throw new KeyNotFoundException($"{where} was not produced or is not declared."); + } + + if (typeof(T) == typeof(PsrFile) || typeof(IEnumerable).IsAssignableFrom(typeof(T))) + { + if (!files.TryGetValue(name, out var list)) + { + throw new InvalidCastException($"{where} is not a file output."); + } + + object value = typeof(T) == typeof(PsrFile) ? list.Single() : list; + return (T)value; + } + + if (node is null) + { + return default!; + } + + try + { + return node.Deserialize(PsrJson.Options)!; + } + catch (Exception ex) when (ex is JsonException or NotSupportedException or FormatException) + { + throw new InvalidCastException($"{where} cannot be read as {typeof(T).Name}: {ex.Message}", ex); + } + } +} diff --git a/src/PythonScriptRunner.Abstractions/Running/RunError.cs b/src/PythonScriptRunner.Abstractions/Running/RunError.cs new file mode 100644 index 0000000..5206e88 --- /dev/null +++ b/src/PythonScriptRunner.Abstractions/Running/RunError.cs @@ -0,0 +1,31 @@ +using System.Text.Json.Nodes; + +namespace PythonScriptRunner; + +/// Why a run, step or attempt failed. +/// Failure classification. +/// Human-readable message. +public sealed record RunError(ErrorKind Kind, string Message) +{ + /// Stable code (e.g. a StageError code or UNDECLARED_OUTPUT). + public string? Code { get; init; } + + /// Key of the step that failed. + public string? StepKey { get; init; } + + /// Python traceback, when available. + public string? Traceback { get; init; } + + /// Extra details given by the script (StageError(details=...)). + public JsonNode? Details { get; init; } +} + +/// The last bytes written to stdout or stderr by an attempt. +/// Captured text (tail), with secret values masked. +/// Whether older output was discarded. +/// Total number of bytes written by the process. +public sealed record LogTail(string Content, bool Truncated, long OriginalBytes) +{ + /// No output. + public static LogTail Empty { get; } = new(string.Empty, false, 0); +} diff --git a/src/PythonScriptRunner.Abstractions/Running/Statuses.cs b/src/PythonScriptRunner.Abstractions/Running/Statuses.cs new file mode 100644 index 0000000..54a9fa2 --- /dev/null +++ b/src/PythonScriptRunner.Abstractions/Running/Statuses.cs @@ -0,0 +1,113 @@ +namespace PythonScriptRunner; + +/// What a run executes. +public enum RunKind +{ + /// A published pipeline version. + Pipeline, + /// A pipeline draft tested from the panel. + PipelineTest, + /// A single published stage. + Stage, + /// A stage draft tested from the panel. + StageTest, +} + +/// Status of a run. +public enum RunStatus +{ + /// Waiting for a concurrency slot of the pipeline. + Pending, + /// Waiting in the queue. + Queued, + /// Executing. + Running, + /// Finished successfully. + Succeeded, + /// Finished with an error (can be reprocessed). + Failed, + /// Cancellation requested; processes are being stopped. + Cancelling, + /// Cancelled. + Cancelled, +} + +/// Status of a step within a run. +public enum StepStatus +{ + /// Not started yet. + Pending, + /// Waiting in the queue. + Queued, + /// Executing. + Running, + /// Finished successfully. + Succeeded, + /// Failed without retries left. + Failed, + /// Exceeded its timeout without retries left. + TimedOut, + /// Cancelled. + Cancelled, + /// Not executed because the run ended earlier. + Skipped, +} + +/// Final status of one attempt. +public enum AttemptStatus +{ + /// Executing. + Running, + /// Finished successfully. + Succeeded, + /// Failed. + Failed, + /// Exceeded its timeout. + TimedOut, + /// Cancelled. + Cancelled, + /// The worker stopped renewing its lease. + WorkerLost, +} + +/// Why an attempt was started. +public enum AttemptCause +{ + /// First attempt of the step. + Initial, + /// Automatic retry from the stage retry policy. + AutoRetry, + /// Manual reprocessing of a failed run. + Reprocess, + /// Recovery after a lost worker lease. + LeaseRecovery, +} + +/// Classification of a failure. +public enum ErrorKind +{ + /// Inputs do not match the contract. + InputValidation, + /// Outputs do not match the contract (extra, missing or wrong type). + OutputContractViolation, + /// The script raised an error (including StageError). + ScriptError, + /// The attempt exceeded its timeout. + Timeout, + /// The process exceeded its memory limit. + MemoryLimitExceeded, + /// The run was cancelled. + Cancelled, + /// The worker executing the step was lost. + WorkerLost, + /// The Python environment could not be created. + EnvironmentSetupFailed, + /// A file exceeded the size limits. + ArtifactLimitExceeded, + /// A declared secret could not be resolved. + SecretNotFound, + /// The process ended without a valid output.json. + ProcessCrashed, + /// The run reached the retention limit before finishing. + Expired, +} diff --git a/src/PythonScriptRunner.Abstractions/Stages/StageDefinition.cs b/src/PythonScriptRunner.Abstractions/Stages/StageDefinition.cs new file mode 100644 index 0000000..028682f --- /dev/null +++ b/src/PythonScriptRunner.Abstractions/Stages/StageDefinition.cs @@ -0,0 +1,96 @@ +namespace PythonScriptRunner; + +/// Immutable definition of one version of a stage: inputs, one Python script and outputs. +public sealed record StageDefinition +{ + /// Unique slug of the stage (e.g. html-to-pdf). + public required string Key { get; init; } + + /// Version number (1, 2, ...). + public required int Version { get; init; } + + /// Display name. + public required string Name { get; init; } + + /// Optional description. + public string? Description { get; init; } + + /// The single Python script of the stage. + public required ScriptSource Script { get; init; } + + /// Python version used to run the script (minimum 3.10); null uses the runner default (3.12). + public string? PythonVersion { get; init; } + + /// Declared dependencies (requirements.txt format). + public string? Requirements { get; init; } + + /// Locked dependencies with hashes; generated from when absent. + public string? LockedRequirements { get; init; } + + /// Declared inputs. + public IReadOnlyList Inputs { get; init; } = []; + + /// Declared outputs. + public IReadOnlyList Outputs { get; init; } = []; + + /// Names of the secrets the script needs (e.g. SMTP_PASSWORD). + public IReadOnlyList RequiredSecrets { get; init; } = []; + + /// Maximum duration of one attempt; null uses the runner default (5 minutes). + public TimeSpan? Timeout { get; init; } + + /// Memory limit of the Python process in MB; null uses the runner default (1024). + public int? MemoryLimitMb { get; init; } + + /// Automatic retry policy. Default: no retry. + public RetryPolicy Retry { get; init; } = RetryPolicy.None; + + /// Whether running the script twice with the same inputs is safe. + public bool Idempotent { get; init; } +} + +/// Where the script of a stage comes from. +public abstract record ScriptSource +{ + private protected ScriptSource() + { + } + + /// Script kept in memory (fluent API or database). + /// Python source code. + public static ScriptSource Inline(string content) => new InlineScriptSource(content); + + /// Script read from a file (folder catalog). + /// Path of the .py file. + public static ScriptSource FromFile(string path) => new FileScriptSource(System.IO.Path.GetFullPath(path)); +} + +/// Script kept in memory. +/// Python source code. +public sealed record InlineScriptSource(string Content) : ScriptSource; + +/// Script stored in a file. +/// Absolute path of the .py file. +public sealed record FileScriptSource(string Path) : ScriptSource; + +/// Automatic retry policy of a stage. +/// Number of retries after the first attempt (0 = no retry). +/// Delay before the first retry. +/// Multiplier applied to the delay on each further retry. +public sealed record RetryPolicy(int MaxAttempts, TimeSpan InitialDelay, double BackoffMultiplier) +{ + /// Upper bound of any retry delay (10 minutes). + public static TimeSpan MaxDelay { get; } = TimeSpan.FromMinutes(10); + + /// No automatic retry (delay 10 s × 2 if retries are enabled later). + public static RetryPolicy None { get; } = new(0, TimeSpan.FromSeconds(10), 2.0); + + /// Delay before retry number (1 = first retry). + /// 1-based retry number. + public TimeSpan GetDelay(int retryNumber) + { + ArgumentOutOfRangeException.ThrowIfLessThan(retryNumber, 1); + var seconds = InitialDelay.TotalSeconds * Math.Pow(BackoffMultiplier, retryNumber - 1); + return seconds >= MaxDelay.TotalSeconds ? MaxDelay : TimeSpan.FromSeconds(seconds); + } +} diff --git a/src/PythonScriptRunner.Core/Catalog/FieldDefinitionJson.cs b/src/PythonScriptRunner.Core/Catalog/FieldDefinitionJson.cs new file mode 100644 index 0000000..0522732 --- /dev/null +++ b/src/PythonScriptRunner.Core/Catalog/FieldDefinitionJson.cs @@ -0,0 +1,74 @@ +using System.Text.Json.Nodes; + +namespace PythonScriptRunner.Core.Catalog; + +/// Maps to and from the manifest/protocol JSON (camelCase). +internal static class FieldDefinitionJson +{ + public static JsonObject ToJson(FieldDefinition field) + { + var type = field.Type; + var json = new JsonObject + { + ["name"] = field.Name, + ["type"] = type.WireName, + ["required"] = field.Required, + }; + if (type.ItemType is { } item) + { + json["itemType"] = item.WireName; + } + + if (type.EnumValues is { } values) + { + json["enumValues"] = new JsonArray([.. values.Select(v => (JsonNode)JsonValue.Create(v))]); + } + + if (field.Default is not null) + { + json["default"] = field.Default.DeepClone(); + } + + if (field.Description is not null) + { + json["description"] = field.Description; + } + + if (field.ContentTypes is { } contentTypes) + { + json["contentTypes"] = new JsonArray([.. contentTypes.Select(v => (JsonNode)JsonValue.Create(v))]); + } + + if (field.Columns is { } columns) + { + json["columns"] = new JsonArray([.. columns.Select(c => (JsonNode)new JsonObject { ["name"] = c.Name, ["type"] = c.Type.WireName })]); + } + + return json; + } + + public static JsonArray ToJson(IEnumerable fields) => new([.. fields.Select(f => (JsonNode)ToJson(f))]); + + /// The JSON is not a valid field declaration. + public static FieldDefinition FromJson(JsonObject json) + { + var name = json["name"]?.GetValue() ?? throw new ArgumentException("Field without 'name'."); + var type = FieldType.Parse( + json["type"]?.GetValue() ?? throw new ArgumentException($"Field '{name}' without 'type'."), + json["itemType"]?.GetValue(), + Strings(json["enumValues"])); + return new FieldDefinition(name, type) + { + Required = json["required"]?.GetValue() ?? true, + Default = json["default"]?.DeepClone(), + Description = json["description"]?.GetValue(), + ContentTypes = Strings(json["contentTypes"]), + Columns = json["columns"] is JsonArray columns + ? [.. columns.Select(c => new TableColumn(c!["name"]!.GetValue(), FieldType.Parse(c["type"]!.GetValue())))] + : null, + }; + } + + private static string[]? Strings(JsonNode? node) => + node is JsonArray array ? [.. array.Select(v => v!.GetValue())] : null; +} diff --git a/src/PythonScriptRunner.Core/Catalog/FileStageSource.cs b/src/PythonScriptRunner.Core/Catalog/FileStageSource.cs new file mode 100644 index 0000000..fa94fa5 --- /dev/null +++ b/src/PythonScriptRunner.Core/Catalog/FileStageSource.cs @@ -0,0 +1,136 @@ +using System.Text.Json; +using System.Text.Json.Nodes; +using Json.Schema; + +namespace PythonScriptRunner.Core.Catalog; + +/// Loads stages from <root>/stages/<folder>/stage.json (+ script and requirements). +internal sealed class FileStageSource(string root) : IStageSource +{ + private const string LockFileName = "requirements.lock"; + + private static readonly Lazy Schema = new(LoadSchema, LazyThreadSafetyMode.ExecutionAndPublication); + + public string Description => $"folder '{root}'"; + + public IReadOnlyList LoadStages() + { + var fullRoot = Path.GetFullPath(root); + if (!Directory.Exists(fullRoot)) + { + throw new PsrConfigurationException($"Catalog folder not found: {fullRoot}"); + } + + var stagesFolder = Path.Combine(fullRoot, "stages"); + if (!Directory.Exists(stagesFolder)) + { + return []; + } + + var errors = new List(); + var stages = new List(); + foreach (var folder in Directory.EnumerateDirectories(stagesFolder).Order(StringComparer.Ordinal)) + { + var manifest = Path.Combine(folder, "stage.json"); + if (!File.Exists(manifest)) + { + errors.Add($"{folder}: stage.json not found"); + continue; + } + + try + { + if (Load(manifest, errors) is { } stage) + { + stages.Add(stage); + } + } + catch (Exception ex) when (ex is JsonException or IOException or ArgumentException or InvalidOperationException) + { + errors.Add($"{manifest}: {ex.Message}"); + } + } + + return errors.Count > 0 + ? throw new PsrConfigurationException( + "Invalid stage catalog:" + Environment.NewLine + string.Join(Environment.NewLine, errors.Select(e => " - " + e))) + : stages; + } + + private static StageDefinition? Load(string manifest, List errors) + { + using var document = JsonDocument.Parse( + File.ReadAllText(manifest), + new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip, AllowTrailingCommas = true }); + + var results = Schema.Value.Evaluate(document.RootElement, new EvaluationOptions { OutputFormat = OutputFormat.List }); + if (!results.IsValid) + { + var before = errors.Count; + foreach (var detail in (IEnumerable)[results, .. results.Details ?? []]) + { + foreach (var message in detail.Errors?.Values ?? Enumerable.Empty()) + { + errors.Add($"{manifest}: {(detail.InstanceLocation.ToString() is { Length: > 0 } at ? at : "/")}: {message}"); + } + } + + if (errors.Count == before) + { + errors.Add($"{manifest}: does not match schemas/stage.v1.json"); + } + + return null; + } + + var json = JsonNode.Parse(document.RootElement.GetRawText())!.AsObject(); + var folder = Path.GetDirectoryName(manifest)!; + + var requirementsName = json["requirements"]?.GetValue(); + var requirementsPath = Path.Combine(folder, requirementsName ?? "requirements.txt"); + string? requirements = null; + if (File.Exists(requirementsPath)) + { + requirements = File.ReadAllText(requirementsPath); + } + else if (requirementsName is not null) + { + errors.Add($"{manifest}: requirements file not found: {requirementsPath}"); + return null; + } + + var lockPath = Path.Combine(folder, LockFileName); + var retry = json["retry"]?.AsObject(); + return new StageDefinition + { + Key = json["key"]!.GetValue(), + Version = json["version"]!.GetValue(), + Name = json["name"]!.GetValue(), + Description = json["description"]?.GetValue(), + Script = ScriptSource.FromFile(Path.Combine(folder, json["script"]?.GetValue() ?? "script.py")), + PythonVersion = json["python"]?.GetValue(), + Requirements = requirements, + LockedRequirements = File.Exists(lockPath) ? File.ReadAllText(lockPath) : null, + Inputs = [.. json["inputs"]!.AsArray().Select(f => FieldDefinitionJson.FromJson(f!.AsObject()))], + Outputs = [.. json["outputs"]!.AsArray().Select(f => FieldDefinitionJson.FromJson(f!.AsObject()))], + RequiredSecrets = json["secrets"] is JsonArray secrets ? [.. secrets.Select(s => s!.GetValue())] : [], + Timeout = json["timeoutSeconds"] is { } seconds ? TimeSpan.FromSeconds(seconds.GetValue()) : null, + MemoryLimitMb = json["memoryLimitMb"]?.GetValue(), + Retry = retry is null + ? RetryPolicy.None + : new RetryPolicy( + retry["maxAttempts"]?.GetValue() ?? 0, + TimeSpan.FromSeconds(retry["initialDelaySeconds"]?.GetValue() ?? 10), + retry["backoffMultiplier"]?.GetValue() ?? 2.0), + Idempotent = json["idempotent"]?.GetValue() ?? false, + }; + } + + private static JsonSchema LoadSchema() + { + using var stream = typeof(FileStageSource).Assembly.GetManifestResourceStream("PythonScriptRunner.Schemas.stage.v1.json") + ?? throw new InvalidOperationException("Embedded stage schema not found."); + using var reader = new StreamReader(stream); + return JsonSchema.FromText(reader.ReadToEnd()); + } +} diff --git a/src/PythonScriptRunner.Core/Catalog/StageBuilder.cs b/src/PythonScriptRunner.Core/Catalog/StageBuilder.cs new file mode 100644 index 0000000..54c567e --- /dev/null +++ b/src/PythonScriptRunner.Core/Catalog/StageBuilder.cs @@ -0,0 +1,173 @@ +using System.Text.Json.Nodes; + +namespace PythonScriptRunner; + +/// Fluent definition of a stage in C#. +public sealed class StageBuilder +{ + private readonly string _key; + private readonly List _inputs = []; + private readonly List _outputs = []; + private readonly List _secrets = []; + private int _version = 1; + private string? _name; + private string? _description; + private ScriptSource? _script; + private string? _pythonVersion; + private string? _requirements; + private TimeSpan? _timeout; + private int? _memoryLimitMb; + private RetryPolicy _retry = RetryPolicy.None; + private bool _idempotent; + + internal StageBuilder(string key) => _key = key; + + /// Version number. Default: 1. + /// Version (≥ 1). + public StageBuilder Version(int version) + { + _version = version; + return this; + } + + /// Display name. Default: the key. + /// Name. + public StageBuilder Name(string name) + { + _name = name; + return this; + } + + /// Description. + /// Text. + public StageBuilder Description(string description) + { + _description = description; + return this; + } + + /// Python source code of the stage (must declare one @stage function). + /// Source code. + public StageBuilder Script(string content) + { + _script = ScriptSource.Inline(content); + return this; + } + + /// Path of the .py file of the stage. + /// Script path. + public StageBuilder ScriptFile(string path) + { + _script = ScriptSource.FromFile(path); + return this; + } + + /// Python version (minimum 3.10). Default: runner default (3.12). + /// Version such as 3.12. + public StageBuilder Python(string version) + { + _pythonVersion = version; + return this; + } + + /// Dependencies in requirements.txt format. + /// Requirements text. + public StageBuilder Requirements(string requirements) + { + _requirements = requirements; + return this; + } + + /// Declares an input. + /// Field name. + /// Field type. + /// Whether the input is required. + /// Default value (wire format). + /// Description. + public StageBuilder Input(string name, FieldType type, bool required = true, JsonNode? @default = null, string? description = null) => + Input(new FieldDefinition(name, type) { Required = required, Default = @default, Description = description }); + + /// Declares an input with every option. + /// Field declaration. + public StageBuilder Input(FieldDefinition field) + { + _inputs.Add(field); + return this; + } + + /// Declares an output. + /// Field name. + /// Field type. + /// Whether the script must produce it. + /// Description. + public StageBuilder Output(string name, FieldType type, bool required = true, string? description = null) => + Output(new FieldDefinition(name, type) { Required = required, Description = description }); + + /// Declares an output with every option. + /// Field declaration. + public StageBuilder Output(FieldDefinition field) + { + _outputs.Add(field); + return this; + } + + /// Declares a secret the script needs (resolved by ). + /// Secret name in UPPER_SNAKE_CASE. + public StageBuilder Secret(string name) + { + _secrets.Add(name); + return this; + } + + /// Timeout of each attempt. Default: runner default (5 minutes). + /// Timeout. + public StageBuilder Timeout(TimeSpan timeout) + { + _timeout = timeout; + return this; + } + + /// Memory limit of the Python process. Default: runner default (1024 MB). + /// Limit in MB (≥ 64). + public StageBuilder MemoryLimitMb(int megabytes) + { + _memoryLimitMb = megabytes; + return this; + } + + /// Automatic retries after a failure. + /// Retries after the first attempt. + /// Delay before the first retry. Default: 10 s. + /// Delay multiplier per retry. Default: 2. + public StageBuilder Retry(int maxAttempts, TimeSpan? initialDelay = null, double backoffMultiplier = 2.0) + { + _retry = new RetryPolicy(maxAttempts, initialDelay ?? TimeSpan.FromSeconds(10), backoffMultiplier); + return this; + } + + /// Marks the stage as safe to run twice with the same inputs. + /// Whether the stage is idempotent. + public StageBuilder Idempotent(bool idempotent = true) + { + _idempotent = idempotent; + return this; + } + + internal StageDefinition Build() => new() + { + Key = _key, + Version = _version, + Name = _name ?? _key, + Description = _description, + Script = _script ?? throw new PsrConfigurationException($"Stage '{_key}' has no script."), + PythonVersion = _pythonVersion, + Requirements = _requirements, + Inputs = [.. _inputs], + Outputs = [.. _outputs], + RequiredSecrets = [.. _secrets], + Timeout = _timeout, + MemoryLimitMb = _memoryLimitMb, + Retry = _retry, + Idempotent = _idempotent, + }; +} diff --git a/src/PythonScriptRunner.Core/Catalog/StageDefinitionValidator.cs b/src/PythonScriptRunner.Core/Catalog/StageDefinitionValidator.cs new file mode 100644 index 0000000..fc10e34 --- /dev/null +++ b/src/PythonScriptRunner.Core/Catalog/StageDefinitionValidator.cs @@ -0,0 +1,152 @@ +using System.Text.RegularExpressions; +using PythonScriptRunner.Core.Values; + +namespace PythonScriptRunner.Core.Catalog; + +/// Validates a stage definition (same rules as schemas/stage.v1.json plus semantic checks). +internal static partial class StageDefinitionValidator +{ + [GeneratedRegex("^[a-z0-9]+(-[a-z0-9]+)*$")] + private static partial Regex KeyPattern(); + + [GeneratedRegex("^[a-z_][a-z0-9_]{0,63}$")] + private static partial Regex FieldNamePattern(); + + [GeneratedRegex("^[A-Z][A-Z0-9_]{0,63}$")] + private static partial Regex SecretPattern(); + + [GeneratedRegex(@"^3\.(1[0-9]|[2-9][0-9])$")] + internal static partial Regex PythonVersionPattern(); + + public static IReadOnlyList Validate(StageDefinition stage) + { + var errors = new List(); + if (stage.Key.Length is < 3 or > 64 || !KeyPattern().IsMatch(stage.Key)) + { + errors.Add("key must be a slug of 3-64 chars (a-z, 0-9, '-')"); + } + + if (stage.Version < 1) + { + errors.Add("version must be >= 1"); + } + + if (string.IsNullOrWhiteSpace(stage.Name) || stage.Name.Length > 200) + { + errors.Add("name must have 1-200 chars"); + } + + if (stage.PythonVersion is not null && !PythonVersionPattern().IsMatch(stage.PythonVersion)) + { + errors.Add($"python version '{stage.PythonVersion}' must look like 3.12 (minimum 3.10)"); + } + + switch (stage.Script) + { + case InlineScriptSource { Content: var content } when string.IsNullOrWhiteSpace(content): + errors.Add("script is empty"); + break; + case FileScriptSource { Path: var path } when !File.Exists(path): + errors.Add($"script file not found: {path}"); + break; + } + + if (stage.Timeout is { } timeout && (timeout <= TimeSpan.Zero || timeout > TimeSpan.FromDays(1))) + { + errors.Add("timeout must be between 1 second and 24 hours"); + } + + if (stage.MemoryLimitMb is < 64) + { + errors.Add("memory limit must be at least 64 MB"); + } + + var retry = stage.Retry; + if (retry.MaxAttempts is < 0 or > 20 || retry.InitialDelay < TimeSpan.Zero + || retry.InitialDelay > TimeSpan.FromMinutes(10) || retry.BackoffMultiplier is < 1 or > 10) + { + errors.Add("retry must have 0-20 attempts, initial delay 0-600 s and multiplier 1-10"); + } + + foreach (var secret in stage.RequiredSecrets) + { + if (!SecretPattern().IsMatch(secret)) + { + errors.Add($"invalid secret name '{secret}' (use UPPER_SNAKE_CASE)"); + } + } + + if (stage.RequiredSecrets.Distinct(StringComparer.Ordinal).Count() != stage.RequiredSecrets.Count) + { + errors.Add("secret names must be unique"); + } + + ValidateFields(stage.Inputs, "inputs", errors); + ValidateFields(stage.Outputs, "outputs", errors); + return errors; + } + + /// The definition is invalid. + public static void EnsureValid(StageDefinition stage, string source) + { + var errors = Validate(stage); + if (errors.Count > 0) + { + throw new PsrConfigurationException($"Invalid stage '{stage.Key}@{stage.Version}' ({source}): {string.Join("; ", errors)}."); + } + } + + private static void ValidateFields(IReadOnlyList fields, string section, List errors) + { + var names = new HashSet(StringComparer.Ordinal); + foreach (var field in fields) + { + var where = $"{section}.{field.Name}"; + if (!FieldNamePattern().IsMatch(field.Name)) + { + errors.Add($"{where}: name must match ^[a-z_][a-z0-9_]{{0,63}}$"); + } + + if (!names.Add(field.Name)) + { + errors.Add($"{where}: duplicate field name"); + } + + if (field.Description is { Length: > 500 }) + { + errors.Add($"{where}: description is longer than 500 chars"); + } + + var type = field.Type; + if (field.ContentTypes is not null && !type.IsFile) + { + errors.Add($"{where}: contentTypes is only allowed on file fields"); + } + + if (field.Columns is { } columns) + { + if (type.Kind != FieldKind.Table) + { + errors.Add($"{where}: columns is only allowed on table fields"); + } + else if (columns.Count == 0 || columns.Any(c => !c.Type.IsScalar || string.IsNullOrEmpty(c.Name))) + { + errors.Add($"{where}: columns need a name and a scalar type"); + } + } + + if (field.Default is { } value) + { + if (type.IsFile || type.Kind == FieldKind.Table) + { + errors.Add($"{where}: {type.WireName} fields cannot have a default"); + continue; + } + + var wireErrors = new List(); + WireValidator.Validate(value, field, $"{where}.default", wireErrors); + errors.AddRange(wireErrors.Select(e => $"{e.Path}: {e.Message}")); + } + } + } +} diff --git a/src/PythonScriptRunner.Core/Catalog/StageSources.cs b/src/PythonScriptRunner.Core/Catalog/StageSources.cs new file mode 100644 index 0000000..1835e37 --- /dev/null +++ b/src/PythonScriptRunner.Core/Catalog/StageSources.cs @@ -0,0 +1,73 @@ +using System.Collections.Frozen; + +namespace PythonScriptRunner.Core.Catalog; + +/// Supplies stage definitions to the . +internal interface IStageSource +{ + /// Human-readable origin used in error messages. + string Description { get; } + + IReadOnlyList LoadStages(); +} + +/// Stages defined in code with . +internal sealed class StaticStageSource(StageDefinition stage) : IStageSource +{ + public string Description => $"code ({stage.Key})"; + + public IReadOnlyList LoadStages() => [stage]; +} + +/// In-memory catalog built once from every registered . +internal sealed class CompositeCatalog(IEnumerable sources) : ICatalog +{ + private readonly Lazy>> _stages = + new(() => Load(sources), LazyThreadSafetyMode.ExecutionAndPublication); + + /// Loads every source now (fail fast at startup). + public void EnsureLoaded() => _ = _stages.Value; + + public ValueTask FindStageAsync(string key, int? version, CancellationToken cancellationToken = default) + { + if (!_stages.Value.TryGetValue(key, out var versions)) + { + return ValueTask.FromResult(null); + } + + if (version is null) + { + return ValueTask.FromResult(versions.Values[^1]); + } + + return ValueTask.FromResult(versions.GetValueOrDefault(version.Value)); + } + + private static FrozenDictionary> Load(IEnumerable sources) + { + var stages = new Dictionary>(StringComparer.Ordinal); + var origins = new Dictionary<(string, int), string>(); + foreach (var source in sources) + { + foreach (var stage in source.LoadStages()) + { + StageDefinitionValidator.EnsureValid(stage, source.Description); + if (origins.TryGetValue((stage.Key, stage.Version), out var other)) + { + throw new PsrConfigurationException( + $"Stage '{stage.Key}@{stage.Version}' is defined twice: {other} and {source.Description}."); + } + + origins[(stage.Key, stage.Version)] = source.Description; + if (!stages.TryGetValue(stage.Key, out var versions)) + { + stages[stage.Key] = versions = []; + } + + versions[stage.Version] = stage; + } + } + + return stages.ToFrozenDictionary(StringComparer.Ordinal); + } +} diff --git a/src/PythonScriptRunner.Core/DependencyInjection/PythonScriptRunnerOptionsValidator.cs b/src/PythonScriptRunner.Core/DependencyInjection/PythonScriptRunnerOptionsValidator.cs new file mode 100644 index 0000000..97984f3 --- /dev/null +++ b/src/PythonScriptRunner.Core/DependencyInjection/PythonScriptRunnerOptionsValidator.cs @@ -0,0 +1,65 @@ +using Microsoft.Extensions.Options; +using PythonScriptRunner.Core.Catalog; +using PythonScriptRunner.Core.Environments; + +namespace PythonScriptRunner.Core; + +/// Validates , including that uv can be found. +internal sealed class PythonScriptRunnerOptionsValidator : IValidateOptions +{ + public ValidateOptionsResult Validate(string? name, PythonScriptRunnerOptions options) + { + var errors = new List(); + if (string.IsNullOrWhiteSpace(options.WorkRoot)) + { + errors.Add("WorkRoot is required."); + } + + if (string.IsNullOrWhiteSpace(options.EnvironmentCacheRoot)) + { + errors.Add("EnvironmentCacheRoot is required."); + } + + if (!StageDefinitionValidator.PythonVersionPattern().IsMatch(options.DefaultPythonVersion ?? string.Empty)) + { + errors.Add($"DefaultPythonVersion '{options.DefaultPythonVersion}' must look like 3.12 (minimum 3.10)."); + } + + if (options.DefaultTimeout <= TimeSpan.Zero) + { + errors.Add("DefaultTimeout must be positive."); + } + + if (options.DefaultMemoryLimitMb < 64) + { + errors.Add("DefaultMemoryLimitMb must be at least 64."); + } + + if (options.MaxFileBytes <= 0 || options.MaxRunFilesBytes < options.MaxFileBytes) + { + errors.Add("MaxFileBytes must be positive and MaxRunFilesBytes must be at least MaxFileBytes."); + } + + if (options.MaxLogBytes < 1024) + { + errors.Add("MaxLogBytes must be at least 1024."); + } + + if (options.MaxConcurrentProcesses < 1) + { + errors.Add("MaxConcurrentProcesses must be at least 1."); + } + + if (string.IsNullOrWhiteSpace(options.PsrunnerRequirement)) + { + errors.Add("PsrunnerRequirement is required."); + } + + if (ExecutableLocator.Find(options.UvPath) is null) + { + errors.Add($"The uv executable '{options.UvPath}' was not found. Install uv (https://docs.astral.sh/uv/) or set UvPath."); + } + + return errors.Count == 0 ? ValidateOptionsResult.Success : ValidateOptionsResult.Fail(errors); + } +} diff --git a/src/PythonScriptRunner.Core/DependencyInjection/PythonScriptRunnerServiceCollectionExtensions.cs b/src/PythonScriptRunner.Core/DependencyInjection/PythonScriptRunnerServiceCollectionExtensions.cs new file mode 100644 index 0000000..697ea6a --- /dev/null +++ b/src/PythonScriptRunner.Core/DependencyInjection/PythonScriptRunnerServiceCollectionExtensions.cs @@ -0,0 +1,101 @@ +using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Options; +using PythonScriptRunner; +using PythonScriptRunner.Core; +using PythonScriptRunner.Core.Catalog; +using PythonScriptRunner.Core.Diagnostics; +using PythonScriptRunner.Core.Environments; +using PythonScriptRunner.Core.Execution; +using PythonScriptRunner.Core.Running; + +namespace Microsoft.Extensions.DependencyInjection; + +/// Registers PythonScriptRunner services. +public static class PythonScriptRunnerServiceCollectionExtensions +{ + /// Adds the Python runner () and its default services. + /// Service collection. + /// Configures . + /// A builder to add catalogs, stages and providers. + public static IPythonScriptRunnerBuilder AddPythonScriptRunner( + this IServiceCollection services, Action? configure = null) + { + ArgumentNullException.ThrowIfNull(services); + services.AddLogging(); + services.AddMetrics(); + var options = services.AddOptions().ValidateOnStart(); + if (configure is not null) + { + options.Configure(configure); + } + + services.TryAddEnumerable(ServiceDescriptor.Singleton, PythonScriptRunnerOptionsValidator>()); + services.TryAddSingleton(TimeProvider.System); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddEnumerable(ServiceDescriptor.Singleton()); + return new PythonScriptRunnerBuilder(services); + } + + private sealed class PythonScriptRunnerBuilder(IServiceCollection services) : IPythonScriptRunnerBuilder + { + public IServiceCollection Services { get; } = services; + } +} + +/// Builder returned by AddPythonScriptRunner. +public interface IPythonScriptRunnerBuilder +{ + /// The service collection. + IServiceCollection Services { get; } +} + +/// Catalog and provider registration. +public static class PythonScriptRunnerBuilderExtensions +{ + /// Loads stages from <rootPath>/stages/<folder>/stage.json. + /// Builder. + /// Catalog folder. + public static IPythonScriptRunnerBuilder AddFileCatalog(this IPythonScriptRunnerBuilder builder, string rootPath) + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentException.ThrowIfNullOrWhiteSpace(rootPath); + builder.Services.AddSingleton(new FileStageSource(rootPath)); + return builder; + } + + /// Defines a stage in code. + /// Builder. + /// Stage key (slug). + /// Fluent definition. + /// The definition is invalid. + public static IPythonScriptRunnerBuilder AddStage(this IPythonScriptRunnerBuilder builder, string key, Action configure) + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentNullException.ThrowIfNull(configure); + var stageBuilder = new StageBuilder(key); + configure(stageBuilder); + var stage = stageBuilder.Build(); + StageDefinitionValidator.EnsureValid(stage, "code"); + builder.Services.AddSingleton(new StaticStageSource(stage)); + return builder; + } + + /// Replaces the secret provider (default: IConfiguration section PythonScriptRunner:Secrets). + /// Provider type. + /// Builder. + public static IPythonScriptRunnerBuilder AddSecretProvider(this IPythonScriptRunnerBuilder builder) + where TProvider : class, ISecretProvider + { + ArgumentNullException.ThrowIfNull(builder); + builder.Services.Replace(ServiceDescriptor.Singleton()); + return builder; + } +} diff --git a/src/PythonScriptRunner.Core/Diagnostics/PsrDiagnostics.cs b/src/PythonScriptRunner.Core/Diagnostics/PsrDiagnostics.cs new file mode 100644 index 0000000..d0faec3 --- /dev/null +++ b/src/PythonScriptRunner.Core/Diagnostics/PsrDiagnostics.cs @@ -0,0 +1,73 @@ +using System.Diagnostics; +using System.Diagnostics.Metrics; +using Microsoft.Extensions.Logging; + +namespace PythonScriptRunner.Core.Diagnostics; + +/// Tracing source shared by every PythonScriptRunner package. +internal static class PsrDiagnostics +{ + public const string Name = "PythonScriptRunner"; + + public static readonly ActivitySource Source = new(Name); +} + +/// Metrics of the runner (meter PythonScriptRunner). +internal sealed class PsrMetrics +{ + private readonly Histogram _stepDuration; + private readonly Histogram _stepOverhead; + private readonly Counter _stepFailures; + private readonly Counter _environmentsCreated; + + public PsrMetrics(IMeterFactory meterFactory) + { + var meter = meterFactory.Create(PsrDiagnostics.Name); + _stepDuration = meter.CreateHistogram("psr.step.duration", "ms", "Duration of each attempt."); + _stepOverhead = meter.CreateHistogram("psr.step.overhead", "ms", "Time spent by the runner outside the Python process."); + _stepFailures = meter.CreateCounter("psr.step.failures", description: "Failed attempts."); + _environmentsCreated = meter.CreateCounter("psr.environment.created", description: "Python environments created."); + } + + public void AttemptFinished(string stageKey, AttemptResult attempt) + { + var stage = new KeyValuePair("psr.stage.key", stageKey); + _stepDuration.Record(attempt.Duration.TotalMilliseconds, stage, new("psr.outcome", attempt.Status.ToString())); + _stepOverhead.Record(attempt.Overhead.TotalMilliseconds, stage); + if (attempt.Status != AttemptStatus.Succeeded) + { + _stepFailures.Add(1, stage, new("psr.error.kind", attempt.Error?.Kind.ToString())); + } + } + + public void EnvironmentCreated(string pythonVersion) => + _environmentsCreated.Add(1, new KeyValuePair("psr.python.version", pythonVersion)); +} + +/// Source-generated log messages. +internal static partial class Log +{ + [LoggerMessage(1, LogLevel.Information, "Creating Python {PythonVersion} environment {EnvironmentHash} for stage {StageKey}")] + public static partial void CreatingEnvironment(ILogger logger, string environmentHash, string pythonVersion, string stageKey); + + [LoggerMessage(2, LogLevel.Information, "Python environment {EnvironmentHash} created in {ElapsedMs:F0} ms")] + public static partial void EnvironmentCreated(ILogger logger, string environmentHash, double elapsedMs); + + [LoggerMessage(3, LogLevel.Warning, "Stage {StageKey}@{StageVersion} has no requirements.lock; dependencies were locked now and cached. Commit a requirements.lock for reproducible environments.")] + public static partial void GeneratingLock(ILogger logger, string stageKey, int stageVersion); + + [LoggerMessage(4, LogLevel.Warning, "Stage {StageKey} attempt {Attempt} failed: [{ErrorKind}] {Message}")] + public static partial void AttemptFailed(ILogger logger, string stageKey, int attempt, ErrorKind errorKind, string message); + + [LoggerMessage(5, LogLevel.Information, "Stage {StageKey} will retry in {Delay} (attempt {NextAttempt})")] + public static partial void RetryScheduled(ILogger logger, string stageKey, TimeSpan delay, int nextAttempt); + + [LoggerMessage(6, LogLevel.Information, "Removed {Count} leftover work folders older than {Retention}")] + public static partial void OrphansRemoved(ILogger logger, int count, TimeSpan retention); + + [LoggerMessage(7, LogLevel.Debug, "stdout of stage {StageKey} attempt {Attempt}:\n{Output}")] + public static partial void ScriptStdout(ILogger logger, string stageKey, int attempt, string output); + + [LoggerMessage(8, LogLevel.Information, "stderr of stage {StageKey} attempt {Attempt}:\n{Output}")] + public static partial void ScriptStderr(ILogger logger, string stageKey, int attempt, string output); +} diff --git a/src/PythonScriptRunner.Core/Environments/CrossProcessLock.cs b/src/PythonScriptRunner.Core/Environments/CrossProcessLock.cs new file mode 100644 index 0000000..ff18161 --- /dev/null +++ b/src/PythonScriptRunner.Core/Environments/CrossProcessLock.cs @@ -0,0 +1,34 @@ +using System.Diagnostics; + +namespace PythonScriptRunner.Core.Environments; + +/// Exclusive lock shared by every process on the machine (an exclusively opened lock file). +internal sealed class CrossProcessLock : IDisposable +{ + private readonly FileStream _stream; + + private CrossProcessLock(FileStream stream) => _stream = stream; + + public static async Task AcquireAsync(string path, TimeSpan timeout, CancellationToken cancellationToken) + { + Directory.CreateDirectory(Path.GetDirectoryName(path)!); + var started = Stopwatch.GetTimestamp(); + while (true) + { + try + { + return new CrossProcessLock(new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)); + } + catch (IOException) when (Stopwatch.GetElapsedTime(started) < timeout) + { + await Task.Delay(TimeSpan.FromMilliseconds(200), cancellationToken).ConfigureAwait(false); + } + catch (IOException ex) + { + throw new PythonEnvironmentException($"Timed out waiting for the lock '{path}'.", ex); + } + } + } + + public void Dispose() => _stream.Dispose(); +} diff --git a/src/PythonScriptRunner.Core/Environments/ExecutableLocator.cs b/src/PythonScriptRunner.Core/Environments/ExecutableLocator.cs new file mode 100644 index 0000000..54cf531 --- /dev/null +++ b/src/PythonScriptRunner.Core/Environments/ExecutableLocator.cs @@ -0,0 +1,35 @@ +namespace PythonScriptRunner.Core.Environments; + +/// Finds an executable by path or in the PATH. +internal static class ExecutableLocator +{ + public static string? Find(string nameOrPath) + { + if (string.IsNullOrWhiteSpace(nameOrPath)) + { + return null; + } + + if (Path.IsPathRooted(nameOrPath) || nameOrPath.Contains(Path.DirectorySeparatorChar) || nameOrPath.Contains(Path.AltDirectorySeparatorChar)) + { + var full = Path.GetFullPath(nameOrPath); + return Candidates(full).FirstOrDefault(File.Exists); + } + + var directories = (Environment.GetEnvironmentVariable("PATH") ?? string.Empty) + .Split(Path.PathSeparator, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); + return directories + .SelectMany(directory => Candidates(Path.Combine(directory, nameOrPath))) + .FirstOrDefault(File.Exists); + } + + private static IEnumerable Candidates(string path) + { + yield return path; + if (OperatingSystem.IsWindows() && !Path.HasExtension(path)) + { + yield return path + ".exe"; + yield return path + ".cmd"; + } + } +} diff --git a/src/PythonScriptRunner.Core/Environments/IEnvironmentManager.cs b/src/PythonScriptRunner.Core/Environments/IEnvironmentManager.cs new file mode 100644 index 0000000..5ee278f --- /dev/null +++ b/src/PythonScriptRunner.Core/Environments/IEnvironmentManager.cs @@ -0,0 +1,38 @@ +namespace PythonScriptRunner; + +/// Creates and caches the Python environment of each stage (one venv per dependency set). +public interface IEnvironmentManager +{ + /// Resolves dependencies into a lock with hashes (uv pip compile --universal --generate-hashes). + /// Target Python version; null uses the runner default. + /// Requirements in requirements.txt format. + /// Cancellation token. + /// The locked requirements (empty when there are no requirements). + /// Resolution failed. + Task LockAsync(string? pythonVersion, string? requirements, CancellationToken cancellationToken = default); + + /// Returns the environment of a stage, creating it on first use. + /// The stage. + /// Cancellation token. + /// The environment could not be created. + Task EnsureAsync(StageDefinition stage, CancellationToken cancellationToken = default); +} + +/// A ready-to-use Python environment. +/// Hash of Python version + locked requirements + psrunner. +/// Folder of the venv. +/// Python interpreter of the venv. +/// Whether it was created by this call. +public sealed record PythonEnvironment(string Hash, string Directory, string PythonExecutable, bool Created); + +/// A Python environment could not be resolved or created. +public sealed class PythonEnvironmentException : PsrException +{ + /// Creates the exception. + /// What failed (includes the uv output). + /// Cause. + public PythonEnvironmentException(string message, Exception? innerException = null) + : base(message, innerException) + { + } +} diff --git a/src/PythonScriptRunner.Core/Environments/UvCli.cs b/src/PythonScriptRunner.Core/Environments/UvCli.cs new file mode 100644 index 0000000..e00a9c7 --- /dev/null +++ b/src/PythonScriptRunner.Core/Environments/UvCli.cs @@ -0,0 +1,69 @@ +using System.ComponentModel; +using System.Diagnostics; + +namespace PythonScriptRunner.Core.Environments; + +/// Runs the uv command line. +internal sealed class UvCli(string uvExecutable) +{ + private static readonly TimeSpan Timeout = TimeSpan.FromMinutes(15); + + public async Task RunAsync(IReadOnlyList arguments, string? standardInput, CancellationToken cancellationToken) + { + var startInfo = new ProcessStartInfo(uvExecutable) + { + UseShellExecute = false, + CreateNoWindow = true, + RedirectStandardOutput = true, + RedirectStandardError = true, + RedirectStandardInput = standardInput is not null, + }; + foreach (var argument in arguments) + { + startInfo.ArgumentList.Add(argument); + } + + startInfo.Environment.Remove("VIRTUAL_ENV"); + startInfo.Environment.Remove("UV_PROJECT_ENVIRONMENT"); + startInfo.Environment["NO_COLOR"] = "1"; + + using var process = new Process { StartInfo = startInfo }; + try + { + process.Start(); + } + catch (Win32Exception ex) + { + throw new PythonEnvironmentException($"Could not start uv ('{uvExecutable}'): {ex.Message}", ex); + } + + var stdout = process.StandardOutput.ReadToEndAsync(cancellationToken); + var stderr = process.StandardError.ReadToEndAsync(cancellationToken); + if (standardInput is not null) + { + await process.StandardInput.WriteAsync(standardInput.AsMemory(), cancellationToken).ConfigureAwait(false); + process.StandardInput.Close(); + } + + using var timeout = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); + timeout.CancelAfter(Timeout); + try + { + await process.WaitForExitAsync(timeout.Token).ConfigureAwait(false); + } + catch (OperationCanceledException) + { + process.Kill(entireProcessTree: true); + cancellationToken.ThrowIfCancellationRequested(); + throw new PythonEnvironmentException($"uv {Describe(arguments)} did not finish within {Timeout.TotalMinutes} minutes."); + } + + var output = await stdout.ConfigureAwait(false); + var error = await stderr.ConfigureAwait(false); + return process.ExitCode == 0 + ? output + : throw new PythonEnvironmentException($"uv {Describe(arguments)} failed (exit code {process.ExitCode}): {error.Trim()}"); + } + + private static string Describe(IReadOnlyList arguments) => string.Join(' ', arguments.Take(2)); +} diff --git a/src/PythonScriptRunner.Core/Environments/UvEnvironmentManager.cs b/src/PythonScriptRunner.Core/Environments/UvEnvironmentManager.cs new file mode 100644 index 0000000..a2275de --- /dev/null +++ b/src/PythonScriptRunner.Core/Environments/UvEnvironmentManager.cs @@ -0,0 +1,149 @@ +using System.Diagnostics; +using System.Globalization; +using System.Security.Cryptography; +using System.Text; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using PythonScriptRunner.Core.Diagnostics; + +namespace PythonScriptRunner.Core.Environments; + +/// Creates one venv per (Python version, locked requirements, psrunner) with uv and caches it on disk. +internal sealed class UvEnvironmentManager( + IOptions options, + PsrMetrics metrics, + TimeProvider time, + ILogger logger) : IEnvironmentManager +{ + private const string ReadyMarker = ".psr-ready"; + private static readonly TimeSpan LockTimeout = TimeSpan.FromMinutes(20); + + public async Task LockAsync(string? pythonVersion, string? requirements, CancellationToken cancellationToken = default) + { + if (string.IsNullOrWhiteSpace(requirements)) + { + return string.Empty; + } + + var version = pythonVersion ?? options.Value.DefaultPythonVersion; + List arguments = + [ + "pip", "compile", "-", "--universal", "--generate-hashes", "--python-version", version, + "--no-header", "--no-annotate", "--quiet", .. IndexArguments(), + ]; + return await CreateCli().RunAsync(arguments, requirements, cancellationToken).ConfigureAwait(false); + } + + public async Task EnsureAsync(StageDefinition stage, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(stage); + var settings = options.Value; + var version = stage.PythonVersion ?? settings.DefaultPythonVersion; + var locked = stage.LockedRequirements ?? await GetCachedLockAsync(stage, version, cancellationToken).ConfigureAwait(false); + var hash = Sha256Hex($"{version}\n{Normalize(locked)}\n{PsrunnerIdentity(settings.PsrunnerRequirement)}"); + var directory = Path.Combine(settings.EnvironmentCacheRoot, "envs", hash[..32]); + var python = OperatingSystem.IsWindows() + ? Path.Combine(directory, "Scripts", "python.exe") + : Path.Combine(directory, "bin", "python"); + var marker = Path.Combine(directory, ReadyMarker); + if (File.Exists(marker)) + { + return new PythonEnvironment(hash, directory, python, Created: false); + } + + using var activity = PsrDiagnostics.Source.StartActivity("psr.environment.ensure"); + activity?.SetTag("psr.environment.hash", hash); + using (await CrossProcessLock.AcquireAsync(directory + ".lock", LockTimeout, cancellationToken).ConfigureAwait(false)) + { + if (File.Exists(marker)) + { + activity?.SetTag("psr.environment.created", false); + return new PythonEnvironment(hash, directory, python, Created: false); + } + + Log.CreatingEnvironment(logger, hash, version, stage.Key); + var started = Stopwatch.GetTimestamp(); + if (Directory.Exists(directory)) + { + Directory.Delete(directory, recursive: true); + } + + var uv = CreateCli(); + await uv.RunAsync(["venv", directory, "--python", version, "--quiet"], null, cancellationToken).ConfigureAwait(false); + if (!string.IsNullOrWhiteSpace(locked)) + { + var lockFile = Path.Combine(directory, "requirements.lock"); + await File.WriteAllTextAsync(lockFile, locked, cancellationToken).ConfigureAwait(false); + await uv.RunAsync( + ["pip", "sync", lockFile, "--python", python, "--require-hashes", "--quiet", .. IndexArguments()], + null, + cancellationToken).ConfigureAwait(false); + } + + await uv.RunAsync( + ["pip", "install", "--python", python, "--no-deps", "--quiet", settings.PsrunnerRequirement, .. IndexArguments()], + null, + cancellationToken).ConfigureAwait(false); + await File.WriteAllTextAsync(marker, time.GetUtcNow().ToString("O", CultureInfo.InvariantCulture), cancellationToken) + .ConfigureAwait(false); + + metrics.EnvironmentCreated(version); + activity?.SetTag("psr.environment.created", true); + Log.EnvironmentCreated(logger, hash, Stopwatch.GetElapsedTime(started).TotalMilliseconds); + return new PythonEnvironment(hash, directory, python, Created: true); + } + } + + private async Task GetCachedLockAsync(StageDefinition stage, string version, CancellationToken cancellationToken) + { + if (string.IsNullOrWhiteSpace(stage.Requirements)) + { + return string.Empty; + } + + var key = Sha256Hex($"{version}\n{Normalize(stage.Requirements)}"); + var path = Path.Combine(options.Value.EnvironmentCacheRoot, "locks", $"{key[..32]}.txt"); + if (File.Exists(path)) + { + return await File.ReadAllTextAsync(path, cancellationToken).ConfigureAwait(false); + } + + Log.GeneratingLock(logger, stage.Key, stage.Version); + var locked = await LockAsync(version, stage.Requirements, cancellationToken).ConfigureAwait(false); + Directory.CreateDirectory(Path.GetDirectoryName(path)!); + var temporary = $"{path}.{Guid.NewGuid():N}.tmp"; + await File.WriteAllTextAsync(temporary, locked, cancellationToken).ConfigureAwait(false); + File.Move(temporary, path, overwrite: true); + return locked; + } + + private UvCli CreateCli() + { + var uvPath = options.Value.UvPath; + return new UvCli(ExecutableLocator.Find(uvPath) + ?? throw new PythonEnvironmentException($"The uv executable '{uvPath}' was not found. Install uv or set UvPath.")); + } + + private IEnumerable IndexArguments() + { + var settings = options.Value; + if (!string.IsNullOrWhiteSpace(settings.PackageIndexUrl)) + { + yield return "--index-url"; + yield return settings.PackageIndexUrl; + } + + foreach (var url in settings.ExtraIndexUrls) + { + yield return "--extra-index-url"; + yield return url; + } + } + + private static string PsrunnerIdentity(string requirement) => + File.Exists(requirement) ? "file:" + Convert.ToHexStringLower(SHA256.HashData(File.ReadAllBytes(requirement))) : requirement; + + private static string Normalize(string text) => text.ReplaceLineEndings("\n").Trim(); + + private static string Sha256Hex(string text) => Convert.ToHexStringLower(SHA256.HashData(Encoding.UTF8.GetBytes(text))); +} diff --git a/src/PythonScriptRunner.Core/Execution/ExecutionModel.cs b/src/PythonScriptRunner.Core/Execution/ExecutionModel.cs new file mode 100644 index 0000000..28cbfdb --- /dev/null +++ b/src/PythonScriptRunner.Core/Execution/ExecutionModel.cs @@ -0,0 +1,75 @@ +using System.Text.Json.Nodes; + +namespace PythonScriptRunner.Core.Execution; + +/// An input file already copied to the run folder. +internal sealed record InputFileCopy(string Field, int Index, string SourcePath, string FileName, string ContentType, long Size, string Sha256); + +/// An output file produced by the script and validated by the runner. +internal sealed record OutputFile(string Field, int Index, string FullPath, string FileName, string ContentType, long Size, string Sha256); + +/// Everything needed to run one attempt. +internal sealed record ExecutionRequest +{ + public required StageDefinition Stage { get; init; } + + public required PythonEnvironment Environment { get; init; } + + public required RunId RunId { get; init; } + + public required string StepKey { get; init; } + + public required int Attempt { get; init; } + + public bool IsTest { get; init; } + + public required string WorkDirectory { get; init; } + + /// Wire inputs; file fields hold placeholders that the executor completes. + public required JsonObject Inputs { get; init; } + + public IReadOnlyList Files { get; init; } = []; + + public IReadOnlyDictionary Secrets { get; init; } = new Dictionary(); + + public required TimeSpan Timeout { get; init; } + + public required int MemoryLimitMb { get; init; } + + public required long MaxFileBytes { get; init; } + + /// Bytes still available for output files in this run. + public required long FileBudgetBytes { get; init; } + + public required int MaxLogBytes { get; init; } +} + +/// Outcome of one attempt as seen by the executor. +internal sealed record ExecutionResult +{ + public required AttemptStatus Status { get; init; } + + public RunError? Error { get; init; } + + public int? ExitCode { get; init; } + + public TimeSpan ProcessDuration { get; init; } + + public LogTail Stdout { get; init; } = LogTail.Empty; + + public LogTail Stderr { get; init; } = LogTail.Empty; + + /// Validated outputs in wire format (files as metadata). + public JsonObject? Outputs { get; init; } + + public IReadOnlyList Files { get; init; } = []; + + public static ExecutionResult Failure(ErrorKind kind, string message, string? code = null, AttemptStatus status = AttemptStatus.Failed) => + new() { Status = status, Error = new RunError(kind, message) { Code = code } }; +} + +/// Runs one attempt of a stage. +internal interface IPythonExecutor +{ + Task ExecuteAsync(ExecutionRequest request, CancellationToken cancellationToken); +} diff --git a/src/PythonScriptRunner.Core/Execution/LogCapture.cs b/src/PythonScriptRunner.Core/Execution/LogCapture.cs new file mode 100644 index 0000000..bceae0a --- /dev/null +++ b/src/PythonScriptRunner.Core/Execution/LogCapture.cs @@ -0,0 +1,84 @@ +using System.Text; + +namespace PythonScriptRunner.Core.Execution; + +/// Keeps the last capacity bytes written to a stream. +internal sealed class TailBuffer(int capacity) +{ + private readonly byte[] _buffer = new byte[capacity]; + private int _start; + private int _count; + private long _total; + + public long TotalBytes => _total; + + public void Append(ReadOnlySpan data) + { + _total += data.Length; + if (data.Length >= capacity) + { + data[^capacity..].CopyTo(_buffer); + _start = 0; + _count = capacity; + return; + } + + var end = (_start + _count) % capacity; + var firstPart = Math.Min(data.Length, capacity - end); + data[..firstPart].CopyTo(_buffer.AsSpan(end)); + data[firstPart..].CopyTo(_buffer); + + var overflow = _count + data.Length - capacity; + if (overflow > 0) + { + _start = (_start + overflow) % capacity; + _count = capacity; + } + else + { + _count += data.Length; + } + } + + public LogTail ToLogTail(SecretMasker masker) + { + var bytes = new byte[_count]; + var firstPart = Math.Min(_count, capacity - _start); + _buffer.AsSpan(_start, firstPart).CopyTo(bytes); + _buffer.AsSpan(0, _count - firstPart).CopyTo(bytes.AsSpan(firstPart)); + return new LogTail(masker.Mask(Encoding.UTF8.GetString(bytes)), _total > _count, _total); + } + + public async Task PumpAsync(Stream source, CancellationToken cancellationToken) + { + var chunk = new byte[16 * 1024]; + int read; + while ((read = await source.ReadAsync(chunk, cancellationToken).ConfigureAwait(false)) > 0) + { + Append(chunk.AsSpan(0, read)); + } + } +} + +/// Replaces secret values with *** in captured output. +internal sealed class SecretMasker(IEnumerable secrets) +{ + private const int MinimumLength = 3; + + private readonly string[] _values = [.. secrets + .Where(s => s.Length >= MinimumLength) + .Distinct(StringComparer.Ordinal) + .OrderByDescending(s => s.Length)]; + + public static SecretMasker None { get; } = new([]); + + public string Mask(string text) + { + foreach (var value in _values) + { + text = text.Replace(value, "***", StringComparison.Ordinal); + } + + return text; + } +} diff --git a/src/PythonScriptRunner.Core/Execution/OutputReader.cs b/src/PythonScriptRunner.Core/Execution/OutputReader.cs new file mode 100644 index 0000000..5f992ee --- /dev/null +++ b/src/PythonScriptRunner.Core/Execution/OutputReader.cs @@ -0,0 +1,202 @@ +using System.Security.Cryptography; +using System.Text.Json; +using System.Text.Json.Nodes; +using PythonScriptRunner.Core.Values; + +namespace PythonScriptRunner.Core.Execution; + +/// Reads output.json and validates outputs and output files against the stage contract. +internal static class OutputReader +{ + private const int WindowsStatusNoMemory = unchecked((int)0xC0000017); + + public static ExecutionResult Read(ExecutionRequest request, int exitCode, TimeSpan processDuration, LogTail stdout, LogTail stderr) + { + var result = ReadDocument(request, exitCode); + return result with { ExitCode = exitCode, ProcessDuration = processDuration, Stdout = stdout, Stderr = stderr }; + } + + private static ExecutionResult ReadDocument(ExecutionRequest request, int exitCode) + { + var document = TryLoad(Path.Combine(request.WorkDirectory, "output.json")); + if (document is null || !IsProtocolOne(document["protocol"])) + { + var kind = OperatingSystem.IsWindows() && exitCode == WindowsStatusNoMemory + ? ErrorKind.MemoryLimitExceeded + : ErrorKind.ProcessCrashed; + return ExecutionResult.Failure(kind, $"The Python process exited with code {exitCode} without a valid output.json (see stderr).", "NO_OUTPUT"); + } + + WireValidator.TryGetString(document["status"], out var status); + if (status == "error" && document["error"] is JsonObject error) + { + WireValidator.TryGetString(error["kind"], out var kindText); + WireValidator.TryGetString(error["message"], out var message); + WireValidator.TryGetString(error["code"], out var code); + WireValidator.TryGetString(error["traceback"], out var traceback); + var kind = Enum.TryParse(kindText, ignoreCase: false, out var parsed) ? parsed : ErrorKind.ScriptError; + return new ExecutionResult + { + Status = AttemptStatus.Failed, + Error = new RunError(kind, message.Length > 0 ? message : "The script failed.") + { + Code = code.Length > 0 ? code : null, + Traceback = traceback.Length > 0 ? traceback : null, + Details = error["details"]?.DeepClone(), + }, + }; + } + + if (status != "ok") + { + return ExecutionResult.Failure(ErrorKind.ProcessCrashed, $"output.json has an unknown status '{status}'.", "INVALID_OUTPUT"); + } + + return ValidateOutputs(request, document["outputs"] as JsonObject ?? []); + } + + private static ExecutionResult ValidateOutputs(ExecutionRequest request, JsonObject outputs) + { + var errors = new List(); + var declared = request.Stage.Outputs.Select(f => f.Name).ToHashSet(StringComparer.Ordinal); + errors.AddRange(outputs + .Where(p => !declared.Contains(p.Key)) + .Select(p => new WireError(p.Key, "UNDECLARED_OUTPUT", "output is not declared by the stage"))); + + var wire = new JsonObject(); + var files = new List(); + var budget = request.FileBudgetBytes; + foreach (var field in request.Stage.Outputs) + { + outputs.TryGetPropertyValue(field.Name, out var value); + if (value is null) + { + if (field.Required) + { + errors.Add(new(field.Name, "MISSING_REQUIRED_OUTPUT", "required output is missing")); + } + + continue; + } + + var before = errors.Count; + WireValidator.Validate(value, field, field.Name, errors); + if (errors.Count > before) + { + continue; + } + + if (!field.Type.IsFile) + { + wire[field.Name] = value.DeepClone(); + continue; + } + + var references = field.Type.Kind == FieldKind.List ? [.. value.AsArray()] : new List { value }; + var metadata = new JsonArray(); + for (var i = 0; i < references.Count; i++) + { + var path = field.Type.Kind == FieldKind.List ? $"{field.Name}[{i}]" : field.Name; + var file = ResolveFile(request, references[i]!.AsObject(), field.Name, i, path, ref budget, errors); + if (file is not null) + { + files.Add(file); + metadata.Add(new JsonObject + { + [WireValidator.FileMarker] = new JsonObject + { + ["name"] = file.FileName, + ["contentType"] = file.ContentType, + ["size"] = file.Size, + ["sha256"] = file.Sha256, + }, + }); + } + } + + wire[field.Name] = field.Type.Kind == FieldKind.List ? metadata : metadata.FirstOrDefault()?.DeepClone(); + } + + if (errors.Count == 0) + { + return new ExecutionResult { Status = AttemptStatus.Succeeded, Outputs = wire, Files = files }; + } + + var limit = errors.Any(e => e.Code is "FILE_TOO_LARGE" or "RUN_FILES_TOO_LARGE"); + return ExecutionResult.Failure( + limit ? ErrorKind.ArtifactLimitExceeded : ErrorKind.OutputContractViolation, + string.Join("; ", errors.Select(e => $"'{e.Path}': {e.Message}")), + errors[0].Code); + } + + private static OutputFile? ResolveFile( + ExecutionRequest request, JsonObject reference, string field, int index, string path, ref long budget, List errors) + { + var info = reference[WireValidator.FileMarker]!.AsObject(); + if (!WireValidator.TryGetString(info["path"], out var relative)) + { + errors.Add(new(path, "OUTPUT_FILE_MISSING", "file reference has no path")); + return null; + } + + var comparison = OperatingSystem.IsWindows() ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; + var outDirectory = Path.GetFullPath(Path.Combine(request.WorkDirectory, "out")) + Path.DirectorySeparatorChar; + var fullPath = Path.GetFullPath(Path.Combine(request.WorkDirectory, relative)); + if (!fullPath.StartsWith(outDirectory, comparison)) + { + errors.Add(new(path, "OUTPUT_FILE_OUTSIDE_OUT", "output files must be created inside out/")); + return null; + } + + var file = new FileInfo(fullPath); + if (!file.Exists) + { + errors.Add(new(path, "OUTPUT_FILE_MISSING", $"file was not written: {relative}")); + return null; + } + + if (file.LinkTarget is not null || file.Attributes.HasFlag(FileAttributes.ReparsePoint)) + { + errors.Add(new(path, "OUTPUT_FILE_OUTSIDE_OUT", "symbolic links are not allowed")); + return null; + } + + if (file.Length > request.MaxFileBytes) + { + errors.Add(new(path, "FILE_TOO_LARGE", $"file has {file.Length} bytes; the limit is {request.MaxFileBytes}")); + return null; + } + + budget -= file.Length; + if (budget < 0) + { + errors.Add(new(path, "RUN_FILES_TOO_LARGE", "the files of this run exceed the run limit")); + return null; + } + + string sha256; + using (var stream = file.OpenRead()) + { + sha256 = Convert.ToHexStringLower(SHA256.HashData(stream)); + } + + var name = WireValidator.TryGetString(info["name"], out var given) && given.Length > 0 ? Path.GetFileName(given) : file.Name; + var contentType = WireValidator.TryGetString(info["contentType"], out var type) && type.Length > 0 ? type : PsrFile.GuessContentType(name); + return new OutputFile(field, index, fullPath, name, contentType, file.Length, sha256); + } + + private static JsonObject? TryLoad(string path) + { + try + { + return File.Exists(path) ? JsonNode.Parse(File.ReadAllText(path)) as JsonObject : null; + } + catch (JsonException) + { + return null; + } + } + + private static bool IsProtocolOne(JsonNode? node) => + node is JsonValue value && value.GetValueKind() == JsonValueKind.Number && value.TryGetValue(out var protocol) && protocol == 1; +} diff --git a/src/PythonScriptRunner.Core/Execution/ProcessPythonExecutor.cs b/src/PythonScriptRunner.Core/Execution/ProcessPythonExecutor.cs new file mode 100644 index 0000000..4aec3be --- /dev/null +++ b/src/PythonScriptRunner.Core/Execution/ProcessPythonExecutor.cs @@ -0,0 +1,270 @@ +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json.Nodes; +using PythonScriptRunner.Core.Catalog; +using PythonScriptRunner.Core.Values; + +namespace PythonScriptRunner.Core.Execution; + +/// +/// Runs one attempt as a separate python -I -X utf8 -m psrunner.host process with a clean environment, +/// a timeout, cancellation, a memory limit and captured output (protocol version 1). +/// +internal sealed class ProcessPythonExecutor(TimeProvider time) : IPythonExecutor +{ + private const int ProtocolVersion = 1; + private static readonly TimeSpan KillWait = TimeSpan.FromSeconds(10); + private static readonly TimeSpan PumpWait = TimeSpan.FromSeconds(5); + + public async Task ExecuteAsync(ExecutionRequest request, CancellationToken cancellationToken) + { + var work = request.WorkDirectory; + foreach (var folder in (string[])["in", "out", "tmp"]) + { + Directory.CreateDirectory(Path.Combine(work, folder)); + } + + var inputs = CopyInputFiles(request); + await File.WriteAllTextAsync(Path.Combine(work, "input.json"), BuildInputDocument(request, inputs).ToJsonString(), cancellationToken) + .ConfigureAwait(false); + var scriptPath = await ResolveScriptAsync(request, cancellationToken).ConfigureAwait(false); + + var masker = new SecretMasker(request.Secrets.Values); + var stdout = new TailBuffer(request.MaxLogBytes); + var stderr = new TailBuffer(request.MaxLogBytes); + using var process = new Process { StartInfo = BuildStartInfo(request, scriptPath) }; + var job = OperatingSystem.IsWindows() ? new WindowsJobObject(request.MemoryLimitMb * 1024L * 1024L) : null; + try + { + var started = time.GetTimestamp(); + try + { + process.Start(); + } + catch (Win32Exception ex) + { + return ExecutionResult.Failure(ErrorKind.ProcessCrashed, $"Could not start Python ({request.Environment.PythonExecutable}): {ex.Message}", "START_FAILED"); + } + + if (job is not null && OperatingSystem.IsWindows()) + { + job.Assign(process.Handle); + } + + process.StandardInput.Close(); + var pumps = Task.WhenAll( + PumpAsync(stdout, process.StandardOutput.BaseStream), + PumpAsync(stderr, process.StandardError.BaseStream)); + + AttemptStatus? stoppedAs = null; + using (var timeout = new CancellationTokenSource(request.Timeout, time)) + using (var linked = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeout.Token)) + { + try + { + await process.WaitForExitAsync(linked.Token).ConfigureAwait(false); + } + catch (OperationCanceledException) + { + stoppedAs = cancellationToken.IsCancellationRequested ? AttemptStatus.Cancelled : AttemptStatus.TimedOut; + await KillAsync(process, job).ConfigureAwait(false); + } + } + + var processDuration = time.GetElapsedTime(started); + if (job is not null && OperatingSystem.IsWindows()) + { + job.Dispose(); + job = null; + } + + try + { + await pumps.WaitAsync(PumpWait, CancellationToken.None).ConfigureAwait(false); + } + catch (TimeoutException) + { + // A grandchild still holds the pipes open; keep what was captured so far. + } + + var stdoutTail = stdout.ToLogTail(masker); + var stderrTail = stderr.ToLogTail(masker); + var exitCode = process.HasExited ? process.ExitCode : -1; + return stoppedAs switch + { + AttemptStatus.Cancelled => Stopped(ErrorKind.Cancelled, "The run was cancelled.", AttemptStatus.Cancelled), + AttemptStatus.TimedOut => Stopped(ErrorKind.Timeout, $"The attempt exceeded its timeout of {request.Timeout}.", AttemptStatus.TimedOut), + _ => OutputReader.Read(request, exitCode, processDuration, stdoutTail, stderrTail), + }; + + ExecutionResult Stopped(ErrorKind kind, string message, AttemptStatus status) => + ExecutionResult.Failure(kind, message, status: status) with + { + ExitCode = exitCode, + ProcessDuration = processDuration, + Stdout = stdoutTail, + Stderr = stderrTail, + }; + } + finally + { + if (job is not null && OperatingSystem.IsWindows()) + { + job.Dispose(); + } + } + } + + private static async Task PumpAsync(TailBuffer buffer, Stream source) + { + try + { + await buffer.PumpAsync(source, CancellationToken.None).ConfigureAwait(false); + } + catch (Exception ex) when (ex is IOException or ObjectDisposedException or OperationCanceledException) + { + // The process was killed or the stream was closed: keep what was captured. + } + } + + private static async Task KillAsync(Process process, WindowsJobObject? job) + { + if (job is not null && OperatingSystem.IsWindows()) + { + job.Terminate(); + } + + try + { + process.Kill(entireProcessTree: true); + } + catch (Exception ex) when (ex is InvalidOperationException or Win32Exception or NotSupportedException) + { + // Already exited. + } + + using var wait = new CancellationTokenSource(KillWait); + try + { + await process.WaitForExitAsync(wait.Token).ConfigureAwait(false); + } + catch (OperationCanceledException) + { + // Give up waiting; the attempt is reported as stopped anyway. + } + } + + /// Copies input files to in/<field>/<index>/<name> and returns the inputs with full file references. + private static JsonObject CopyInputFiles(ExecutionRequest request) + { + var inputs = (JsonObject)request.Inputs.DeepClone(); + foreach (var group in request.Files.GroupBy(f => f.Field)) + { + var field = request.Stage.Inputs.First(f => f.Name == group.Key); + var references = new JsonArray(); + foreach (var file in group.OrderBy(f => f.Index)) + { + var relative = $"in/{file.Field}/{file.Index.ToString(CultureInfo.InvariantCulture)}/{file.FileName}"; + var target = Path.Combine(request.WorkDirectory, relative); + Directory.CreateDirectory(Path.GetDirectoryName(target)!); + File.Copy(file.SourcePath, target, overwrite: true); + references.Add(new JsonObject + { + [WireValidator.FileMarker] = new JsonObject + { + ["path"] = relative, + ["name"] = file.FileName, + ["contentType"] = file.ContentType, + ["size"] = file.Size, + ["sha256"] = file.Sha256, + }, + }); + } + + inputs[group.Key] = field.Type.Kind == FieldKind.List ? references : references[0]!.DeepClone(); + } + + return inputs; + } + + private static JsonObject BuildInputDocument(ExecutionRequest request, JsonObject inputs) => new() + { + ["protocol"] = ProtocolVersion, + ["context"] = new JsonObject + { + ["runId"] = request.RunId.ToString(), + ["stepKey"] = request.StepKey, + ["attempt"] = request.Attempt, + ["stage"] = new JsonObject { ["key"] = request.Stage.Key, ["version"] = request.Stage.Version }, + ["isTest"] = request.IsTest, + ["inputFields"] = FieldDefinitionJson.ToJson(request.Stage.Inputs), + ["outputFields"] = FieldDefinitionJson.ToJson(request.Stage.Outputs), + }, + ["inputs"] = inputs, + }; + + private static async Task ResolveScriptAsync(ExecutionRequest request, CancellationToken cancellationToken) + { + switch (request.Stage.Script) + { + case FileScriptSource file: + return file.Path; + case InlineScriptSource inline: + var path = Path.Combine(request.WorkDirectory, "script.py"); + await File.WriteAllTextAsync(path, inline.Content, cancellationToken).ConfigureAwait(false); + return path; + default: + throw new NotSupportedException($"Unsupported script source {request.Stage.Script.GetType().Name}."); + } + } + + private static ProcessStartInfo BuildStartInfo(ExecutionRequest request, string scriptPath) + { + var work = request.WorkDirectory; + var temp = Path.Combine(work, "tmp"); + var startInfo = new ProcessStartInfo(request.Environment.PythonExecutable) + { + UseShellExecute = false, + CreateNoWindow = true, + RedirectStandardInput = true, + RedirectStandardOutput = true, + RedirectStandardError = true, + WorkingDirectory = work, + }; + foreach (var argument in (string[])["-I", "-X", "utf8", "-m", "psrunner.host"]) + { + startInfo.ArgumentList.Add(argument); + } + + var environment = startInfo.Environment; + environment.Clear(); + if (OperatingSystem.IsWindows()) + { + var systemRoot = Environment.GetEnvironmentVariable("SystemRoot") ?? @"C:\Windows"; + environment["SystemRoot"] = systemRoot; + environment["PATH"] = $"{Path.Combine(systemRoot, "System32")};{systemRoot}"; + } + else + { + environment["PATH"] = "/usr/local/bin:/usr/bin:/bin"; + environment["HOME"] = temp; + environment["TMPDIR"] = temp; + } + + environment["TEMP"] = temp; + environment["TMP"] = temp; + environment["PSR_PROTOCOL"] = ProtocolVersion.ToString(CultureInfo.InvariantCulture); + environment["PSR_INPUT"] = Path.Combine(work, "input.json"); + environment["PSR_OUTPUT"] = Path.Combine(work, "output.json"); + environment["PSR_WORK_DIR"] = work; + environment["PSR_SCRIPT"] = scriptPath; + environment["PSR_MEMORY_LIMIT_MB"] = request.MemoryLimitMb.ToString(CultureInfo.InvariantCulture); + foreach (var (name, value) in request.Secrets) + { + environment[$"PSR_SECRET_{name}"] = value; + } + + return startInfo; + } +} diff --git a/src/PythonScriptRunner.Core/Execution/WindowsJobObject.cs b/src/PythonScriptRunner.Core/Execution/WindowsJobObject.cs new file mode 100644 index 0000000..51068f5 --- /dev/null +++ b/src/PythonScriptRunner.Core/Execution/WindowsJobObject.cs @@ -0,0 +1,125 @@ +using System.Runtime.InteropServices; +using System.Runtime.Versioning; +using Microsoft.Win32.SafeHandles; + +namespace PythonScriptRunner.Core.Execution; + +/// +/// Windows Job Object that limits the memory of each process and kills the whole process tree +/// when the job is terminated or closed. +/// +[SupportedOSPlatform("windows")] +internal sealed class WindowsJobObject : IDisposable +{ + private const int JobObjectExtendedLimitInformation = 9; + private const uint LimitProcessMemory = 0x00000100; + private const uint LimitKillOnJobClose = 0x00002000; + + private readonly SafeJobHandle _handle; + + public WindowsJobObject(long processMemoryLimitBytes) + { + _handle = NativeMethods.CreateJobObject(IntPtr.Zero, null); + if (_handle.IsInvalid) + { + throw new InvalidOperationException($"CreateJobObject failed ({Marshal.GetLastPInvokeError()})."); + } + + var info = new ExtendedLimitInformation + { + BasicLimitInformation = new BasicLimitInformation { LimitFlags = LimitKillOnJobClose }, + }; + if (processMemoryLimitBytes > 0) + { + info.BasicLimitInformation.LimitFlags |= LimitProcessMemory; + info.ProcessMemoryLimit = (nuint)processMemoryLimitBytes; + } + + if (!NativeMethods.SetInformationJobObject(_handle, JobObjectExtendedLimitInformation, ref info, (uint)Marshal.SizeOf())) + { + var error = Marshal.GetLastPInvokeError(); + _handle.Dispose(); + throw new InvalidOperationException($"SetInformationJobObject failed ({error})."); + } + } + + public void Assign(IntPtr processHandle) + { + if (!NativeMethods.AssignProcessToJobObject(_handle, processHandle)) + { + throw new InvalidOperationException($"AssignProcessToJobObject failed ({Marshal.GetLastPInvokeError()})."); + } + } + + public void Terminate() => NativeMethods.TerminateJobObject(_handle, 1); + + public void Dispose() => _handle.Dispose(); + + [StructLayout(LayoutKind.Sequential)] + private struct BasicLimitInformation + { + public long PerProcessUserTimeLimit; + public long PerJobUserTimeLimit; + public uint LimitFlags; + public nuint MinimumWorkingSetSize; + public nuint MaximumWorkingSetSize; + public uint ActiveProcessLimit; + public nuint Affinity; + public uint PriorityClass; + public uint SchedulingClass; + } + + [StructLayout(LayoutKind.Sequential)] + private struct IoCounters + { + public ulong ReadOperationCount; + public ulong WriteOperationCount; + public ulong OtherOperationCount; + public ulong ReadTransferCount; + public ulong WriteTransferCount; + public ulong OtherTransferCount; + } + + [StructLayout(LayoutKind.Sequential)] + private struct ExtendedLimitInformation + { + public BasicLimitInformation BasicLimitInformation; + public IoCounters IoInfo; + public nuint ProcessMemoryLimit; + public nuint JobMemoryLimit; + public nuint PeakProcessMemoryUsed; + public nuint PeakJobMemoryUsed; + } + + private sealed class SafeJobHandle() : SafeHandleZeroOrMinusOneIsInvalid(ownsHandle: true) + { + protected override bool ReleaseHandle() => NativeMethods.CloseHandle(handle); + } + + private static class NativeMethods + { + [DllImport("kernel32.dll", EntryPoint = "CreateJobObjectW", CharSet = CharSet.Unicode, SetLastError = true)] + [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] + public static extern SafeJobHandle CreateJobObject(IntPtr jobAttributes, string? name); + + [DllImport("kernel32.dll", SetLastError = true)] + [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SetInformationJobObject(SafeJobHandle job, int infoClass, ref ExtendedLimitInformation info, uint length); + + [DllImport("kernel32.dll", SetLastError = true)] + [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool AssignProcessToJobObject(SafeJobHandle job, IntPtr process); + + [DllImport("kernel32.dll", SetLastError = true)] + [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool TerminateJobObject(SafeJobHandle job, uint exitCode); + + [DllImport("kernel32.dll", SetLastError = true)] + [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool CloseHandle(IntPtr handle); + } +} diff --git a/src/PythonScriptRunner.Core/PythonScriptRunner.Core.csproj b/src/PythonScriptRunner.Core/PythonScriptRunner.Core.csproj new file mode 100644 index 0000000..888109e --- /dev/null +++ b/src/PythonScriptRunner.Core/PythonScriptRunner.Core.csproj @@ -0,0 +1,30 @@ + + + + PythonScriptRunner + Runs Python stages from .NET with typed inputs/outputs, isolated processes, uv-managed environments and retries. + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/PythonScriptRunner.Core/PythonScriptRunnerOptions.cs b/src/PythonScriptRunner.Core/PythonScriptRunnerOptions.cs new file mode 100644 index 0000000..6ac3086 --- /dev/null +++ b/src/PythonScriptRunner.Core/PythonScriptRunnerOptions.cs @@ -0,0 +1,51 @@ +namespace PythonScriptRunner; + +/// Settings of the Python runner. +public sealed class PythonScriptRunnerOptions +{ + /// Folder for work and result directories. Default: %TEMP%/psr. + public string WorkRoot { get; set; } = Path.Combine(Path.GetTempPath(), "psr"); + + /// Folder where Python environments (venvs) and lock files are cached. + public string EnvironmentCacheRoot { get; set; } = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData, Environment.SpecialFolderOption.Create), "psr"); + + /// Path or name of the uv executable. Default: uv (searched in PATH). + public string UvPath { get; set; } = "uv"; + + /// Python version of stages that do not declare one. Default: 3.12. + public string DefaultPythonVersion { get; set; } = "3.12"; + + /// Timeout of stages that do not declare one. Default: 5 minutes. + public TimeSpan DefaultTimeout { get; set; } = TimeSpan.FromMinutes(5); + + /// Memory limit (MB) of stages that do not declare one. Default: 1024. + public int DefaultMemoryLimitMb { get; set; } = 1024; + + /// Maximum size of one file. Default: 50 MB. + public long MaxFileBytes { get; set; } = 50L * 1024 * 1024; + + /// Maximum size of all files of one run. Default: 200 MB. + public long MaxRunFilesBytes { get; set; } = 200L * 1024 * 1024; + + /// Bytes of stdout/stderr kept per attempt (the tail). Default: 1 MB. + public int MaxLogBytes { get; set; } = 1024 * 1024; + + /// Maximum number of Python processes running at the same time. Default: processor count. + public int MaxConcurrentProcesses { get; set; } = Environment.ProcessorCount; + + /// Package index (pip --index-url). Default: PyPI. + public string? PackageIndexUrl { get; set; } + + /// Extra package indexes (pip --extra-index-url). + public IList ExtraIndexUrls { get; } = []; + + /// + /// The psrunner SDK installed in every environment: a pip requirement + /// (default psrunner==0.1.0) or the path of a local wheel. + /// + public string PsrunnerRequirement { get; set; } = "psrunner==0.1.0"; + + /// Age after which leftover work and result folders are deleted. Default: 24 hours. + public TimeSpan OrphanRetention { get; set; } = TimeSpan.FromHours(24); +} diff --git a/src/PythonScriptRunner.Core/Running/Infrastructure.cs b/src/PythonScriptRunner.Core/Running/Infrastructure.cs new file mode 100644 index 0000000..1133cbc --- /dev/null +++ b/src/PythonScriptRunner.Core/Running/Infrastructure.cs @@ -0,0 +1,40 @@ +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Options; +using PythonScriptRunner.Core.Catalog; + +namespace PythonScriptRunner.Core.Running; + +/// Default recorder: nothing is persisted without the EF package. +internal sealed class NullRunRecorder : IRunRecorder +{ + public ValueTask RunStartedAsync(RunStarted run, CancellationToken cancellationToken) => ValueTask.CompletedTask; + + public ValueTask AttemptFinishedAsync(AttemptFinished attempt, CancellationToken cancellationToken) => ValueTask.CompletedTask; + + public ValueTask RunFinishedAsync(RunFinished run, CancellationToken cancellationToken) => ValueTask.CompletedTask; +} + +/// Reads secrets from PythonScriptRunner:Secrets:<NAME> (user-secrets, environment variables, Key Vault...). +internal sealed class ConfigurationSecretProvider(IConfiguration? configuration = null) : ISecretProvider +{ + public const string Section = "PythonScriptRunner:Secrets"; + + public ValueTask GetSecretAsync(string name, CancellationToken cancellationToken = default) => + ValueTask.FromResult(configuration?[$"{Section}:{name}"]); +} + +/// Fails fast when the host starts: validates options, loads catalogs and removes leftover folders. +internal sealed class PythonScriptRunnerStartup( + IOptions options, ICatalog catalog, WorkspaceJanitor janitor) : IHostedService +{ + public Task StartAsync(CancellationToken cancellationToken) + { + _ = options.Value; + (catalog as CompositeCatalog)?.EnsureLoaded(); + janitor.EnsureCleaned(); + return Task.CompletedTask; + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; +} diff --git a/src/PythonScriptRunner.Core/Running/PythonRunner.cs b/src/PythonScriptRunner.Core/Running/PythonRunner.cs new file mode 100644 index 0000000..fd5ca23 --- /dev/null +++ b/src/PythonScriptRunner.Core/Running/PythonRunner.cs @@ -0,0 +1,403 @@ +using System.Diagnostics; +using System.Security.Cryptography; +using System.Text.Json.Nodes; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using PythonScriptRunner.Core.Diagnostics; +using PythonScriptRunner.Core.Execution; +using PythonScriptRunner.Core.Values; + +namespace PythonScriptRunner.Core.Running; + +/// Runs stages in the current process: validation, secrets, environment, attempts with retry. +internal sealed class PythonRunner : IPythonRunner, IDisposable +{ + private readonly ICatalog _catalog; + private readonly IEnvironmentManager _environments; + private readonly IPythonExecutor _executor; + private readonly ISecretProvider _secrets; + private readonly IRunRecorder _recorder; + private readonly IOptions _options; + private readonly PsrMetrics _metrics; + private readonly TimeProvider _time; + private readonly WorkspaceJanitor _janitor; + private readonly ILogger _logger; + private readonly ILogger _scriptLogger; + private readonly Lazy _concurrency; + + public PythonRunner( + ICatalog catalog, + IEnvironmentManager environments, + IPythonExecutor executor, + ISecretProvider secrets, + IRunRecorder recorder, + IOptions options, + PsrMetrics metrics, + TimeProvider time, + WorkspaceJanitor janitor, + ILoggerFactory loggerFactory) + { + _catalog = catalog; + _environments = environments; + _executor = executor; + _secrets = secrets; + _recorder = recorder; + _options = options; + _metrics = metrics; + _time = time; + _janitor = janitor; + _logger = loggerFactory.CreateLogger(); + _scriptLogger = loggerFactory.CreateLogger("PythonScriptRunner.Script"); + _concurrency = new(() => new SemaphoreSlim(Settings.MaxConcurrentProcesses)); + } + + private PythonScriptRunnerOptions Settings + { + get + { + try + { + return _options.Value; + } + catch (OptionsValidationException ex) + { + throw new PsrConfigurationException(ex.Message, ex); + } + } + } + + public async Task RunStageAsync( + string stageKey, object? inputs, RunOptions? options = null, CancellationToken cancellationToken = default) + { + ArgumentException.ThrowIfNullOrWhiteSpace(stageKey); + var settings = Settings; + _janitor.EnsureCleaned(); + var stage = await ResolveStageAsync(stageKey, options?.Version, cancellationToken).ConfigureAwait(false); + var bound = InputBinder.Bind(stage.Inputs, inputs, settings.MaxFileBytes); + cancellationToken.ThrowIfCancellationRequested(); + + var runId = RunId.New(); + var started = _time.GetTimestamp(); + await _recorder.RunStartedAsync( + new RunStarted(runId, RunKind.Stage, stage.Key, stage.Version, options?.TriggeredBy ?? "system:library", _time.GetUtcNow(), (JsonObject)bound.Wire.DeepClone()), + cancellationToken).ConfigureAwait(false); + + var workspace = new RunWorkspace(settings.WorkRoot, runId); + try + { + var step = await ExecuteStepAsync(stage, stage.Key, 1, bound, workspace, runId, settings, cancellationToken).ConfigureAwait(false); + var status = step.Status switch + { + StepStatus.Succeeded => RunStatus.Succeeded, + StepStatus.Cancelled => RunStatus.Cancelled, + _ => RunStatus.Failed, + }; + await _recorder.RunFinishedAsync(new RunFinished(runId, status, _time.GetUtcNow(), step.Outputs, step.Error), CancellationToken.None) + .ConfigureAwait(false); + return new RunResult(runId, RunKind.Stage, status, _time.GetElapsedTime(started), [step], step.Outputs, step.Files, step.Error, workspace.DeleteResultsAsync); + } + catch + { + await workspace.DeleteResultsAsync().ConfigureAwait(false); + throw; + } + finally + { + workspace.DeleteRun(); + } + } + + public void Dispose() + { + if (_concurrency.IsValueCreated) + { + _concurrency.Value.Dispose(); + } + } + + private async Task ResolveStageAsync(string key, int? version, CancellationToken cancellationToken) + { + var stage = await _catalog.FindStageAsync(key, version, cancellationToken).ConfigureAwait(false); + if (stage is not null) + { + return stage; + } + + if (version is { } requested && await _catalog.FindStageAsync(key, null, cancellationToken).ConfigureAwait(false) is not null) + { + throw new VersionNotFoundException(key, requested); + } + + throw new StageNotFoundException(key); + } + + private async Task ExecuteStepAsync( + StageDefinition stage, + string stepKey, + int order, + BoundInputs bound, + RunWorkspace workspace, + RunId runId, + PythonScriptRunnerOptions settings, + CancellationToken cancellationToken) + { + var attempts = new List(); + StepResult Finish(StepStatus status, RunError? error, AttemptOutcome? success = null) => new() + { + StepKey = stepKey, + Order = order, + StageKey = stage.Key, + StageVersion = stage.Version, + Status = status, + Attempts = attempts, + Outputs = success?.Outputs, + Files = success?.Files ?? new Dictionary>(), + Error = error is null ? null : error with { StepKey = stepKey }, + }; + + IReadOnlyList files; + try + { + files = await MaterializeInputsAsync(bound.Files, workspace, cancellationToken).ConfigureAwait(false); + } + catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested) + { + return Finish(StepStatus.Cancelled, new RunError(ErrorKind.Cancelled, "The run was cancelled.")); + } + + var inputBytes = files.Sum(f => f.Size); + if (inputBytes > settings.MaxRunFilesBytes) + { + return Finish(StepStatus.Failed, new RunError(ErrorKind.ArtifactLimitExceeded, "The input files exceed the run limit.") { Code = "RUN_FILES_TOO_LARGE" }); + } + + for (var number = 1; ; number++) + { + var cause = number == 1 ? AttemptCause.Initial : AttemptCause.AutoRetry; + var outcome = await RunAttemptAsync(stage, stepKey, number, cause, bound, files, workspace, runId, settings, settings.MaxRunFilesBytes - inputBytes, cancellationToken) + .ConfigureAwait(false); + attempts.Add(outcome.Attempt); + await _recorder.AttemptFinishedAsync(new AttemptFinished(runId, stepKey, outcome.Attempt), CancellationToken.None).ConfigureAwait(false); + + switch (outcome.Attempt.Status) + { + case AttemptStatus.Succeeded: + return Finish(StepStatus.Succeeded, null, outcome); + case AttemptStatus.Cancelled: + return Finish(StepStatus.Cancelled, outcome.Attempt.Error); + } + + var error = outcome.Attempt.Error!; + Log.AttemptFailed(_logger, stage.Key, number, error.Kind, error.Message); + if (number > stage.Retry.MaxAttempts) + { + return Finish(outcome.Attempt.Status == AttemptStatus.TimedOut ? StepStatus.TimedOut : StepStatus.Failed, error); + } + + var delay = stage.Retry.GetDelay(number); + Log.RetryScheduled(_logger, stage.Key, delay, number + 1); + try + { + await Task.Delay(delay, _time, cancellationToken).ConfigureAwait(false); + } + catch (OperationCanceledException) + { + return Finish(StepStatus.Cancelled, new RunError(ErrorKind.Cancelled, "The run was cancelled while waiting to retry.")); + } + } + } + + private async Task RunAttemptAsync( + StageDefinition stage, + string stepKey, + int number, + AttemptCause cause, + BoundInputs bound, + IReadOnlyList files, + RunWorkspace workspace, + RunId runId, + PythonScriptRunnerOptions settings, + long fileBudget, + CancellationToken cancellationToken) + { + var startedAt = _time.GetUtcNow(); + var started = _time.GetTimestamp(); + var queued = TimeSpan.Zero; + string? environmentHash = null; + var workDirectory = workspace.AttemptDirectory(stepKey, number); + + using var activity = PsrDiagnostics.Source.StartActivity("psr.stage.execute"); + activity?.SetTag("psr.stage.key", stage.Key); + activity?.SetTag("psr.stage.version", stage.Version); + activity?.SetTag("psr.run.id", runId.ToString()); + activity?.SetTag("psr.step.key", stepKey); + activity?.SetTag("psr.attempt", number); + + ExecutionResult execution; + try + { + var (secrets, missing) = await ResolveSecretsAsync(stage, cancellationToken).ConfigureAwait(false); + if (missing.Count > 0) + { + execution = ExecutionResult.Failure(ErrorKind.SecretNotFound, $"Secrets not configured: {string.Join(", ", missing)}.", "SECRET_NOT_FOUND"); + } + else + { + var environment = await _environments.EnsureAsync(stage, cancellationToken).ConfigureAwait(false); + environmentHash = environment.Hash; + var waitStarted = _time.GetTimestamp(); + await _concurrency.Value.WaitAsync(cancellationToken).ConfigureAwait(false); + queued = _time.GetElapsedTime(waitStarted); + try + { + execution = await _executor.ExecuteAsync( + new ExecutionRequest + { + Stage = stage, + Environment = environment, + RunId = runId, + StepKey = stepKey, + Attempt = number, + WorkDirectory = workDirectory, + Inputs = bound.Wire, + Files = files, + Secrets = secrets, + Timeout = stage.Timeout ?? settings.DefaultTimeout, + MemoryLimitMb = stage.MemoryLimitMb ?? settings.DefaultMemoryLimitMb, + MaxFileBytes = settings.MaxFileBytes, + FileBudgetBytes = fileBudget, + MaxLogBytes = settings.MaxLogBytes, + }, + cancellationToken).ConfigureAwait(false); + } + finally + { + _concurrency.Value.Release(); + } + } + } + catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested) + { + execution = ExecutionResult.Failure(ErrorKind.Cancelled, "The run was cancelled.", status: AttemptStatus.Cancelled); + } + catch (PythonEnvironmentException ex) + { + execution = ExecutionResult.Failure(ErrorKind.EnvironmentSetupFailed, ex.Message, "ENVIRONMENT_SETUP_FAILED"); + } + + try + { + var outputFiles = execution.Status == AttemptStatus.Succeeded + ? MoveOutputs(execution.Files, workspace, stepKey) + : new Dictionary>(); + var duration = _time.GetElapsedTime(started); + var overhead = duration - execution.ProcessDuration - queued; + var attempt = new AttemptResult + { + Id = AttemptId.New(), + Number = number, + Cause = cause, + Status = execution.Status, + StartedAt = startedAt, + Duration = duration, + Overhead = overhead < TimeSpan.Zero ? TimeSpan.Zero : overhead, + ExitCode = execution.ExitCode, + Error = execution.Error, + Stdout = execution.Stdout, + Stderr = execution.Stderr, + EnvironmentHash = environmentHash, + }; + + ForwardOutput(stage.Key, attempt); + _metrics.AttemptFinished(stage.Key, attempt); + activity?.SetStatus(attempt.Status == AttemptStatus.Succeeded ? ActivityStatusCode.Ok : ActivityStatusCode.Error, attempt.Error?.Message); + return new AttemptOutcome(attempt, execution.Outputs, outputFiles); + } + finally + { + RunWorkspace.TryDelete(workDirectory); + } + } + + private async Task<(IReadOnlyDictionary Values, List Missing)> ResolveSecretsAsync( + StageDefinition stage, CancellationToken cancellationToken) + { + var values = new Dictionary(StringComparer.Ordinal); + var missing = new List(); + foreach (var name in stage.RequiredSecrets) + { + var value = await _secrets.GetSecretAsync(name, cancellationToken).ConfigureAwait(false); + if (string.IsNullOrEmpty(value)) + { + missing.Add(name); + } + else + { + values[name] = value; + } + } + + return (values, missing); + } + + private static async Task> MaterializeInputsAsync( + IReadOnlyList files, RunWorkspace workspace, CancellationToken cancellationToken) + { + var copies = new List(files.Count); + foreach (var bound in files) + { + var name = RunWorkspace.SafeFileName(bound.File.FileName); + var target = Path.Combine(workspace.InputsDirectory, bound.Field, bound.Index.ToString(System.Globalization.CultureInfo.InvariantCulture), name); + Directory.CreateDirectory(Path.GetDirectoryName(target)!); + await bound.File.SaveAsAsync(target, cancellationToken).ConfigureAwait(false); + + string sha256; + long size; + await using (var stream = File.OpenRead(target)) + { + size = stream.Length; + sha256 = Convert.ToHexStringLower(await SHA256.HashDataAsync(stream, cancellationToken).ConfigureAwait(false)); + } + + copies.Add(new InputFileCopy(bound.Field, bound.Index, target, name, bound.File.ContentType, size, sha256)); + } + + return copies; + } + + private static Dictionary> MoveOutputs(IReadOnlyList files, RunWorkspace workspace, string stepKey) + { + var result = new Dictionary>(StringComparer.Ordinal); + foreach (var group in files.GroupBy(f => f.Field)) + { + var list = new List(); + foreach (var file in group.OrderBy(f => f.Index)) + { + var name = RunWorkspace.SafeFileName(file.FileName); + var target = Path.Combine(workspace.ResultsDirectory, stepKey, file.Field, file.Index.ToString(System.Globalization.CultureInfo.InvariantCulture), name); + Directory.CreateDirectory(Path.GetDirectoryName(target)!); + File.Move(file.FullPath, target, overwrite: true); + list.Add(PsrFile.FromProducedFile(target, name, file.ContentType, file.Sha256)); + } + + result[group.Key] = list; + } + + return result; + } + + private void ForwardOutput(string stageKey, AttemptResult attempt) + { + if (attempt.Stdout.Content.Length > 0) + { + Log.ScriptStdout(_scriptLogger, stageKey, attempt.Number, attempt.Stdout.Content); + } + + if (attempt.Stderr.Content.Length > 0) + { + Log.ScriptStderr(_scriptLogger, stageKey, attempt.Number, attempt.Stderr.Content); + } + } + + private sealed record AttemptOutcome(AttemptResult Attempt, JsonObject? Outputs, IReadOnlyDictionary> Files); +} diff --git a/src/PythonScriptRunner.Core/Running/RunWorkspace.cs b/src/PythonScriptRunner.Core/Running/RunWorkspace.cs new file mode 100644 index 0000000..23f27fd --- /dev/null +++ b/src/PythonScriptRunner.Core/Running/RunWorkspace.cs @@ -0,0 +1,95 @@ +using System.Globalization; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using PythonScriptRunner.Core.Diagnostics; + +namespace PythonScriptRunner.Core.Running; + +/// Folders of one run: runs/<id> (work, deleted at the end) and results/<id> (kept until the result is disposed). +internal sealed class RunWorkspace(string workRoot, RunId runId) +{ + public string RunDirectory { get; } = Path.Combine(workRoot, "runs", runId.ToString()); + + public string ResultsDirectory { get; } = Path.Combine(workRoot, "results", runId.ToString()); + + public string InputsDirectory => Path.Combine(RunDirectory, "inputs"); + + public string AttemptDirectory(string stepKey, int attempt) => + Path.Combine(RunDirectory, stepKey, attempt.ToString(CultureInfo.InvariantCulture)); + + public void DeleteRun() => TryDelete(RunDirectory); + + public ValueTask DeleteResultsAsync() + { + TryDelete(ResultsDirectory); + return ValueTask.CompletedTask; + } + + public static void TryDelete(string directory) + { + try + { + if (Directory.Exists(directory)) + { + Directory.Delete(directory, recursive: true); + } + } + catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) + { + // Best effort: leftovers are removed by WorkspaceJanitor. + } + } + + /// A file name safe for every file system (no folders, no invalid characters). + public static string SafeFileName(string name) + { + var invalid = Path.GetInvalidFileNameChars(); + var cleaned = new string([.. Path.GetFileName(name).Select(c => invalid.Contains(c) || c is '/' or '\\' or ':' ? '_' : c)]).Trim(); + if (cleaned.Length is 0 || cleaned is "." or "..") + { + return "file"; + } + + return cleaned.Length <= 120 ? cleaned : cleaned[..60] + cleaned[^60..]; + } +} + +/// Removes work and result folders left behind by crashed processes (older than the retention). +internal sealed class WorkspaceJanitor(IOptions options, TimeProvider time, ILogger logger) +{ + private int _cleaned; + + public void EnsureCleaned() + { + if (Interlocked.Exchange(ref _cleaned, 1) == 1) + { + return; + } + + var settings = options.Value; + var cutoff = (time.GetUtcNow() - settings.OrphanRetention).UtcDateTime; + var removed = 0; + foreach (var area in (string[])["runs", "results"]) + { + var folder = Path.Combine(settings.WorkRoot, area); + if (!Directory.Exists(folder)) + { + continue; + } + + foreach (var child in Directory.EnumerateDirectories(folder)) + { + if (Directory.GetLastWriteTimeUtc(child) < cutoff) + { + RunWorkspace.TryDelete(child); + removed++; + } + } + } + + if (removed > 0) + { + Log.OrphansRemoved(logger, removed, settings.OrphanRetention); + } + } +} diff --git a/src/PythonScriptRunner.Core/Values/InputBinder.cs b/src/PythonScriptRunner.Core/Values/InputBinder.cs new file mode 100644 index 0000000..027202e --- /dev/null +++ b/src/PythonScriptRunner.Core/Values/InputBinder.cs @@ -0,0 +1,248 @@ +using System.Collections; +using System.Globalization; +using System.Reflection; +using System.Text.Json; +using System.Text.Json.Nodes; + +namespace PythonScriptRunner.Core.Values; + +/// An input file of a run (field, position in a list, file). +internal sealed record BoundFile(string Field, int Index, PsrFile File); + +/// Validated inputs: wire values plus the files to materialize. +/// Inputs in wire format; files carry metadata only (name, content type). +/// Input files. +internal sealed record BoundInputs(JsonObject Wire, IReadOnlyList Files); + +/// Converts the caller's inputs (.NET values) to the wire format and validates the contract. +internal static class InputBinder +{ + public static BoundInputs Bind(IReadOnlyList fields, object? inputs, long maxFileBytes) + { + var raw = ReadMembers(inputs); + var errors = new List(); + var declared = fields.Select(f => f.Name).ToHashSet(StringComparer.Ordinal); + errors.AddRange(raw.Keys + .Where(name => !declared.Contains(name)) + .Order(StringComparer.Ordinal) + .Select(name => new InputError(name, "UNDECLARED_INPUT", "input is not declared by the stage"))); + + var wire = new JsonObject(); + var files = new List(); + foreach (var field in fields) + { + raw.TryGetValue(field.Name, out var value); + if (value is null) + { + if (field.Default is not null) + { + wire[field.Name] = field.Default.DeepClone(); + } + else if (field.Required) + { + errors.Add(new(field.Name, "MISSING_REQUIRED_INPUT", "required input is missing")); + } + + continue; + } + + if (field.Type.IsFile) + { + var node = BindFiles(field, value, maxFileBytes, files, errors); + if (node is not null) + { + wire[field.Name] = node; + } + + continue; + } + + var converted = ToWire(value, field.Type, field.Name, errors); + if (converted is null) + { + continue; + } + + var wireErrors = new List(); + WireValidator.Validate(converted, field, field.Name, wireErrors); + errors.AddRange(wireErrors.Select(e => new InputError(e.Path, e.Code, e.Message))); + wire[field.Name] = converted; + } + + return errors.Count > 0 ? throw new InputValidationException(errors) : new BoundInputs(wire, files); + } + + private static JsonNode? BindFiles(FieldDefinition field, object value, long maxFileBytes, List files, List errors) + { + var isList = field.Type.Kind == FieldKind.List; + PsrFile[]? given = value switch + { + PsrFile single when !isList => [single], + IEnumerable many when isList => [.. many], + _ => null, + }; + if (given is null) + { + errors.Add(new(field.Name, "TYPE_MISMATCH", isList ? "expected a list of PsrFile" : "expected a PsrFile")); + return null; + } + + var references = new JsonArray(); + for (var i = 0; i < given.Length; i++) + { + var file = given[i]; + var path = isList ? $"{field.Name}[{i}]" : field.Name; + if (field.ContentTypes is { Count: > 0 } allowed && !allowed.Contains(file.ContentType, StringComparer.OrdinalIgnoreCase)) + { + errors.Add(new(path, "CONTENT_TYPE_NOT_ALLOWED", $"content type '{file.ContentType}' is not one of: {string.Join(", ", allowed)}")); + } + + if (file.Length > maxFileBytes) + { + errors.Add(new(path, "FILE_TOO_LARGE", $"file has {file.Length} bytes; the limit is {maxFileBytes}")); + } + + files.Add(new BoundFile(field.Name, i, file)); + references.Add(new JsonObject + { + [WireValidator.FileMarker] = new JsonObject { ["name"] = file.FileName, ["contentType"] = file.ContentType }, + }); + } + + return isList ? references : references[0]!.DeepClone(); + } + + private static JsonNode? ToWire(object value, FieldType type, string path, List errors) + { + switch (value) + { + case JsonNode node: + return node.DeepClone(); + case JsonElement element: + return JsonSerializer.SerializeToNode(element); + } + + switch (type.Kind) + { + case FieldKind.Number: + double? number = value switch + { + double d => d, + float f => f, + decimal m => (double)m, + int or long or short or byte or sbyte or uint or ushort or ulong => Convert.ToDouble(value, CultureInfo.InvariantCulture), + _ => null, + }; + return number is { } n ? JsonValue.Create(n) : Mismatch(path, "number", value, errors); + case FieldKind.Integer: + long? integer = value switch + { + int or long or short or byte or sbyte or uint or ushort => Convert.ToInt64(value, CultureInfo.InvariantCulture), + ulong u when u <= long.MaxValue => (long)u, + _ => null, + }; + return integer is { } i ? JsonValue.Create(i) : Mismatch(path, "integer", value, errors); + case FieldKind.Decimal: + return value switch + { + decimal m => JsonValue.Create(m.ToString(CultureInfo.InvariantCulture)), + int or long or short or byte or sbyte or uint or ushort or ulong => JsonValue.Create(Convert.ToString(value, CultureInfo.InvariantCulture)), + string s => JsonValue.Create(s.Trim()), + _ => Mismatch(path, "decimal (decimal, integer or numeric string; not floating point)", value, errors), + }; + case FieldKind.String: + return value is string or char ? JsonValue.Create(value.ToString()) : Mismatch(path, "string", value, errors); + case FieldKind.Bool: + return value is bool b ? JsonValue.Create(b) : Mismatch(path, "bool", value, errors); + case FieldKind.Date: + return value switch + { + DateOnly d => JsonValue.Create(d.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)), + string s => JsonValue.Create(s), + _ => Mismatch(path, "DateOnly", value, errors), + }; + case FieldKind.DateTime: + return value switch + { + DateTimeOffset dto => JsonValue.Create(dto.ToString("O", CultureInfo.InvariantCulture)), + DateTime { Kind: DateTimeKind.Unspecified } => AddError(path, "NAIVE_DATETIME", "DateTime with Kind=Unspecified is ambiguous; use DateTimeOffset", errors), + DateTime dt => JsonValue.Create(new DateTimeOffset(dt).ToString("O", CultureInfo.InvariantCulture)), + string s => JsonValue.Create(s), + _ => Mismatch(path, "DateTimeOffset", value, errors), + }; + case FieldKind.Enum: + return value switch + { + string s => JsonValue.Create(s), + Enum e => JsonValue.Create(JsonNamingPolicy.SnakeCaseLower.ConvertName(e.ToString())), + _ => Mismatch(path, "string", value, errors), + }; + case FieldKind.Json: + case FieldKind.Table: + if (type.Kind == FieldKind.Table && value is string or not IEnumerable) + { + return Mismatch(path, "a sequence of records", value, errors); + } + + return JsonSerializer.SerializeToNode(value, value.GetType(), PsrJson.Options); + case FieldKind.List: + if (value is string or not IEnumerable) + { + return Mismatch(path, "a sequence", value, errors); + } + + var array = new JsonArray(); + var index = 0; + foreach (var item in (IEnumerable)value) + { + var itemPath = $"{path}[{index++}]"; + array.Add(item is null ? AddError(itemPath, "NULL_VALUE", "null items are not allowed", errors) : ToWire(item, type.ItemType!, itemPath, errors)); + } + + return array; + default: + return Mismatch(path, type.ToString(), value, errors); + } + } + + private static JsonNode? Mismatch(string path, string expected, object value, List errors) => + AddError(path, "TYPE_MISMATCH", $"expected {expected}, got {value.GetType().Name}", errors); + + private static JsonNode? AddError(string path, string code, string message, List errors) + { + errors.Add(new InputError(path, code, message)); + return null; + } + + /// Reads input members from an anonymous object, record, dictionary or JSON object. + internal static Dictionary ReadMembers(object? inputs) + { + switch (inputs) + { + case null: + return new(StringComparer.Ordinal); + case JsonObject json: + return json.ToDictionary(p => p.Key, p => (object?)p.Value, StringComparer.Ordinal); + case JsonElement { ValueKind: JsonValueKind.Object } element: + return element.EnumerateObject().ToDictionary(p => p.Name, p => (object?)p.Value, StringComparer.Ordinal); + case IEnumerable> pairs: + return pairs.ToDictionary(p => p.Key, p => p.Value, StringComparer.Ordinal); + case IDictionary dictionary: + var result = new Dictionary(StringComparer.Ordinal); + foreach (DictionaryEntry entry in dictionary) + { + result[Convert.ToString(entry.Key, CultureInfo.InvariantCulture)!] = entry.Value; + } + + return result; + default: + return inputs.GetType() + .GetProperties(BindingFlags.Instance | BindingFlags.Public) + .Where(p => p.CanRead && p.GetIndexParameters().Length == 0) + .ToDictionary( + p => p.Name.Any(char.IsUpper) ? JsonNamingPolicy.SnakeCaseLower.ConvertName(p.Name) : p.Name, + p => p.GetValue(inputs), + StringComparer.Ordinal); + } + } +} diff --git a/src/PythonScriptRunner.Core/Values/WireValidator.cs b/src/PythonScriptRunner.Core/Values/WireValidator.cs new file mode 100644 index 0000000..279a9fa --- /dev/null +++ b/src/PythonScriptRunner.Core/Values/WireValidator.cs @@ -0,0 +1,210 @@ +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Nodes; +using System.Text.RegularExpressions; + +namespace PythonScriptRunner.Core.Values; + +/// One contract violation of a wire value. +internal readonly record struct WireError(string Path, string Code, string Message); + +/// Validates wire values (JSON) against declared field types. +internal static partial class WireValidator +{ + internal const string FileMarker = "$file"; + + [GeneratedRegex(@"(Z|z|[+-]\d{2}:?\d{2})$")] + private static partial Regex OffsetSuffix(); + + public static void Validate(JsonNode? value, FieldDefinition field, string path, List errors) => + Validate(value, field.Type, field, path, errors); + + private static void Validate(JsonNode? value, FieldType type, FieldDefinition field, string path, List errors) + { + if (value is null) + { + errors.Add(new(path, "NULL_VALUE", "null is not allowed here")); + return; + } + + switch (type.Kind) + { + case FieldKind.Number: + if (!TryGetDouble(value, out var number)) + { + errors.Add(Mismatch(path, "number", value)); + } + else if (!double.IsFinite(number)) + { + errors.Add(new(path, "NON_FINITE_NUMBER", "number must be finite")); + } + + break; + case FieldKind.Integer: + if (!TryGetInteger(value, out _)) + { + errors.Add(Mismatch(path, "integer", value)); + } + + break; + case FieldKind.Decimal: + if (!TryGetString(value, out var text) + || !decimal.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out _)) + { + errors.Add(new(path, "INVALID_DECIMAL", "expected a decimal number as a string (e.g. \"12.50\")")); + } + + break; + case FieldKind.String: + if (!TryGetString(value, out _)) + { + errors.Add(Mismatch(path, "string", value)); + } + + break; + case FieldKind.Bool: + if (value.GetValueKind() is not (JsonValueKind.True or JsonValueKind.False)) + { + errors.Add(Mismatch(path, "bool", value)); + } + + break; + case FieldKind.Date: + if (!TryGetString(value, out var date) + || !DateOnly.TryParseExact(date, "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out _)) + { + errors.Add(new(path, "INVALID_DATE", "expected an ISO 8601 date (yyyy-MM-dd)")); + } + + break; + case FieldKind.DateTime: + ValidateDateTime(value, path, errors); + break; + case FieldKind.Enum: + if (!TryGetString(value, out var option) || !type.EnumValues!.Contains(option, StringComparer.Ordinal)) + { + errors.Add(new(path, "ENUM_VALUE_INVALID", $"expected one of: {string.Join(", ", type.EnumValues!)}")); + } + + break; + case FieldKind.Json: + break; + case FieldKind.Table: + ValidateTable(value, field, path, errors); + break; + case FieldKind.File: + ValidateFile(value, field, path, errors); + break; + case FieldKind.List: + if (value is not JsonArray array) + { + errors.Add(Mismatch(path, "list", value)); + break; + } + + for (var i = 0; i < array.Count; i++) + { + Validate(array[i], type.ItemType!, field, $"{path}[{i}]", errors); + } + + break; + } + } + + private static void ValidateDateTime(JsonNode value, string path, List errors) + { + if (!TryGetString(value, out var text) + || !DateTimeOffset.TryParse(text, CultureInfo.InvariantCulture, DateTimeStyles.None, out _)) + { + errors.Add(new(path, "INVALID_DATETIME", "expected an ISO 8601 date-time")); + } + else if (!OffsetSuffix().IsMatch(text)) + { + errors.Add(new(path, "NAIVE_DATETIME", "date-time must include a UTC offset (e.g. -03:00 or Z)")); + } + } + + private static void ValidateTable(JsonNode value, FieldDefinition field, string path, List errors) + { + if (value is not JsonArray rows || rows.Any(row => row is not JsonObject)) + { + errors.Add(new(path, "TYPE_MISMATCH", "expected a list of objects (records)")); + return; + } + + if (field.Columns is not { Count: > 0 } columns) + { + return; + } + + for (var i = 0; i < rows.Count; i++) + { + var row = rows[i]!.AsObject(); + foreach (var column in columns) + { + var cellPath = $"{path}[{i}].{column.Name}"; + if (!row.TryGetPropertyValue(column.Name, out var cell)) + { + errors.Add(new(cellPath, "MISSING_COLUMN", "declared column is missing")); + } + else if (cell is not null) + { + Validate(cell, column.Type, field, cellPath, errors); + } + } + } + } + + private static void ValidateFile(JsonNode value, FieldDefinition field, string path, List errors) + { + if (value is not JsonObject reference + || reference[FileMarker] is not JsonObject info + || !TryGetString(info["path"] ?? info["name"], out _)) + { + errors.Add(new(path, "TYPE_MISMATCH", "expected a file reference")); + return; + } + + if (field.ContentTypes is { Count: > 0 } allowed + && TryGetString(info["contentType"], out var contentType) + && !allowed.Contains(contentType, StringComparer.OrdinalIgnoreCase)) + { + errors.Add(new(path, "CONTENT_TYPE_NOT_ALLOWED", $"content type '{contentType}' is not one of: {string.Join(", ", allowed)}")); + } + } + + internal static bool TryGetString(JsonNode? node, out string value) + { + if (node is JsonValue jsonValue && jsonValue.GetValueKind() == JsonValueKind.String && jsonValue.TryGetValue(out string? text)) + { + value = text; + return true; + } + + value = string.Empty; + return false; + } + + // JsonValue built from .NET primitives (e.g. JsonValue.Create(1)) only converts to its own type, + // so fall back to the JSON text, which is always invariant. + private static bool TryGetDouble(JsonNode node, out double value) + { + value = 0; + return node is JsonValue jsonValue + && jsonValue.GetValueKind() == JsonValueKind.Number + && (jsonValue.TryGetValue(out value) + || double.TryParse(jsonValue.ToJsonString(), NumberStyles.Float, CultureInfo.InvariantCulture, out value)); + } + + private static bool TryGetInteger(JsonNode node, out long value) + { + value = 0; + return node is JsonValue jsonValue + && jsonValue.GetValueKind() == JsonValueKind.Number + && (jsonValue.TryGetValue(out value) + || long.TryParse(jsonValue.ToJsonString(), NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out value)); + } + + private static WireError Mismatch(string path, string expected, JsonNode value) => + new(path, "TYPE_MISMATCH", $"expected {expected}, got {value.GetValueKind().ToString().ToLowerInvariant()}"); +} diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props new file mode 100644 index 0000000..e8f166e --- /dev/null +++ b/tests/Directory.Build.props @@ -0,0 +1,13 @@ + + + + + false + true + Exe + + true + + $(NoWarn);CA1707;CS1591 + + diff --git a/tests/PythonScriptRunner.Core.Tests/Infrastructure/PythonFixture.cs b/tests/PythonScriptRunner.Core.Tests/Infrastructure/PythonFixture.cs new file mode 100644 index 0000000..46eebe6 --- /dev/null +++ b/tests/PythonScriptRunner.Core.Tests/Infrastructure/PythonFixture.cs @@ -0,0 +1,88 @@ +using System.Diagnostics; +using PythonScriptRunner.Core.Environments; + +[assembly: AssemblyFixture(typeof(PythonScriptRunner.Core.Tests.Infrastructure.PythonFixture))] + +namespace PythonScriptRunner.Core.Tests.Infrastructure; + +/// +/// Builds the psrunner wheel from python/psrunner once and warms the default Python environment, +/// so integration tests run the real protocol end to end. +/// +public sealed class PythonFixture : IAsyncLifetime +{ + public string RepositoryRoot { get; } = FindRepositoryRoot(); + + public string UvPath { get; } = FindUv(); + + public string EnvironmentCacheRoot { get; } = Path.Combine(Path.GetTempPath(), "psr-tests", "env-cache"); + + public string WheelPath { get; private set; } = string.Empty; + + public async ValueTask InitializeAsync() + { + var output = Path.Combine(Path.GetTempPath(), "psr-tests", "wheels", Guid.NewGuid().ToString("N")); + await RunAsync(UvPath, ["build", "--wheel", "--out-dir", output, Path.Combine(RepositoryRoot, "python", "psrunner")]); + WheelPath = Directory.GetFiles(output, "*.whl").Single(); + + await using var host = RunnerHost.Create(this, builder => builder.AddStage("warmup", s => s + .Script(""" + from psrunner import stage + + @stage + def run(inputs, ctx): + return {"ok": True} + """) + .Output("ok", FieldType.Bool))); + await using var result = await host.Runner.RunStageAsync("warmup", null); + result.EnsureSuccess(); + } + + public ValueTask DisposeAsync() => ValueTask.CompletedTask; + + private static async Task RunAsync(string fileName, IEnumerable arguments) + { + var startInfo = new ProcessStartInfo(fileName) { RedirectStandardOutput = true, RedirectStandardError = true }; + foreach (var argument in arguments) + { + startInfo.ArgumentList.Add(argument); + } + + using var process = Process.Start(startInfo)!; + var stdout = process.StandardOutput.ReadToEndAsync(); + var stderr = process.StandardError.ReadToEndAsync(); + await process.WaitForExitAsync(); + if (process.ExitCode != 0) + { + throw new InvalidOperationException($"{fileName} failed: {await stdout} {await stderr}"); + } + } + + private static string FindRepositoryRoot() + { + var directory = new DirectoryInfo(AppContext.BaseDirectory); + while (directory is not null && !File.Exists(Path.Combine(directory.FullName, "PythonScriptRunner.slnx"))) + { + directory = directory.Parent; + } + + return directory?.FullName ?? throw new InvalidOperationException("Repository root (PythonScriptRunner.slnx) not found."); + } + + private static string FindUv() + { + var configured = Environment.GetEnvironmentVariable("PSR_UV_PATH"); + if (!string.IsNullOrWhiteSpace(configured)) + { + return configured; + } + + if (ExecutableLocator.Find("uv") is { } found) + { + return found; + } + + var winget = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft", "WinGet", "Links", "uv.exe"); + return File.Exists(winget) ? winget : throw new InvalidOperationException("uv was not found. Install it or set PSR_UV_PATH."); + } +} diff --git a/tests/PythonScriptRunner.Core.Tests/Infrastructure/RunnerHost.cs b/tests/PythonScriptRunner.Core.Tests/Infrastructure/RunnerHost.cs new file mode 100644 index 0000000..4e52daa --- /dev/null +++ b/tests/PythonScriptRunner.Core.Tests/Infrastructure/RunnerHost.cs @@ -0,0 +1,108 @@ +using Microsoft.Extensions.Configuration; + +namespace PythonScriptRunner.Core.Tests.Infrastructure; + +/// A service provider with the runner configured for tests (isolated work folder, shared venv cache). +public sealed class RunnerHost : IAsyncDisposable +{ + private RunnerHost(ServiceProvider services, string workRoot) + { + Services = services; + WorkRoot = workRoot; + } + + public ServiceProvider Services { get; } + + public string WorkRoot { get; } + + public IPythonRunner Runner => Services.GetRequiredService(); + + public static RunnerHost Create( + PythonFixture fixture, + Action? configure = null, + Action? options = null, + Action? services = null, + IDictionary? configuration = null) + { + var collection = new ServiceCollection(); + if (configuration is not null) + { + collection.AddSingleton(new ConfigurationBuilder().AddInMemoryCollection(configuration).Build()); + } + + var workRoot = Path.Combine(Path.GetTempPath(), "psr-tests", "work", Guid.NewGuid().ToString("N")); + var builder = collection.AddPythonScriptRunner(o => + { + o.WorkRoot = workRoot; + o.EnvironmentCacheRoot = fixture.EnvironmentCacheRoot; + o.UvPath = fixture.UvPath; + o.PsrunnerRequirement = fixture.WheelPath; + options?.Invoke(o); + }); + configure?.Invoke(builder); + services?.Invoke(collection); + return new RunnerHost(collection.BuildServiceProvider(validateScopes: true), workRoot); + } + + public async ValueTask DisposeAsync() + { + await Services.DisposeAsync(); + try + { + if (Directory.Exists(WorkRoot)) + { + Directory.Delete(WorkRoot, recursive: true); + } + } + catch (IOException) + { + // Best effort. + } + } +} + +/// Creates a temporary folder catalog (stages/<key>/stage.json + script). +public sealed class TempCatalog : IDisposable +{ + public TempCatalog() => Directory.CreateDirectory(Root); + + public string Root { get; } = Path.Combine(Path.GetTempPath(), "psr-tests", "catalogs", Guid.NewGuid().ToString("N")); + + public string AddStage(string folder, string manifest, string script, string? requirements = null, string? requirementsLock = null) + { + var path = Path.Combine(Root, "stages", folder); + Directory.CreateDirectory(path); + File.WriteAllText(Path.Combine(path, "stage.json"), manifest); + File.WriteAllText(Path.Combine(path, "script.py"), script); + if (requirements is not null) + { + File.WriteAllText(Path.Combine(path, "requirements.txt"), requirements); + } + + if (requirementsLock is not null) + { + File.WriteAllText(Path.Combine(path, "requirements.lock"), requirementsLock); + } + + return path; + } + + public void Dispose() + { + try + { + Directory.Delete(Root, recursive: true); + } + catch (IOException) + { + // Best effort. + } + } +} + +/// Collection for timing-sensitive tests (not run in parallel with others). +[CollectionDefinition(Name, DisableParallelization = true)] +public sealed class SerialCollection +{ + public const string Name = "Serial"; +} diff --git a/tests/PythonScriptRunner.Core.Tests/Infrastructure/Scripts.cs b/tests/PythonScriptRunner.Core.Tests/Infrastructure/Scripts.cs new file mode 100644 index 0000000..6eb1eb1 --- /dev/null +++ b/tests/PythonScriptRunner.Core.Tests/Infrastructure/Scripts.cs @@ -0,0 +1,43 @@ +namespace PythonScriptRunner.Core.Tests.Infrastructure; + +/// Python scripts shared by the tests. +public static class Scripts +{ + public const string Echo = """ + from psrunner import stage + + @stage + def run(inputs, ctx): + return {"texto": inputs["texto"]} + """; + + public const string EchoManifest = """ + { + "key": "eco", + "version": 1, + "name": "Eco", + "inputs": [ { "name": "texto", "type": "string" } ], + "outputs": [ { "name": "texto", "type": "string" } ] + } + """; + + public const string EchoAllTypes = """ + import shutil + from psrunner import stage + + @stage + def run(inputs, ctx): + out = {k: v for k, v in inputs.items() if k not in ("arquivo", "anexos")} + source = inputs["arquivo"] + copy = ctx.new_file("copia-" + source.name, source.content_type) + shutil.copyfile(source.path, copy.path) + out["arquivo"] = copy + attachments = [] + for index, item in enumerate(inputs["anexos"]): + target = ctx.new_file(f"{index}-{item.name}", item.content_type) + shutil.copyfile(item.path, target.path) + attachments.append(target) + out["anexos"] = attachments + return out + """; +} diff --git a/tests/PythonScriptRunner.Core.Tests/Integration/EnvironmentTests.cs b/tests/PythonScriptRunner.Core.Tests/Integration/EnvironmentTests.cs new file mode 100644 index 0000000..706eb44 --- /dev/null +++ b/tests/PythonScriptRunner.Core.Tests/Integration/EnvironmentTests.cs @@ -0,0 +1,86 @@ +using PythonScriptRunner.Core.Tests.Infrastructure; + +namespace PythonScriptRunner.Core.Tests.Integration; + +public sealed class EnvironmentTests(PythonFixture fixture) +{ + private const string Ok = """ + from psrunner import stage + + @stage + def run(inputs, ctx): + return {} + """; + + [Fact] + public async Task Spec001_AC14_ConcurrentFirstUse_CreatesTheEnvironmentOnce() + { + // Arrange: a private cache so the environment does not exist yet. + var cache = Path.Combine(Path.GetTempPath(), "psr-tests", "isolated-cache", Guid.NewGuid().ToString("N")); + await using var host = RunnerHost.Create( + fixture, + b => b.AddStage("com-dependencia", s => s.Script(Ok).Requirements("six\n")), + o => o.EnvironmentCacheRoot = cache); + var manager = host.Services.GetRequiredService(); + var stage = await host.Services.GetRequiredService().FindStageAsync("com-dependencia", null, TestContext.Current.CancellationToken); + + // Act + var environments = await Task.WhenAll(manager.EnsureAsync(stage!, TestContext.Current.CancellationToken), manager.EnsureAsync(stage!, TestContext.Current.CancellationToken)); + await using var first = await host.Runner.RunStageAsync("com-dependencia", null, cancellationToken: TestContext.Current.CancellationToken); + + // Assert + environments.Count(e => e.Created).ShouldBe(1); + environments.Select(e => e.Directory).Distinct().ShouldHaveSingleItem(); + first.Status.ShouldBe(RunStatus.Succeeded, first.Error?.Message); + } + + [Fact] + public async Task Spec001_AC15_UnknownDependency_IsEnvironmentSetupFailed() + { + await using var host = RunnerHost.Create(fixture, b => b.AddStage("quebrado", s => s + .Script(Ok) + .Requirements("psr-pacote-que-nao-existe-123456==1.0\n"))); + + await using var result = await host.Runner.RunStageAsync("quebrado", null, cancellationToken: TestContext.Current.CancellationToken); + + result.Error!.Kind.ShouldBe(ErrorKind.EnvironmentSetupFailed); + result.Error.Message.ShouldContain("uv pip"); + } +} + +[Collection(SerialCollection.Name)] +public sealed class EnvironmentCacheTests(PythonFixture fixture) +{ + [Fact] + public async Task Spec001_AC13_StagesWithSameDependencies_ShareTheVenv_AndOverheadIsLow() + { + // Arrange + const string script = """ + from psrunner import stage + + @stage + def run(inputs, ctx): + return {"ok": True} + """; + await using var host = RunnerHost.Create(fixture, b => b + .AddStage("primeiro", s => s.Script(script).Output("ok", FieldType.Bool)) + .AddStage("segundo", s => s.Script(script).Output("ok", FieldType.Bool))); + + // Act + var overheads = new List(); + var hashes = new HashSet(); + for (var i = 0; i < 50; i++) + { + await using var result = await host.Runner.RunStageAsync(i % 2 == 0 ? "primeiro" : "segundo", null, cancellationToken: TestContext.Current.CancellationToken); + result.EnsureSuccess(); + var attempt = result.Steps[0].Attempts[0]; + overheads.Add(attempt.Overhead); + hashes.Add(attempt.EnvironmentHash); + } + + // Assert + hashes.ShouldHaveSingleItem(); + var p95 = overheads.Order().ElementAt((int)Math.Ceiling(overheads.Count * 0.95) - 1); + p95.ShouldBeLessThanOrEqualTo(TimeSpan.FromMilliseconds(300)); + } +} diff --git a/tests/PythonScriptRunner.Core.Tests/Integration/IsolationTests.cs b/tests/PythonScriptRunner.Core.Tests/Integration/IsolationTests.cs new file mode 100644 index 0000000..388a480 --- /dev/null +++ b/tests/PythonScriptRunner.Core.Tests/Integration/IsolationTests.cs @@ -0,0 +1,184 @@ +using System.Diagnostics; +using System.Text.Json.Nodes; +using PythonScriptRunner.Core.Tests.Infrastructure; + +namespace PythonScriptRunner.Core.Tests.Integration; + +public sealed class IsolationTests(PythonFixture fixture) +{ + [Fact] + public async Task Spec001_AC07_Timeout_KillsTheProcessTree() + { + // Arrange + var pidFile = Path.Combine(Path.GetTempPath(), "psr-tests", $"child-{Guid.NewGuid():N}.pid"); + await using var host = RunnerHost.Create(fixture, b => b.AddStage("lento", s => s + .Script(""" + import subprocess, sys, time + from psrunner import stage + + @stage + def run(inputs, ctx): + child = subprocess.Popen([sys.executable, "-c", "import time; time.sleep(120)"]) + with open(inputs["pid_file"], "w") as f: + f.write(str(child.pid)) + time.sleep(60) + return {} + """) + .Input("pid_file", FieldType.String) + .Timeout(TimeSpan.FromSeconds(2)))); + var stopwatch = Stopwatch.StartNew(); + + // Act + await using var result = await host.Runner.RunStageAsync("lento", new { pid_file = pidFile }, cancellationToken: TestContext.Current.CancellationToken); + stopwatch.Stop(); + + // Assert + result.Status.ShouldBe(RunStatus.Failed); + result.Steps[0].Status.ShouldBe(StepStatus.TimedOut); + result.Error!.Kind.ShouldBe(ErrorKind.Timeout); + // Spec: the attempt ends in at most ~3 s with a 2 s timeout (small margin for slow CI runners). + result.Steps[0].Attempts[0].Duration.ShouldBeLessThan(TimeSpan.FromSeconds(3.5)); + stopwatch.Elapsed.ShouldBeLessThan(TimeSpan.FromSeconds(5)); + (await IsProcessGoneAsync(int.Parse(await File.ReadAllTextAsync(pidFile, TestContext.Current.CancellationToken)))).ShouldBeTrue(); + } + + [Fact] + public async Task Spec001_AC08_Cancellation_StopsTheRun() + { + await using var host = RunnerHost.Create(fixture, b => b.AddStage("espera", s => s.Script(""" + import time + from psrunner import stage + + @stage + def run(inputs, ctx): + time.sleep(60) + return {} + """))); + using var cancellation = CancellationTokenSource.CreateLinkedTokenSource(TestContext.Current.CancellationToken); + cancellation.CancelAfter(TimeSpan.FromSeconds(2)); + var stopwatch = Stopwatch.StartNew(); + + await using var result = await host.Runner.RunStageAsync("espera", null, cancellationToken: cancellation.Token); + + result.Status.ShouldBe(RunStatus.Cancelled); + result.Error!.Kind.ShouldBe(ErrorKind.Cancelled); + // Cancelled after 2 s; the process tree must stop within ~2 s more. + stopwatch.Elapsed.ShouldBeLessThan(TimeSpan.FromSeconds(4.5)); + } + + [Fact] + public async Task Spec001_AC09_MemoryLimit_IsEnforced() + { + await using var host = RunnerHost.Create(fixture, b => b.AddStage("guloso", s => s + .Script(""" + from psrunner import stage + + @stage + def run(inputs, ctx): + data = bytearray(2 * 1024 * 1024 * 1024) + return {"tamanho": len(data)} + """) + .Output("tamanho", FieldType.Integer) + .MemoryLimitMb(256))); + + await using var result = await host.Runner.RunStageAsync("guloso", null, cancellationToken: TestContext.Current.CancellationToken); + + result.Error!.Kind.ShouldBe(ErrorKind.MemoryLimitExceeded, result.Error.Message); + } + + [Fact] + public async Task Spec001_AC10_Secrets_ReachTheScriptButNotLogsOrInputs() + { + // Arrange + const string secret = "s3cr3t-valor"; + await using var host = RunnerHost.Create( + fixture, + b => b.AddStage("smtp", s => s + .Script(""" + import os + from psrunner import stage + + @stage + def run(inputs, ctx): + senha = ctx.secrets["SMTP_SENHA"] + print("senha:", senha) + with open(os.environ["PSR_INPUT"], encoding="utf-8") as f: + vazou = senha in f.read() + return {"tamanho": len(senha), "vazou_no_input": vazou} + """) + .Secret("SMTP_SENHA") + .Output("tamanho", FieldType.Integer) + .Output("vazou_no_input", FieldType.Bool)), + configuration: new Dictionary { ["PythonScriptRunner:Secrets:SMTP_SENHA"] = secret }); + + // Act + await using var result = await host.Runner.RunStageAsync("smtp", null, cancellationToken: TestContext.Current.CancellationToken); + + // Assert + result.Status.ShouldBe(RunStatus.Succeeded, result.Error?.Message); + result.GetOutput("tamanho").ShouldBe(secret.Length); + result.GetOutput("vazou_no_input").ShouldBeFalse(); + var stdout = result.Steps[0].Attempts[0].Stdout.Content; + stdout.ShouldContain("senha: ***"); + stdout.ShouldNotContain(secret); + } + + [Fact] + public async Task Spec001_AC11_ProcessGetsACleanEnvironment() + { + Environment.SetEnvironmentVariable("PSR_TEST_HOST_ONLY", "1"); + await using var host = RunnerHost.Create(fixture, b => b.AddStage("ambiente", s => s + .Script(""" + import os + from psrunner import stage + + @stage + def run(inputs, ctx): + return {"nomes": sorted(os.environ)} + """) + .Output("nomes", FieldType.Json))); + + await using var result = await host.Runner.RunStageAsync("ambiente", null, cancellationToken: TestContext.Current.CancellationToken); + + var names = result.GetOutput("nomes").Select(n => n!.GetValue().ToUpperInvariant()).ToList(); + names.ShouldNotContain("PSR_TEST_HOST_ONLY"); + // LC_CTYPE is set by the interpreter itself on Linux (PEP 538 locale coercion), not inherited from the host. + string[] allowed = ["PATH", "SYSTEMROOT", "TEMP", "TMP", "TMPDIR", "HOME", "LC_CTYPE"]; + names.Where(n => !n.StartsWith("PSR_", StringComparison.Ordinal) && !allowed.Contains(n)).ShouldBeEmpty(); + } + + [Fact] + public async Task Spec001_AC12_MissingSecret_FailsWithoutStartingPython() + { + await using var host = RunnerHost.Create(fixture, b => b.AddStage("smtp", s => s.Script(Scripts.Echo).Secret("NAO_CONFIGURADO"))); + + await using var result = await host.Runner.RunStageAsync("smtp", null, cancellationToken: TestContext.Current.CancellationToken); + + result.Error!.Kind.ShouldBe(ErrorKind.SecretNotFound); + result.Error.Message.ShouldContain("NAO_CONFIGURADO"); + result.Steps[0].Attempts[0].ExitCode.ShouldBeNull(); + } + + private static async Task IsProcessGoneAsync(int pid) + { + for (var i = 0; i < 30; i++) + { + try + { + using var process = Process.GetProcessById(pid); + if (process.HasExited) + { + return true; + } + } + catch (ArgumentException) + { + return true; + } + + await Task.Delay(100); + } + + return false; + } +} diff --git a/tests/PythonScriptRunner.Core.Tests/Integration/RetryAndTelemetryTests.cs b/tests/PythonScriptRunner.Core.Tests/Integration/RetryAndTelemetryTests.cs new file mode 100644 index 0000000..2ef029f --- /dev/null +++ b/tests/PythonScriptRunner.Core.Tests/Integration/RetryAndTelemetryTests.cs @@ -0,0 +1,108 @@ +using System.Diagnostics; +using Microsoft.Extensions.Diagnostics.Metrics.Testing; +using PythonScriptRunner.Core.Tests.Infrastructure; + +namespace PythonScriptRunner.Core.Tests.Integration; + +public sealed class RetryTests(PythonFixture fixture) +{ + private const string FailsTwice = """ + from pathlib import Path + from psrunner import StageError, stage + + @stage + def run(inputs, ctx): + counter = Path(inputs["contador"]) + count = int(counter.read_text()) + 1 if counter.exists() else 1 + counter.write_text(str(count)) + if count < 3: + raise StageError(f"tentativa {count} falhou") + return {"tentativas": count} + """; + + [Fact] + public async Task Spec001_AC21_RetriesWithBackoff_UntilSuccess() + { + // Arrange + var counter = Path.Combine(Path.GetTempPath(), "psr-tests", $"counter-{Guid.NewGuid():N}.txt"); + await using var host = RunnerHost.Create(fixture, b => b.AddStage("instavel", s => s + .Script(FailsTwice) + .Input("contador", FieldType.String) + .Output("tentativas", FieldType.Integer) + .Retry(2, TimeSpan.FromMilliseconds(200), 2.0))); + + // Act + await using var result = await host.Runner.RunStageAsync("instavel", new { contador = counter }, cancellationToken: TestContext.Current.CancellationToken); + + // Assert + result.Status.ShouldBe(RunStatus.Succeeded, result.Error?.Message); + result.GetOutput("tentativas").ShouldBe(3); + var attempts = result.Steps[0].Attempts; + attempts.Select(a => (a.Number, a.Cause, a.Status)).ShouldBe( + [ + (1, AttemptCause.Initial, AttemptStatus.Failed), + (2, AttemptCause.AutoRetry, AttemptStatus.Failed), + (3, AttemptCause.AutoRetry, AttemptStatus.Succeeded), + ]); + (attempts[1].StartedAt - (attempts[0].StartedAt + attempts[0].Duration)).ShouldBeGreaterThanOrEqualTo(TimeSpan.FromMilliseconds(190)); + (attempts[2].StartedAt - (attempts[1].StartedAt + attempts[1].Duration)).ShouldBeGreaterThanOrEqualTo(TimeSpan.FromMilliseconds(390)); + } + + [Fact] + public async Task Spec001_AC22_WithoutRetry_ThereIsOneAttempt() + { + var counter = Path.Combine(Path.GetTempPath(), "psr-tests", $"counter-{Guid.NewGuid():N}.txt"); + await using var host = RunnerHost.Create(fixture, b => b.AddStage("instavel", s => s + .Script(FailsTwice) + .Input("contador", FieldType.String) + .Output("tentativas", FieldType.Integer))); + + await using var result = await host.Runner.RunStageAsync("instavel", new { contador = counter }, cancellationToken: TestContext.Current.CancellationToken); + + result.Status.ShouldBe(RunStatus.Failed); + result.Steps[0].Attempts.ShouldHaveSingleItem(); + } +} + +public sealed class TelemetryTests(PythonFixture fixture) +{ + [Fact] + public async Task Spec001_AC24_EmitsActivityAndMetrics() + { + // Arrange + var activities = new List(); + using var listener = new ActivityListener + { + ShouldListenTo = source => source.Name == "PythonScriptRunner", + Sample = (ref ActivityCreationOptions _) => ActivitySamplingResult.AllDataAndRecorded, + ActivityStopped = activity => + { + lock (activities) + { + activities.Add(activity); + } + }, + }; + ActivitySource.AddActivityListener(listener); + await using var host = RunnerHost.Create(fixture, b => b.AddStage("telemetria", s => s.Script(Scripts.Echo).Input("texto", FieldType.String).Output("texto", FieldType.String))); + using var durations = new MetricCollector(host.Services.GetRequiredService(), "PythonScriptRunner", "psr.step.duration"); + + // Act + await using var result = await host.Runner.RunStageAsync("telemetria", new { texto = "x" }, cancellationToken: TestContext.Current.CancellationToken); + + // Assert + Activity execute; + lock (activities) + { + execute = activities.Single(a => a.OperationName == "psr.stage.execute" && Equals(a.GetTagItem("psr.run.id"), result.Id.ToString())); + } + + execute.GetTagItem("psr.stage.key").ShouldBe("telemetria"); + execute.GetTagItem("psr.stage.version").ShouldBe(1); + execute.GetTagItem("psr.step.key").ShouldBe("telemetria"); + execute.GetTagItem("psr.attempt").ShouldBe(1); + var measurement = durations.GetMeasurementSnapshot().ShouldHaveSingleItem(); + measurement.Tags["psr.stage.key"].ShouldBe("telemetria"); + measurement.Tags["psr.outcome"].ShouldBe("Succeeded"); + } +} diff --git a/tests/PythonScriptRunner.Core.Tests/Integration/StageRunTests.cs b/tests/PythonScriptRunner.Core.Tests/Integration/StageRunTests.cs new file mode 100644 index 0000000..48b3daa --- /dev/null +++ b/tests/PythonScriptRunner.Core.Tests/Integration/StageRunTests.cs @@ -0,0 +1,311 @@ +using System.Text; +using System.Text.Json.Nodes; +using PythonScriptRunner.Core.Execution; +using PythonScriptRunner.Core.Tests.Infrastructure; + +namespace PythonScriptRunner.Core.Tests.Integration; + +public sealed class StageRunTests(PythonFixture fixture) +{ + [Fact] + public async Task Spec001_AC01_FolderStage_EchoesInput() + { + // Arrange + using var catalog = new TempCatalog(); + catalog.AddStage("eco", Scripts.EchoManifest, Scripts.Echo); + await using var host = RunnerHost.Create(fixture, b => b.AddFileCatalog(catalog.Root)); + + // Act + await using var result = await host.Runner.RunStageAsync("eco", new { texto = "olá" }, cancellationToken: TestContext.Current.CancellationToken); + + // Assert + result.Status.ShouldBe(RunStatus.Succeeded, result.Error?.Message); + result.GetOutput("texto").ShouldBe("olá"); + } + + [Fact] + public async Task Spec001_AC02_InvalidInputs_StartNoProcess() + { + var executor = new CountingExecutor(); + await using var host = RunnerHost.Create( + fixture, + b => b.AddStage("soma", s => s.Script(Scripts.Echo).Input("n", FieldType.Integer)), + services: s => s.AddSingleton(executor)); + + await Should.ThrowAsync(() => host.Runner.RunStageAsync("soma", new { })); + + executor.Calls.ShouldBe(0); + } + + [Fact] + public async Task Spec001_AC03_EveryTypeSurvivesTheRoundTrip() + { + // Arrange + FieldDefinition[] fields = + [ + new("numero", FieldType.Number), + new("inteiro", FieldType.Integer), + new("valor", FieldType.Decimal), + new("texto", FieldType.String), + new("ativo", FieldType.Bool), + new("dia", FieldType.Date), + new("momento", FieldType.DateTime), + new("tipo", FieldType.Enum("aritmetica", "geometrica")), + new("dados", FieldType.Json), + new("tabela", FieldType.Table), + new("lista", FieldType.ListOf(FieldType.Number)), + new("arquivo", FieldType.File), + new("anexos", FieldType.ListOf(FieldType.File)), + ]; + await using var host = RunnerHost.Create(fixture, b => b.AddStage("espelho", s => + { + s.Script(Scripts.EchoAllTypes); + foreach (var field in fields) + { + s.Input(field).Output(field); + } + })); + var moment = new DateTimeOffset(2026, 10, 19, 14, 30, 0, TimeSpan.FromHours(-3)); + Linha[] table = [new(1, 1.5), new(2, 2.5), new(3, 3.5)]; + + // Act + await using var result = await host.Runner.RunStageAsync("espelho", new + { + numero = 1.5, + inteiro = 42L, + valor = 0.1000000000000000000000000001m, + texto = "olá", + ativo = true, + dia = new DateOnly(2026, 10, 19), + momento = moment, + tipo = "geometrica", + dados = new { a = new[] { 1, 2 } }, + tabela = table, + lista = new[] { 1.0, 2.5 }, + arquivo = PsrFile.FromText("

oi

", "pagina.html", "text/html"), + anexos = new[] { PsrFile.FromText("A", "a.txt"), PsrFile.FromText("B", "b.txt") }, + }, cancellationToken: TestContext.Current.CancellationToken); + + // Assert + result.Status.ShouldBe(RunStatus.Succeeded, result.Error?.Message); + result.GetOutput("numero").ShouldBe(1.5); + result.GetOutput("inteiro").ShouldBe(42); + result.GetOutput("valor").ShouldBe(0.1000000000000000000000000001m); + result.GetOutput("texto").ShouldBe("olá"); + result.GetOutput("ativo").ShouldBeTrue(); + result.GetOutput("dia").ShouldBe(new DateOnly(2026, 10, 19)); + result.GetOutput("momento").ShouldBe(moment); + result.GetOutput("momento").Offset.ShouldBe(TimeSpan.FromHours(-3)); + result.GetOutput("tipo").ShouldBe("geometrica"); + result.GetOutput("dados")["a"]!.ToJsonString().ShouldBe("[1,2]"); + result.GetOutput>("tabela").ShouldBe(table); + result.GetOutput("lista").ShouldBe([1.0, 2.5]); + (await ReadText(result.GetFile("arquivo"))).ShouldBe("

oi

"); + result.GetFiles("anexos").Select(f => f.FileName).ShouldBe(["0-a.txt", "1-b.txt"]); + } + + [Fact] + public async Task Spec001_AC04_UndeclaredOutput_IsContractViolation() + { + await using var host = RunnerHost.Create(fixture, b => b.AddStage("extra", s => s + .Script(""" + from psrunner import stage + + @stage + def run(inputs, ctx): + return {"x": 1, "extra": 2} + """) + .Output("x", FieldType.Number))); + + await using var result = await host.Runner.RunStageAsync("extra", null, cancellationToken: TestContext.Current.CancellationToken); + + result.Status.ShouldBe(RunStatus.Failed); + result.Error!.Kind.ShouldBe(ErrorKind.OutputContractViolation); + result.Error.Message.ShouldContain("extra"); + result.Error.StepKey.ShouldBe("extra"); + } + + [Fact] + public async Task Spec001_AC05_MissingRequiredOutput_IsContractViolation() + { + await using var host = RunnerHost.Create(fixture, b => b.AddStage("falta", s => s + .Script(""" + from psrunner import stage + + @stage + def run(inputs, ctx): + return {} + """) + .Output("x", FieldType.Number))); + + await using var result = await host.Runner.RunStageAsync("falta", null, cancellationToken: TestContext.Current.CancellationToken); + + result.Error!.Kind.ShouldBe(ErrorKind.OutputContractViolation); + result.Error.Message.ShouldContain("'x'"); + } + + [Fact] + public async Task Spec001_AC06_StageError_KeepsCodeAndTraceback() + { + await using var host = RunnerHost.Create(fixture, b => b.AddStage("falha", s => s.Script(""" + from psrunner import StageError, stage + + @stage + def run(inputs, ctx): + raise StageError("falhou", code="X1") + """))); + + await using var result = await host.Runner.RunStageAsync("falha", null, cancellationToken: TestContext.Current.CancellationToken); + + result.Error!.Kind.ShouldBe(ErrorKind.ScriptError); + result.Error.Code.ShouldBe("X1"); + result.Error.Message.ShouldBe("falhou"); + result.Error.Traceback.ShouldNotBeNull().ShouldContain("script.py"); + result.Steps[0].Attempts[0].ExitCode.ShouldBe(0); + } + + [Fact] + public async Task Spec001_AC16_Files_ComeBackAndAreDeletedOnDispose() + { + // Arrange + await using var host = RunnerHost.Create(fixture, b => b.AddStage("maiusculas", s => s + .Script(""" + from psrunner import stage + + @stage + def run(inputs, ctx): + out = ctx.new_file("resultado.txt", "text/plain") + out.path.write_text(inputs["html"].read_text().upper(), encoding="utf-8") + return {"arquivo": out} + """) + .Input("html", FieldType.File) + .Output("arquivo", FieldType.File))); + + // Act + var result = await host.Runner.RunStageAsync("maiusculas", new { html = PsrFile.FromText("

oi

", "pagina.html", "text/html") }, cancellationToken: TestContext.Current.CancellationToken); + var file = result.GetFile("arquivo"); + var content = await ReadText(file); + await result.DisposeAsync(); + + // Assert + content.ShouldBe("

OI

"); + file.FileName.ShouldBe("resultado.txt"); + file.ContentType.ShouldBe("text/plain"); + file.Sha256.ShouldBe(Convert.ToHexStringLower(System.Security.Cryptography.SHA256.HashData(Encoding.UTF8.GetBytes("

OI

")))); + File.Exists(file.LocalPath).ShouldBeFalse(); + } + + [Fact] + public async Task Spec001_AC17_FileOverTheLimit_IsArtifactLimitExceeded() + { + await using var host = RunnerHost.Create( + fixture, + b => b.AddStage("grande", s => s + .Script(""" + from psrunner import stage + + @stage + def run(inputs, ctx): + out = ctx.new_file("grande.bin") + out.path.write_bytes(b"0" * (2 * 1024 * 1024)) + return {"arquivo": out} + """) + .Output("arquivo", FieldType.File)), + o => o.MaxFileBytes = 1024 * 1024); + + await using var result = await host.Runner.RunStageAsync("grande", null, cancellationToken: TestContext.Current.CancellationToken); + + result.Error!.Kind.ShouldBe(ErrorKind.ArtifactLimitExceeded); + result.Error.Code.ShouldBe("FILE_TOO_LARGE"); + } + + [Fact] + public async Task Spec001_AC19_LargeStdout_KeepsTheLastMegabyte() + { + await using var host = RunnerHost.Create(fixture, b => b.AddStage("verboso", s => s.Script(""" + import sys + from psrunner import stage + + @stage + def run(inputs, ctx): + sys.stdout.write("x" * 3_000_000) + sys.stdout.flush() + return {} + """))); + + await using var result = await host.Runner.RunStageAsync("verboso", null, cancellationToken: TestContext.Current.CancellationToken); + + var stdout = result.Steps[0].Attempts[0].Stdout; + stdout.Content.Length.ShouldBe(1024 * 1024); + stdout.Truncated.ShouldBeTrue(); + stdout.OriginalBytes.ShouldBeGreaterThanOrEqualTo(3_000_000); + } + + [Fact] + public async Task Spec001_AC20_EachStageUsesItsPythonVersion() + { + const string script = """ + import sys + from psrunner import stage + + @stage + def run(inputs, ctx): + return {"versao": f"{sys.version_info[0]}.{sys.version_info[1]}"} + """; + await using var host = RunnerHost.Create(fixture, b => b + .AddStage("py311", s => s.Python("3.11").Script(script).Output("versao", FieldType.String)) + .AddStage("py312", s => s.Python("3.12").Script(script).Output("versao", FieldType.String))); + + await using var older = await host.Runner.RunStageAsync("py311", null, cancellationToken: TestContext.Current.CancellationToken); + await using var newer = await host.Runner.RunStageAsync("py312", null, cancellationToken: TestContext.Current.CancellationToken); + + older.GetOutput("versao").ShouldBe("3.11", older.Error?.Message); + newer.GetOutput("versao").ShouldBe("3.12", newer.Error?.Message); + } + + [Fact] + public async Task Spec001_AC23_CoreAlone_NeedsNoDatabaseOrQueue() + { + await using var host = RunnerHost.Create(fixture, b => b.AddStage("eco", s => s.Script(Scripts.Echo).Input("texto", FieldType.String).Output("texto", FieldType.String))); + + await using var result = await host.Runner.RunStageAsync("eco", new { texto = "sem banco" }, cancellationToken: TestContext.Current.CancellationToken); + + result.GetOutput("texto").ShouldBe("sem banco"); + host.Services.GetRequiredService().GetType().Name.ShouldBe("NullRunRecorder"); + } + + [Fact] + public async Task Spec001_AC25_FluentAndFolderStagesBehaveTheSame() + { + using var catalog = new TempCatalog(); + catalog.AddStage("eco", Scripts.EchoManifest, Scripts.Echo); + await using var folder = RunnerHost.Create(fixture, b => b.AddFileCatalog(catalog.Root)); + await using var fluent = RunnerHost.Create(fixture, b => b.AddStage("eco", s => s.Script(Scripts.Echo).Input("texto", FieldType.String).Output("texto", FieldType.String))); + + await using var fromFolder = await folder.Runner.RunStageAsync("eco", new { texto = "igual" }, cancellationToken: TestContext.Current.CancellationToken); + await using var fromCode = await fluent.Runner.RunStageAsync("eco", new { texto = "igual" }, cancellationToken: TestContext.Current.CancellationToken); + + fromFolder.Outputs.ToJsonString().ShouldBe(fromCode.Outputs.ToJsonString()); + fromFolder.Status.ShouldBe(fromCode.Status); + } + + private static async Task ReadText(PsrFile file) + { + await using var stream = await file.OpenReadAsync(); + using var reader = new StreamReader(stream); + return await reader.ReadToEndAsync(); + } + + public sealed record Linha(long I, double X); + + private sealed class CountingExecutor : IPythonExecutor + { + public int Calls { get; private set; } + + public Task ExecuteAsync(ExecutionRequest request, CancellationToken cancellationToken) + { + Calls++; + return Task.FromResult(new ExecutionResult { Status = AttemptStatus.Succeeded, Outputs = [] }); + } + } +} diff --git a/tests/PythonScriptRunner.Core.Tests/PythonScriptRunner.Core.Tests.csproj b/tests/PythonScriptRunner.Core.Tests/PythonScriptRunner.Core.Tests.csproj new file mode 100644 index 0000000..8641604 --- /dev/null +++ b/tests/PythonScriptRunner.Core.Tests/PythonScriptRunner.Core.Tests.csproj @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/PythonScriptRunner.Core.Tests/Unit/CatalogTests.cs b/tests/PythonScriptRunner.Core.Tests/Unit/CatalogTests.cs new file mode 100644 index 0000000..56b4484 --- /dev/null +++ b/tests/PythonScriptRunner.Core.Tests/Unit/CatalogTests.cs @@ -0,0 +1,97 @@ +using PythonScriptRunner.Core.Tests.Infrastructure; + +namespace PythonScriptRunner.Core.Tests.Unit; + +public sealed class CatalogTests(PythonFixture fixture) +{ + [Fact] + public async Task Spec001_AC26_InvalidManifest_FailsWithFileAndJsonPath() + { + // Arrange + using var catalog = new TempCatalog(); + var folder = catalog.AddStage("eco", """ + { "key": "eco", "version": 1, "name": "Eco", "inputs": [ { "name": "x", "type": "texto" } ], "outputs": [] } + """, Scripts.Echo); + await using var host = RunnerHost.Create(fixture, b => b.AddFileCatalog(catalog.Root)); + + // Act + var exception = await Should.ThrowAsync(() => + host.Services.GetRequiredService().FindStageAsync("eco", null, TestContext.Current.CancellationToken).AsTask()); + + // Assert + exception.Message.ShouldContain(Path.Combine(folder, "stage.json")); + exception.Message.ShouldContain("/inputs/0/type"); + } + + [Fact] + public async Task Spec001_AC27_UnknownStage_ThrowsStageNotFound() + { + await using var host = RunnerHost.Create(fixture); + + await Should.ThrowAsync(() => host.Runner.RunStageAsync("inexistente", null)); + } + + [Fact] + public async Task UnknownVersion_ThrowsVersionNotFound() + { + await using var host = RunnerHost.Create(fixture, b => b.AddStage("eco", s => s.Script(Scripts.Echo))); + + var exception = await Should.ThrowAsync(() => + host.Runner.RunStageAsync("eco", null, new RunOptions { Version = 9 })); + + exception.Version.ShouldBe(9); + } + + [Fact] + public async Task LatestVersion_IsTheHighest() + { + await using var host = RunnerHost.Create(fixture, b => b + .AddStage("eco", s => s.Version(1).Script(Scripts.Echo)) + .AddStage("eco", s => s.Version(3).Script(Scripts.Echo))); + + var stage = await host.Services.GetRequiredService().FindStageAsync("eco", null, TestContext.Current.CancellationToken); + + stage!.Version.ShouldBe(3); + } + + [Fact] + public async Task DuplicateKeyAndVersion_IsAConfigurationError() + { + using var catalog = new TempCatalog(); + catalog.AddStage("eco", Scripts.EchoManifest, Scripts.Echo); + await using var host = RunnerHost.Create(fixture, b => b + .AddFileCatalog(catalog.Root) + .AddStage("eco", s => s.Script(Scripts.Echo))); + + var exception = await Should.ThrowAsync(() => + host.Services.GetRequiredService().FindStageAsync("eco", null, TestContext.Current.CancellationToken).AsTask()); + + exception.Message.ShouldContain("defined twice"); + } + + [Fact] + public async Task FolderCatalog_UsesRequirementsLock_WhenPresent() + { + using var catalog = new TempCatalog(); + catalog.AddStage("eco", Scripts.EchoManifest, Scripts.Echo, requirements: "six\n", requirementsLock: "six==1.17.0\n"); + await using var host = RunnerHost.Create(fixture, b => b.AddFileCatalog(catalog.Root)); + + var stage = await host.Services.GetRequiredService().FindStageAsync("eco", 1, TestContext.Current.CancellationToken); + + stage!.Requirements.ShouldBe("six\n"); + stage.LockedRequirements.ShouldBe("six==1.17.0\n"); + stage.Script.ShouldBeOfType(); + } + + [Fact] + public void FluentStage_WithInvalidDefinition_FailsImmediately() + { + var services = new ServiceCollection(); + + var exception = Should.Throw(() => services.AddPythonScriptRunner() + .AddStage("Inválida", s => s.Script(Scripts.Echo).Input("Nome", FieldType.String))); + + exception.Message.ShouldContain("key must be a slug"); + exception.Message.ShouldContain("inputs.Nome"); + } +} diff --git a/tests/PythonScriptRunner.Core.Tests/Unit/SmallUnitTests.cs b/tests/PythonScriptRunner.Core.Tests/Unit/SmallUnitTests.cs new file mode 100644 index 0000000..fb51fb4 --- /dev/null +++ b/tests/PythonScriptRunner.Core.Tests/Unit/SmallUnitTests.cs @@ -0,0 +1,79 @@ +using System.Text; +using PythonScriptRunner.Core.Execution; + +namespace PythonScriptRunner.Core.Tests.Unit; + +public sealed class RetryPolicyTests +{ + [Fact] + public void GetDelay_DefaultsToTenSecondsDoubling_CappedAtTenMinutes() + { + var policy = RetryPolicy.None with { MaxAttempts = 5 }; + + policy.GetDelay(1).ShouldBe(TimeSpan.FromSeconds(10)); + policy.GetDelay(2).ShouldBe(TimeSpan.FromSeconds(20)); + policy.GetDelay(10).ShouldBe(RetryPolicy.MaxDelay); + } +} + +public sealed class LogCaptureTests +{ + [Fact] + public void TailBuffer_KeepsOnlyTheTail() + { + var buffer = new TailBuffer(4); + + buffer.Append("abc"u8); + buffer.Append("defg"u8); + buffer.Append("h"u8); + var tail = buffer.ToLogTail(SecretMasker.None); + + tail.Content.ShouldBe("efgh"); + tail.Truncated.ShouldBeTrue(); + tail.OriginalBytes.ShouldBe(8); + } + + [Fact] + public void TailBuffer_WithoutOverflow_IsNotTruncated() + { + var buffer = new TailBuffer(16); + + buffer.Append(Encoding.UTF8.GetBytes("olá")); + + buffer.ToLogTail(SecretMasker.None).ShouldBe(new LogTail("olá", false, 4)); + } + + [Fact] + public void SecretMasker_ReplacesValues_IgnoringTinyOnes() + { + var masker = new SecretMasker(["s3cr3t", "ab"]); + + masker.Mask("password=s3cr3t ab").ShouldBe("password=*** ab"); + } +} + +public sealed class FieldTypeTests +{ + [Fact] + public void Parse_RoundTripsEveryType() + { + FieldType[] types = + [ + FieldType.Number, FieldType.Integer, FieldType.Decimal, FieldType.String, FieldType.Bool, FieldType.Date, + FieldType.DateTime, FieldType.Json, FieldType.Table, FieldType.File, FieldType.Enum("a", "b"), + FieldType.ListOf(FieldType.Enum("x")), FieldType.ListOf(FieldType.File), + ]; + + foreach (var type in types) + { + FieldType.Parse(type.Kind == FieldKind.List ? "list" : type.WireName, type.ItemType?.WireName, type.EnumValues).ShouldBe(type); + } + } + + [Fact] + public void ListOf_RejectsNestedListsAndTables() + { + Should.Throw(() => FieldType.ListOf(FieldType.Table)); + Should.Throw(() => FieldType.ListOf(FieldType.ListOf(FieldType.Number))); + } +} diff --git a/tests/PythonScriptRunner.Core.Tests/Values/InputBinderTests.cs b/tests/PythonScriptRunner.Core.Tests/Values/InputBinderTests.cs new file mode 100644 index 0000000..73b982e --- /dev/null +++ b/tests/PythonScriptRunner.Core.Tests/Values/InputBinderTests.cs @@ -0,0 +1,155 @@ +using System.Text.Json.Nodes; +using PythonScriptRunner.Core.Values; + +namespace PythonScriptRunner.Core.Tests.Values; + +public sealed class InputBinderTests +{ + private const long MaxFile = 1024 * 1024; + + [Fact] + public void Spec001_AC02_MissingRequiredInput_ThrowsInputValidationException() + { + // Arrange + FieldDefinition[] fields = [new("n", FieldType.Integer)]; + + // Act + var exception = Should.Throw(() => InputBinder.Bind(fields, new { }, MaxFile)); + + // Assert + exception.Errors.ShouldHaveSingleItem().ShouldBe(new InputError("n", "MISSING_REQUIRED_INPUT", "required input is missing")); + } + + [Fact] + public void Bind_WithUndeclaredInput_ReportsIt() + { + FieldDefinition[] fields = [new("a", FieldType.Number)]; + + var exception = Should.Throw(() => InputBinder.Bind(fields, new { a = 1.0, b = 2 }, MaxFile)); + + exception.Errors.ShouldHaveSingleItem().Code.ShouldBe("UNDECLARED_INPUT"); + } + + [Fact] + public void Bind_ConvertsDotNetValuesToWireFormat() + { + // Arrange + FieldDefinition[] fields = + [ + new("numero", FieldType.Number), + new("inteiro", FieldType.Integer), + new("valor", FieldType.Decimal), + new("dia", FieldType.Date), + new("momento", FieldType.DateTime), + new("tipo", FieldType.Enum("aritmetica", "geometrica")), + new("tabela", FieldType.Table), + new("lista", FieldType.ListOf(FieldType.Integer)), + ]; + + // Act + var bound = InputBinder.Bind(fields, new + { + numero = 3, + inteiro = 42, + valor = 12.50m, + dia = new DateOnly(2026, 10, 19), + momento = new DateTimeOffset(2026, 10, 19, 14, 30, 0, TimeSpan.FromHours(-3)), + tipo = Tipo.Geometrica, + tabela = new[] { new Linha(1, 2.5) }, + lista = new List { 1, 2 }, + }, MaxFile); + + // Assert + var wire = bound.Wire; + wire["numero"]!.GetValue().ShouldBe(3.0); + wire["inteiro"]!.GetValue().ShouldBe(42); + wire["valor"]!.GetValue().ShouldBe("12.50"); + wire["dia"]!.GetValue().ShouldBe("2026-10-19"); + wire["momento"]!.GetValue().ShouldBe("2026-10-19T14:30:00.0000000-03:00"); + wire["tipo"]!.GetValue().ShouldBe("geometrica"); + wire["tabela"]!.ToJsonString().ShouldBe("""[{"i":1,"x":2.5}]"""); + wire["lista"]!.ToJsonString().ShouldBe("[1,2]"); + } + + [Theory] + [InlineData("number", "texto")] + [InlineData("integer", 1.5)] + [InlineData("decimal", 0.1)] + [InlineData("bool", 1)] + public void Bind_RejectsWrongTypes(string type, object value) + { + FieldDefinition[] fields = [new("x", FieldType.Parse(type))]; + + var exception = Should.Throw(() => InputBinder.Bind(fields, new Dictionary { ["x"] = value }, MaxFile)); + + exception.Errors.ShouldHaveSingleItem().Code.ShouldBe("TYPE_MISMATCH"); + } + + [Fact] + public void Bind_RejectsUnspecifiedDateTime_AndEnumOutsideValues() + { + FieldDefinition[] fields = [new("momento", FieldType.DateTime), new("tipo", FieldType.Enum("a"))]; + + var exception = Should.Throw(() => InputBinder.Bind(fields, new { momento = new DateTime(2026, 1, 1), tipo = "b" }, MaxFile)); + + exception.Errors.Select(e => e.Code).ShouldBe(["NAIVE_DATETIME", "ENUM_VALUE_INVALID"]); + } + + [Fact] + public void Bind_AppliesDefaults_AndSkipsAbsentOptionalInputs() + { + FieldDefinition[] fields = + [ + new("tipo", FieldType.Enum("a", "b")) { Required = false, Default = "b" }, + new("anexo", FieldType.File) { Required = false }, + ]; + + var bound = InputBinder.Bind(fields, null, MaxFile); + + bound.Wire.ToJsonString().ShouldBe("""{"tipo":"b"}"""); + bound.Files.ShouldBeEmpty(); + } + + [Fact] + public void Bind_Files_ChecksContentTypeAndSize() + { + FieldDefinition[] fields = [new("html", FieldType.File) { ContentTypes = ["text/html"] }]; + + var exception = Should.Throw(() => + InputBinder.Bind(fields, new { html = PsrFile.FromBytes(new byte[MaxFile + 1], "a.pdf", "application/pdf") }, MaxFile)); + + exception.Errors.Select(e => e.Code).ShouldBe(["CONTENT_TYPE_NOT_ALLOWED", "FILE_TOO_LARGE"]); + } + + [Fact] + public void Bind_FileList_KeepsOrderAndMetadata() + { + FieldDefinition[] fields = [new("anexos", FieldType.ListOf(FieldType.File))]; + + var bound = InputBinder.Bind(fields, new { anexos = new[] { PsrFile.FromText("a", "a.txt"), PsrFile.FromText("b", "b.txt") } }, MaxFile); + + bound.Files.Select(f => (f.Field, f.Index, f.File.FileName)).ShouldBe([("anexos", 0, "a.txt"), ("anexos", 1, "b.txt")]); + bound.Wire["anexos"]!.AsArray().Count.ShouldBe(2); + } + + [Fact] + public void Bind_AcceptsJsonObjectsAndRecordsWithPascalCaseProperties() + { + FieldDefinition[] fields = [new("nome_arquivo", FieldType.String), new("a1", FieldType.Number)]; + + var fromRecord = InputBinder.Bind(fields, new Entrada("relatorio.pdf", 1), MaxFile); + var fromJson = InputBinder.Bind(fields, new JsonObject { ["nome_arquivo"] = "relatorio.pdf", ["a1"] = 1 }, MaxFile); + + fromRecord.Wire.ToJsonString().ShouldBe(fromJson.Wire.ToJsonString()); + } + + private enum Tipo + { + Aritmetica, + Geometrica, + } + + private sealed record Linha(int I, double X); + + private sealed record Entrada(string NomeArquivo, double A1); +} diff --git a/tests/PythonScriptRunner.Core.Tests/Values/OutputContractTests.cs b/tests/PythonScriptRunner.Core.Tests/Values/OutputContractTests.cs new file mode 100644 index 0000000..f62d736 --- /dev/null +++ b/tests/PythonScriptRunner.Core.Tests/Values/OutputContractTests.cs @@ -0,0 +1,117 @@ +using System.Text.Json.Nodes; +using PythonScriptRunner.Core.Execution; +using PythonScriptRunner.Core.Values; + +namespace PythonScriptRunner.Core.Tests.Values; + +public sealed class OutputContractTests : IDisposable +{ + private readonly string _work = Path.Combine(Path.GetTempPath(), "psr-tests", "output", Guid.NewGuid().ToString("N")); + + public OutputContractTests() => Directory.CreateDirectory(Path.Combine(_work, "out")); + + [Fact] + public void Spec001_AC18_OutputFileOutsideOut_IsContractViolation() + { + // Arrange + File.WriteAllText(Path.Combine(_work, "segredo.txt"), "x"); + var request = Request([new FieldDefinition("arquivo", FieldType.File)]); + WriteOutput("""{"arquivo":{"$file":{"path":"out/../segredo.txt","name":"segredo.txt"}}}"""); + + // Act + var result = OutputReader.Read(request, 0, TimeSpan.Zero, LogTail.Empty, LogTail.Empty); + + // Assert + result.Status.ShouldBe(AttemptStatus.Failed); + result.Error!.Kind.ShouldBe(ErrorKind.OutputContractViolation); + result.Error.Code.ShouldBe("OUTPUT_FILE_OUTSIDE_OUT"); + } + + [Fact] + public void Read_UndeclaredOutput_IsContractViolation() + { + var request = Request([new FieldDefinition("x", FieldType.Number)]); + WriteOutput("""{"x":1,"extra":2}"""); + + var result = OutputReader.Read(request, 0, TimeSpan.Zero, LogTail.Empty, LogTail.Empty); + + result.Error!.Code.ShouldBe("UNDECLARED_OUTPUT"); + result.Error.Message.ShouldContain("extra"); + } + + [Fact] + public void Read_MissingOutputJson_IsProcessCrashed() + { + var request = Request([]); + + var result = OutputReader.Read(request, 3, TimeSpan.Zero, LogTail.Empty, LogTail.Empty); + + result.Error!.Kind.ShouldBe(ErrorKind.ProcessCrashed); + result.ExitCode.ShouldBe(3); + } + + [Fact] + public void Read_ValidFile_ReturnsMetadataWithHash() + { + File.WriteAllText(Path.Combine(_work, "out", "a.txt"), "abc"); + var request = Request([new FieldDefinition("a", FieldType.File)]); + WriteOutput("""{"a":{"$file":{"path":"out/a.txt","name":"a.txt","contentType":"text/plain"}}}"""); + + var result = OutputReader.Read(request, 0, TimeSpan.Zero, LogTail.Empty, LogTail.Empty); + + result.Status.ShouldBe(AttemptStatus.Succeeded); + var file = result.Files.ShouldHaveSingleItem(); + file.Sha256.ShouldBe("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"); + result.Outputs!["a"]!["$file"]!["size"]!.GetValue().ShouldBe(3); + } + + [Theory] + [InlineData("decimal", "\"12.5\"", true)] + [InlineData("decimal", "12.5", false)] + [InlineData("datetime", "\"2026-10-19T10:00:00-03:00\"", true)] + [InlineData("datetime", "\"2026-10-19T10:00:00Z\"", true)] + [InlineData("datetime", "\"2026-10-19T10:00:00\"", false)] + [InlineData("date", "\"2026-10-19\"", true)] + [InlineData("integer", "1.5", false)] + [InlineData("number", "1", true)] + public void WireValidator_ChecksScalars(string type, string json, bool valid) + { + var errors = new List(); + + WireValidator.Validate(JsonNode.Parse(json), new FieldDefinition("x", FieldType.Parse(type)), "x", errors); + + (errors.Count == 0).ShouldBe(valid); + } + + [Fact] + public void WireValidator_ChecksTableColumns() + { + var field = new FieldDefinition("t", FieldType.Table) { Columns = [new TableColumn("i", FieldType.Integer)] }; + var errors = new List(); + + WireValidator.Validate(JsonNode.Parse("""[{"i":1},{"j":2}]"""), field, "t", errors); + + errors.ShouldHaveSingleItem().Code.ShouldBe("MISSING_COLUMN"); + } + + public void Dispose() => Directory.Delete(_work, recursive: true); + + private void WriteOutput(string outputs) => + File.WriteAllText(Path.Combine(_work, "output.json"), $$"""{"protocol":1,"status":"ok","outputs":{{outputs}}}"""); + + private ExecutionRequest Request(FieldDefinition[] outputs) => new() + { + Stage = new StageDefinition { Key = "test", Version = 1, Name = "test", Script = ScriptSource.Inline("x"), Outputs = outputs }, + Environment = new PythonEnvironment("hash", _work, "python", false), + RunId = RunId.New(), + StepKey = "test", + Attempt = 1, + WorkDirectory = _work, + Inputs = [], + Timeout = TimeSpan.FromMinutes(1), + MemoryLimitMb = 256, + MaxFileBytes = 1024, + FileBudgetBytes = 4096, + MaxLogBytes = 1024, + }; +}