Python lint here was a property of the operator's laptop, not of the repo: the global instructions say to run `ruff check`/`ruff format --check`/`pyright`, no workflow or hook ran any of them, and with no committed config ruff fell back to whichever `~/.config/ruff/ruff.toml` the machine happened to have. A second machine lints this repo differently, or not at all — Family E in docs/defect-shapes-773.md, in our own toolchain. Option 1 from the issue: - `ruff.toml` at the root (the operator's global settings, pinned here — that is what the tree was de-facto written against, so adopting it cost a mechanical reformat rather than a rewrite). - The `script-tests` job installs a PINNED `ruff==0.12.11` and runs `ruff check .` + `ruff format --check .` before pytest, so a style red arrives in seconds instead of after the four-minute suite. The pin is the second half of the fix: an unpinned install re-introduces the same divergence one layer up. Renamed the job to `Script lint and tests (ruff + pytest)` so a lint red is not triaged under a name that says pytest. - Tree made clean: 72 errors and 20 files needing reformatting. Everything fixed except two config-level exemptions with reasons in the config (`S101`, `S105` under `scripts/tests/**` — the stub credentials that fire `S105` have no true positive anywhere in the tree) and two per-site `# noqa`s that carry their reason inline. `pyright` stays ungated: its only findings are `reportMissingImports` for `etv_client` in scripts/scripted-schedules/entrypoint.py, resolvable only in that script's deploy environment, and gating it would put a node toolchain on the git-only `small` lane to find nothing. Population is what `ruff check .` discovers from the root, so a new `.py` anywhere is covered without the job enumerating anything. Docs: new record `ci.python-lint-ruff-config-committed`, cross-ref from `ci.script-tests-job`, `docs/ci-cd.md` script-tests section, and `docs/defect-shapes-773.md` §5.2 marked resolved with the measured numbers. Refs: #780 Decisions-Edit: yes
54 lines
2.0 KiB
Python
Executable File
54 lines
2.0 KiB
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import argparse
|
|
import importlib
|
|
import sys
|
|
from uuid import UUID
|
|
|
|
import etv_client
|
|
from etv_client.api import ScriptedScheduleApi
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description="Run an ETV scripted schedule")
|
|
parser.add_argument("host", help="The ETV host (e.g., http://localhost:8409)")
|
|
parser.add_argument("build_id", type=UUID, help="The build ID for the playout")
|
|
parser.add_argument("mode", choices=["reset", "continue"], help="The playout build mode")
|
|
parser.add_argument("script_name", help="The name of the script module to use (e.g., one)")
|
|
|
|
known_args, unknown_args = parser.parse_known_args()
|
|
|
|
try:
|
|
script_module = importlib.import_module(f"scripts.{known_args.script_name}")
|
|
except ImportError:
|
|
print(f"Error: cannot find a script file named '{known_args.script_name}.py' in the 'scripts' directory.")
|
|
sys.exit(1)
|
|
|
|
configuration = etv_client.Configuration(host=known_args.host)
|
|
|
|
with etv_client.ApiClient(configuration) as api_client:
|
|
try:
|
|
define_content = script_module.define_content
|
|
reset_playout = script_module.reset_playout
|
|
build_playout = script_module.build_playout
|
|
|
|
api_instance = ScriptedScheduleApi(api_client)
|
|
|
|
context = api_instance.get_context(known_args.build_id)
|
|
|
|
define_content(api_instance, context, known_args.build_id)
|
|
|
|
if known_args.mode == "reset":
|
|
new_context = reset_playout(api_instance, context, known_args.build_id)
|
|
context = new_context or api_instance.get_context(known_args.build_id)
|
|
|
|
build_playout(api_instance, context, known_args.build_id)
|
|
except etv_client.ApiException as e:
|
|
print(f"Exception when calling scripted schedule api: {e}\n")
|
|
except AttributeError as e:
|
|
print(f"Error: the '{known_args.script_name}' script is missing a required function. {e}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|