diff --git a/AGENTS.md b/AGENTS.md index 1e3252e..960a18b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -24,6 +24,12 @@ and a Gradescope autograder zip. Alpha: the API changes without deprecation. maturin builds it into platform wheels together with `src/mogs/`. The version is `[workspace.package] version` in `Cargo.toml`. `src/mogs/_binary.py` finds and runs the installed executable. +- `crates/mogs-schema/`: the JSON messages between the `mogs` executable and + Python (job, events, bundle, inspect, `results.json`) as Rust types. Every + message but `results.json` has `"schema": 1`: bump `SCHEMA` there and in + `src/mogs/grader/wire.py` together. `schemas/` holds the JSON Schemas + generated from the types. `MOGS_BLESS=1 cargo test` rewrites them, and + `tests/test_schemas.py` checks what Python writes against them. - `tests/`: pytest suite. `cargo test` runs the Rust tests. - `tests/e2e/`: end-to-end tests. The `docker` ones build the demo autograder into Gradescope's base image (`tests/e2e/Dockerfile`) and grade submissions diff --git a/Cargo.lock b/Cargo.lock index de1ff0b..34ce327 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,6 +20,18 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + [[package]] name = "errno" version = "0.3.15" @@ -36,6 +48,12 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "getrandom" version = "0.4.3" @@ -47,6 +65,30 @@ dependencies = [ "r-efi", ] +[[package]] +name = "hashbrown" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735eaa21a6a5ffb2e84362faaeb90c05ba8e19797ca30428478cb6ea3a4921bc" + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown", + "serde", + "serde_core", +] + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + [[package]] name = "libc" version = "0.2.191" @@ -59,6 +101,12 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + [[package]] name = "mogs" version = "0.7.0" @@ -68,18 +116,66 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "mogs-schema" +version = "0.7.0" +dependencies = [ + "indexmap", + "schemars", + "serde", + "serde_json", +] + [[package]] name = "once_cell" version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + [[package]] name = "r-efi" version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "rustix" version = "1.1.6" @@ -93,6 +189,99 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "schemars" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e" +dependencies = [ + "dyn-clone", + "indexmap", + "ref-cast", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1c3a92094fa7d61aa124645844facb6b554dfc797136d0f5fd1f890e2bffc69" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_derive_internals" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "foldhash", + "indexmap", + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "tempfile" version = "3.27.0" @@ -106,6 +295,12 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + [[package]] name = "windows-link" version = "0.2.1" @@ -120,3 +315,9 @@ checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ "windows-link", ] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/Cargo.toml b/Cargo.toml index 321ed43..005ce41 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["crates/mogs"] +members = ["crates/mogs", "crates/mogs-schema"] resolver = "3" [workspace.package] diff --git a/crates/mogs-schema/Cargo.toml b/crates/mogs-schema/Cargo.toml new file mode 100644 index 0000000..db293e6 --- /dev/null +++ b/crates/mogs-schema/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "mogs-schema" +description = "The JSON messages between the mogs executable and its Python processes." +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +publish = false + +[dependencies] +indexmap = { version = "2", features = ["serde"] } +schemars = { version = "1", features = ["indexmap2", "preserve_order"] } +serde = { version = "1", features = ["derive"] } +serde_json = "1" diff --git a/crates/mogs-schema/src/bundle.rs b/crates/mogs-schema/src/bundle.rs new file mode 100644 index 0000000..23308f6 --- /dev/null +++ b/crates/mogs-schema/src/bundle.rs @@ -0,0 +1,94 @@ +//! The tests the grader runs, as `mogs.grader.bundle.GradingBundle` writes them. + +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +/// Everything a grading child needs besides the submission. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] +pub struct Bundle { + /// Format version, `SCHEMA`. + #[serde(deserialize_with = "crate::version")] + #[schemars(extend("const" = crate::SCHEMA))] + pub schema: u32, + /// The assignment config the grader needs. + pub config: BundleConfig, + /// Body of the notebook's setup cell, run before the test cells. + pub setup_code: String, + /// Test cells in file order. + pub cells: Vec, + /// Hidden cells without tests, in file order. + pub helpers: Vec, +} + +/// The assignment config, without the host path of `requirements`. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] +pub struct BundleConfig { + /// Assignment name. + pub name: String, + /// File name of the source notebook. + pub notebook: String, + /// Questions in notebook order. + pub questions: Vec, + /// Data files and folders shipped with the notebook, relative to it. + pub files: Vec, + /// Seconds per test. + pub timeout: f64, + /// Seconds for the whole grading run. + pub budget: f64, + /// MB per grading process. + pub memory_mb: u32, + /// Python version on Gradescope. + pub python: String, +} + +/// One question of the config. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] +pub struct BundleQuestion { + /// Question id, e.g. `q1`. + pub id: String, + /// Question title. + pub title: String, + /// Points for the question. + pub points: f64, + /// Whether the question is graded by hand. + pub manual: bool, +} + +/// One test cell of the source notebook. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] +pub struct TestCell { + /// Question id of the cell's tests. + pub qid: String, + /// The file name the runner compiles the cell under, which tracebacks and syntax errors + /// show: `-tests` for a cell of the notebook, the path relative to the notebook for + /// a public test file (as `selfcheck` runs it). + pub label: String, + /// Whether the cell is marked `# HIDDEN`. + pub hidden: bool, + /// Cell body, run as a module. + pub source: String, + /// Test function names, in file order. + pub tests: Vec, + /// Student names the cell refers to, bound from the submission. + pub uses: Vec, + /// Names the cell reads from hidden helpers. Empty for public cells. + pub needs: Vec, +} + +/// A `# HIDDEN` cell without tests, such as data or helpers for hidden tests. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] +pub struct HiddenHelper { + /// Cell body, run as a module. + pub source: String, + /// Names the cell binds at top level. + pub defines: Vec, + /// Student names the cell refers to, bound from the submission. + pub uses: Vec, + /// Names the cell reads from other hidden helpers. + pub needs: Vec, +} diff --git a/crates/mogs-schema/src/event.rs b/crates/mogs-schema/src/event.rs new file mode 100644 index 0000000..8f23d37 --- /dev/null +++ b/crates/mogs-schema/src/event.rs @@ -0,0 +1,46 @@ +//! The lines a grading child writes, as `mogs.grader.protocol.encode` writes them. + +use indexmap::IndexMap; + +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use crate::Outcome; + +/// One event line: the format version and the event. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct EventLine { + /// Format version, `SCHEMA`. + #[serde(deserialize_with = "crate::version")] + #[schemars(extend("const" = crate::SCHEMA))] + pub schema: u32, + /// The event. + #[serde(flatten)] + pub event: Event, +} + +/// What a grading child reports, tagged by `"event"`. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(tag = "event", rename_all = "snake_case", deny_unknown_fields)] +pub enum Event { + /// Once, after setup and binding: the child is ready, or failed to set up. + Loaded { + /// Why setup failed, `None` when it worked. + #[serde(deserialize_with = "Option::deserialize")] + error: Option, + /// Each name the tests use that the submission could not provide, with why. + unavailable: IndexMap, + }, + /// Before loading a test cell and the hidden helpers it needs. + Loading { + /// The cell's tests that will run. + tests: Vec, + }, + /// Before each test. + Start { + /// The test. + test: String, + }, + /// After each test, with the outcome's fields next to `event`. + Result(Outcome), +} diff --git a/crates/mogs-schema/src/inspect.rs b/crates/mogs-schema/src/inspect.rs new file mode 100644 index 0000000..c9be4ec --- /dev/null +++ b/crates/mogs-schema/src/inspect.rs @@ -0,0 +1,189 @@ +//! What the notebook functions need to know about a saved notebook, read without running it. +//! +//! Each field names the Python call site it serves. + +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use crate::Bundle; + +/// A saved notebook, source or student copy, as the Python notebook functions see it. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] +pub struct Inspect { + /// Format version, `SCHEMA`. + #[serde(deserialize_with = "crate::version")] + #[schemars(extend("const" = crate::SCHEMA))] + pub schema: u32, + /// Why the notebook does not parse (`SourceError`). `assignment.assignment` lists it as + /// the problem; `export.package` warns that no answer could be read; `selfcheck.main` + /// exits with it. + #[serde(deserialize_with = "Option::deserialize")] + pub source_error: Option, + /// Why the config calls are invalid (`ConfigError`). `assignment.assignment` lists it as + /// the problem; `check._written_in_source` raises it. + #[serde(deserialize_with = "Option::deserialize")] + pub config_error: Option, + /// The config, `None` when `config_error` is set. `assignment.summary` titles the panel + /// with it. + #[serde(deserialize_with = "Option::deserialize")] + pub config: Option, + /// What the build would refuse: `source.validate` and the data-file check + /// (`assignment._data_problems`). `assignment.assignment` lists them. + pub problems: Vec, + /// The config's questions in notebook order, empty without a config. `assignment.summary` + /// has a row per question; `check._written_in_source` reads `manual` by id. + pub questions: Vec, + /// Every cell whose name starts with `answer_`, in file order, whatever the grade calls + /// and the config say. `export.unanswered_lines` and `export.answers_markdown` pick each + /// manual question's cells from them by name, as `Notebook.answer_cells` does. + pub answers: Vec, + /// The public test files that grade calls name (`selfcheck.test_files`). + /// `check.file_outcomes` and `selfcheck.public_results` run them; `selfcheck` fails the + /// unreadable ones. + pub test_files: Vec, + /// What `selfcheck.public_results` runs: the public phase of the notebook's bundle, then a + /// public cell for each readable test file, labelled with its path. `None` when + /// `source_error` is set. + #[serde(deserialize_with = "Option::deserialize")] + pub public_job: Option, +} + +/// The config fields the notebook functions use. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] +pub struct InspectConfig { + /// Assignment name. `assignment.summary` and `assignment._problems` title the panel. + pub name: String, +} + +/// One question of the config, with its tests and prompts. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] +pub struct InspectQuestion { + /// Question id, e.g. `q1`. + pub id: String, + /// Question title, shown by `assignment.summary`. + pub title: String, + /// Points, shown and added up by `assignment.summary`. + pub points: f64, + /// Whether it is graded by hand. `assignment.summary` shows it as written; + /// `check._written_in_source` reads it. + pub manual: bool, + /// Public test names in file order (`Notebook.tests_by_question`), counted by + /// `assignment.summary`. + pub public: Vec, + /// Hidden test names in file order, counted by `assignment.summary`. + pub hidden: Vec, + /// The first line of each prompt cell of a written question (`source.prompt_previews`), + /// listed by `assignment.summary`. + pub prompts: Vec, +} + +/// One answer cell: a cell whose name starts with `answer_`. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] +pub struct Answer { + /// Cell name, e.g. `answer_q3` or `answer_q3_2`. `export` picks the cells of question + /// `` as `Notebook.answer_cells` does, by the name `answer_` or a name starting + /// with `answer__`, and looks each cell's placeholder up by its name. The name alone + /// does not tell the question, since ids may hold `_`. + pub cell: String, + /// The Markdown of a cell that is just `mo.md("...")`, `None` for other code + /// (`source.answer_text`). `export` checks it against the placeholder and writes it. + #[serde(deserialize_with = "Option::deserialize")] + pub text: Option, + /// The cell's lines as written (`source.cell_source`). `export.answers_markdown` shows a + /// code answer, one whose `text` is `None`, as this source. + pub source: String, +} + +/// A file of public tests that a grade call names as `test_file`. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] +pub struct TestFile { + /// Question id of the grade call. + pub qid: String, + /// The path as the grade call gives it, relative to the notebook's folder. + pub path: String, + /// Test function names in file order (`source.module_tests`), which `check.file_outcomes` + /// runs. + pub tests: Vec, + /// Why the file cannot be read or parsed, `None` when it can. `check.file_outcomes` shows + /// it; `selfcheck.public_results` fails the file with it. + #[serde(deserialize_with = "Option::deserialize")] + pub error: Option, +} + +/// Why a test file cannot be read or parsed, tagged by `"kind"`. It carries data, not text: +/// each call site words it itself. +/// +/// `selfcheck.public_results` fails the file with `cannot read ()`, where the +/// summary is `runner.exception_summary` of the exception Python would have raised, rebuilt +/// from the variant as each variant says. `` below is the notebook's folder joined with +/// `path`. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)] +pub enum TestFileError { + /// The file does not exist. `check.file_outcomes`: `Cannot find next to + /// . Keep the `tests` folder of the assignment next to the notebook.` + /// `selfcheck`: the exception is `FileNotFoundError(ENOENT, os.strerror(ENOENT), )`. + Missing {}, + /// The file exists but cannot be read. `check.file_outcomes`: `Cannot read : + /// `. Both call sites rebuild the exception as + /// `OSError(errno, os.strerror(errno), )`, which picks the subclass, such as + /// `PermissionError`. + Unreadable { + /// The C `errno`, as Python's `OSError.errno` gives it. + errno: i32, + }, + /// The file is not UTF-8. `check.file_outcomes`: `Cannot read : `. Both + /// call sites rebuild the exception as + /// `UnicodeDecodeError("utf-8", bytes(start) + bytes, start, start + len(bytes), )`: + /// the zero padding puts `bytes` at `start`, so `str()` reads them where Python's decoder + /// found them. + NotUtf8 { + /// Byte offset of the first byte that does not decode, `UnicodeDecodeError.start`. + start: u64, + /// The bytes that do not decode, `object[start:end]` of the `UnicodeDecodeError`. + bytes: Vec, + /// Why they do not decode. + reason: Utf8Reason, + }, + /// The file is not valid Python. `check.file_outcomes`: ` is not valid Python (line + /// ).` `selfcheck`: the exception is `(message, ("", line, None, + /// None))`, as `ast.parse` raises it. + Syntax { + /// Which `SyntaxError` class `ast.parse` raised. + class: SyntaxClass, + /// Line of the error, from 1, `SyntaxError.lineno`. + line: u32, + /// Python's message for it, `SyntaxError.msg`, such as `invalid syntax`. + message: String, + }, +} + +/// The class of a `SyntaxError` that `ast.parse` raises. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub enum SyntaxClass { + /// `SyntaxError`. + SyntaxError, + /// `IndentationError`. + IndentationError, + /// `TabError`. + TabError, +} + +/// Why bytes are not UTF-8: the `reason` of Python's `UnicodeDecodeError`, with spaces as +/// underscores. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub enum Utf8Reason { + /// `invalid start byte`. + InvalidStartByte, + /// `invalid continuation byte`. + InvalidContinuationByte, + /// `unexpected end of data`. + UnexpectedEndOfData, +} diff --git a/crates/mogs-schema/src/job.rs b/crates/mogs-schema/src/job.rs new file mode 100644 index 0000000..bfb0bb8 --- /dev/null +++ b/crates/mogs-schema/src/job.rs @@ -0,0 +1,30 @@ +//! What one grading child runs, as `mogs.grader.protocol.Job` writes it. + +use std::path::PathBuf; + +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use crate::Bundle; + +/// What one grading child runs. The parent writes it as JSON to the child's stdin. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] +pub struct Job { + /// Format version, `SCHEMA`. + #[serde(deserialize_with = "crate::version")] + #[schemars(extend("const" = crate::SCHEMA))] + pub schema: u32, + /// The bundle of one phase. + pub bundle: Bundle, + /// The student's notebook. + pub submission: PathBuf, + /// Tests already done, e.g. by an earlier child that died. + pub skip: Vec, + /// Why an earlier child died while running the whole notebook. When set, the child does + /// not run it again. + #[serde(deserialize_with = "Option::deserialize")] + pub run_failed: Option, + /// Whether the child times each test itself with an alarm. + pub alarm: bool, +} diff --git a/crates/mogs-schema/src/lib.rs b/crates/mogs-schema/src/lib.rs new file mode 100644 index 0000000..4fc33bd --- /dev/null +++ b/crates/mogs-schema/src/lib.rs @@ -0,0 +1,210 @@ +//! The JSON messages between the `mogs` executable and its Python processes. +//! +//! These types are the source of truth: the JSON Schemas in the repo's `schemas/` folder are +//! generated from them (see [`schemas`]). Every message except [`Results`] carries `"schema"`, +//! the format version [`SCHEMA`]. Fields serialize in the order Python writes its keys. + +mod bundle; +mod event; +mod inspect; +mod job; +mod outcome; +mod results; + +use std::collections::BTreeSet; +use std::fmt; + +use schemars::transform::{RecursiveTransform, Transform}; +use schemars::{JsonSchema, Schema, schema_for}; +use serde::de::{DeserializeOwned, Error as _}; +use serde::{Deserialize, Deserializer}; +use serde_json::Value; + +pub use bundle::{Bundle, BundleConfig, BundleQuestion, HiddenHelper, TestCell}; +pub use event::{Event, EventLine}; +pub use inspect::{ + Answer, Inspect, InspectConfig, InspectQuestion, SyntaxClass, TestFile, TestFileError, + Utf8Reason, +}; +pub use job::Job; +pub use outcome::{FailureReason, Outcome}; +pub use results::{Results, Row}; + +/// Version of the message formats. Bump it on any change a reader of the old format would +/// misread. +pub const SCHEMA: u32 = 1; + +/// Why a message could not be read. +#[derive(Debug)] +pub enum WireError { + /// The text is not JSON, or not the expected message. + Json(serde_json::Error), + /// The message has no `schema` key. + MissingVersion, + /// The message is of another format version. + Version(Value), +} + +impl fmt::Display for WireError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + WireError::Json(error) => write!(f, "{error}"), + WireError::MissingVersion => write!(f, "missing schema version, expected {SCHEMA}"), + WireError::Version(found) => write!(f, "schema version {found}, expected {SCHEMA}"), + } + } +} + +impl std::error::Error for WireError {} + +impl From for WireError { + fn from(error: serde_json::Error) -> Self { + WireError::Json(error) + } +} + +/// Parse a message, checking its `schema` version before its other fields. +/// +/// # Errors +/// +/// If the text is not JSON, has no `schema` key or another version, or is not a `T`. +pub fn decode(text: &str) -> Result { + let value: Value = serde_json::from_str(text)?; + + match value.get("schema") { + None => return Err(WireError::MissingVersion), + Some(found) if found.as_u64() != Some(SCHEMA.into()) => { + return Err(WireError::Version(found.clone())); + } + Some(_) => {} + } + + Ok(serde_json::from_value(value)?) +} + +/// Read a `schema` field, failing on any version but `SCHEMA` with the text `decode` uses. +/// This also checks the messages nested in another, such as a job's bundle. +fn version<'de, D: Deserializer<'de>>(deserializer: D) -> Result { + let found = Value::deserialize(deserializer)?; + + match found.as_u64() == Some(SCHEMA.into()) { + true => Ok(SCHEMA), + false => Err(D::Error::custom(WireError::Version(found))), + } +} + +/// Read a key that may be left out but is never `null`. +fn present<'de, D: Deserializer<'de>, T: Deserialize<'de>>( + deserializer: D, +) -> Result, D::Error> { + T::deserialize(deserializer).map(Some) +} + +/// The JSON Schema of each message, by the file stem it is checked in under. +/// +/// Every key of a versioned message is required, `null` ones included, as Python writes them +/// all and `decode` requires them. `results.json` leaves out the keys Gradescope does not need. +/// No schema allows a key it does not name, as `decode` rejects them too. +pub fn schemas() -> Vec<(&'static str, Schema)> { + vec![ + ("job", versioned::()), + ("event", versioned::()), + ("bundle", versioned::()), + ("results", closed(schema_for!(Results))), + ("inspect", versioned::()), + ] +} + +/// The schema of a versioned message. schemars lists `Option` fields as optional even when +/// serde requires them (`deserialize_with = "Option::deserialize"`), so this marks every key +/// required. +fn versioned() -> Schema { + let mut schema = schema_for!(T); + RecursiveTransform(require_all).transform(&mut schema); + + closed(schema) +} + +/// Make every property of an object schema required. +fn require_all(schema: &mut Schema) { + let Some(Value::Object(properties)) = schema.get("properties") else { + return; + }; + let keys: Vec = properties.keys().cloned().map(Value::String).collect(); + + schema.insert("required".into(), Value::Array(keys)); +} + +/// `schema` with `unevaluatedProperties: false` on each object schema that stands alone. +/// +/// A `oneOf`, `anyOf` or `allOf` branch stays open, and so does a definition that a branch +/// merges in by `$ref` next to its own properties (a flattened struct): the schema around +/// them names the other keys, and its `unevaluatedProperties` sees the keys they name. +fn closed(schema: Schema) -> Schema { + let mut value = schema.to_value(); + let mut merged = BTreeSet::new(); + merged_refs(&value, &mut merged); + + if let Some(Value::Object(definitions)) = value.get_mut("$defs") { + for (name, definition) in definitions { + close(definition, !merged.contains(&format!("#/$defs/{name}"))); + } + } + + close(&mut value, true); + + Schema::try_from(value).expect("a schema stays an object") +} + +/// The `$ref` targets of schemas that also have their own `properties`. +fn merged_refs(value: &Value, found: &mut BTreeSet) { + match value { + Value::Object(object) => { + if let (Some(Value::String(target)), true) = + (object.get("$ref"), object.contains_key("properties")) + { + found.insert(target.clone()); + } + + object.values().for_each(|child| merged_refs(child, found)); + } + Value::Array(items) => items.iter().for_each(|child| merged_refs(child, found)), + _ => {} + } +} + +/// Close `value` when it stands `alone` and describes an object, then its subschemas. +/// `closed` handles `$defs`. +fn close(value: &mut Value, alone: bool) { + let Value::Object(object) = value else { + return; + }; + + let branches_have_properties = ["oneOf", "anyOf"].iter().any(|key| { + object + .get(*key) + .and_then(Value::as_array) + .is_some_and(|branches| branches.iter().any(|b| b.get("properties").is_some())) + }); + + if alone && (object.contains_key("properties") || branches_have_properties) { + object.insert("unevaluatedProperties".into(), Value::Bool(false)); + } + + for (key, child) in object.iter_mut() { + match key.as_str() { + "properties" => { + if let Value::Object(properties) = child { + properties.values_mut().for_each(|p| close(p, true)); + } + } + "items" | "additionalProperties" => close(child, true), + "oneOf" | "anyOf" | "allOf" => { + if let Value::Array(branches) = child { + branches.iter_mut().for_each(|b| close(b, false)); + } + } + _ => {} + } + } +} diff --git a/crates/mogs-schema/src/outcome.rs b/crates/mogs-schema/src/outcome.rs new file mode 100644 index 0000000..f3273e5 --- /dev/null +++ b/crates/mogs-schema/src/outcome.rs @@ -0,0 +1,43 @@ +//! The result of one test, as `mogs.runner.Outcome` writes it. + +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +/// Why a test did not pass. The values are `mogs.runner.FailureReason`'s. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub enum FailureReason { + /// An `assert` failed. + Assertion, + /// The test raised another exception. + Error, + /// The test ran past its time limit. + Timeout, + /// The process running the test died. + Killed, + /// The test ran out of memory. + OutOfMemory, + /// The grading run's time budget ran out. + Budget, + /// The test's cell, or what it needs, failed to load. + LoadFailed, + /// The test never ran. + NotRun, +} + +/// The result of one test. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] +pub struct Outcome { + /// Test name. + pub name: String, + /// Whether the test passed. + pub passed: bool, + /// Failure message, empty when passed. + pub message: String, + /// Why the test failed, `None` when passed. + #[serde(deserialize_with = "Option::deserialize")] + pub reason: Option, + /// Wall time spent in the test. + pub seconds: f64, +} diff --git a/crates/mogs-schema/src/results.rs b/crates/mogs-schema/src/results.rs new file mode 100644 index 0000000..8c979b3 --- /dev/null +++ b/crates/mogs-schema/src/results.rs @@ -0,0 +1,72 @@ +//! Gradescope's `results.json`, as `mogs.grader.results` writes it. It has no `schema` key. + +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +/// The content of `results.json`. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] +pub struct Results { + /// One row per entry Gradescope shows. + pub tests: Vec, + /// Who sees the grader's stdout. + pub stdout_visibility: String, + /// The total, set only when `tests` is empty. + #[serde( + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "crate::present" + )] + #[schemars(with = "f64")] + pub score: Option, + /// The score summary for students. + #[serde( + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "crate::present" + )] + #[schemars(with = "String")] + pub output: Option, + /// Format of `output`. + #[serde( + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "crate::present" + )] + #[schemars(with = "String")] + pub output_format: Option, +} + +/// One entry of `tests` in `results.json`, with its keys in the order `results.row` adds them. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] +pub struct Row { + /// Row title. + pub name: String, + /// Points earned. + pub score: f64, + /// Points possible. + pub max_score: f64, + /// Text under the row. + pub output: String, + /// Format of `output`. + pub output_format: String, + /// Who sees the row. + pub visibility: String, + /// Question id shown next to the title. + #[serde( + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "crate::present" + )] + #[schemars(with = "String")] + pub number: Option, + /// `failed` marks the row as failed. + #[serde( + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "crate::present" + )] + #[schemars(with = "String")] + pub status: Option, +} diff --git a/crates/mogs-schema/tests/schemas.rs b/crates/mogs-schema/tests/schemas.rs new file mode 100644 index 0000000..61a7523 --- /dev/null +++ b/crates/mogs-schema/tests/schemas.rs @@ -0,0 +1,458 @@ +//! The wire types round trip, reject other versions, and match the checked-in schemas. + +use std::fmt::Debug; +use std::path::{Path, PathBuf}; + +use indexmap::IndexMap; +use mogs_schema::{ + Answer, Bundle, BundleConfig, BundleQuestion, Event, EventLine, FailureReason, HiddenHelper, + Inspect, InspectConfig, InspectQuestion, Job, Outcome, Results, Row, SCHEMA, SyntaxClass, + TestCell, TestFile, TestFileError, Utf8Reason, decode, schemas, +}; +use serde::Serialize; +use serde::de::DeserializeOwned; +use serde_json::{Map, Value}; + +fn bundle() -> Bundle { + Bundle { + schema: SCHEMA, + config: BundleConfig { + name: "hw".into(), + notebook: "hw.py".into(), + questions: vec![BundleQuestion { + id: "q1".into(), + title: "Question 1".into(), + points: 2.5, + manual: false, + }], + files: vec!["data.csv".into()], + timeout: 60.0, + budget: 540.0, + memory_mb: 4096, + python: "3.13".into(), + }, + setup_code: "import math\n".into(), + cells: vec![TestCell { + qid: "q1".into(), + label: "q1-tests".into(), + hidden: true, + source: "def test_q1_a():\n assert add(1, 1) == 2\n".into(), + tests: vec!["test_q1_a".into()], + uses: vec!["add".into()], + needs: vec!["secret".into()], + }], + helpers: vec![HiddenHelper { + source: "secret = 1\n".into(), + defines: vec!["secret".into()], + uses: vec![], + needs: vec![], + }], + } +} + +fn outcome() -> Outcome { + Outcome { + name: "test_q1_a".into(), + passed: false, + message: "AssertionError".into(), + reason: Some(FailureReason::OutOfMemory), + seconds: 0.5, + } +} + +fn round_trip(value: T) { + let text = serde_json::to_string(&value).unwrap(); + + assert_eq!(decode::(&text).unwrap(), value, "{text}"); +} + +#[test] +fn round_trips_each_type() { + round_trip(bundle()); + round_trip(Job { + schema: SCHEMA, + bundle: bundle(), + submission: PathBuf::from("/tmp/submission.py"), + skip: vec!["test_q1_b".into()], + run_failed: Some("exit code 3".into()), + alarm: true, + }); + + let events = [ + Event::Loaded { + error: None, + unavailable: IndexMap::from([ + ("y".into(), "it raised".into()), + ("x".into(), "no cell defines it".into()), + ]), + }, + Event::Loading { + tests: vec!["test_q1_a".into()], + }, + Event::Start { + test: "test_q1_a".into(), + }, + Event::Result(outcome()), + ]; + + for event in events { + round_trip(EventLine { + schema: SCHEMA, + event, + }); + } + + round_trip(inspect()); +} + +fn inspect() -> Inspect { + let failed = |error| TestFile { + qid: "q1".into(), + path: "tests/q1.py".into(), + tests: vec![], + error: Some(error), + }; + + Inspect { + schema: SCHEMA, + source_error: None, + config_error: None, + config: Some(InspectConfig { name: "hw".into() }), + problems: vec!["line 3: bad".into()], + questions: vec![InspectQuestion { + id: "q2".into(), + title: "Question 2".into(), + points: 3.0, + manual: true, + public: vec![], + hidden: vec![], + prompts: vec!["Explain why.".into()], + }], + answers: vec![Answer { + cell: "answer_q2".into(), + text: Some("Because.".into()), + source: "@app.cell\ndef answer_q2():\n mo.md(\"Because.\")\n".into(), + }], + test_files: vec![ + TestFile { + qid: "q1".into(), + path: "tests/q1.py".into(), + tests: vec!["test_q1_a".into()], + error: None, + }, + failed(TestFileError::Missing {}), + failed(TestFileError::Unreadable { errno: 13 }), + failed(TestFileError::NotUtf8 { + start: 3, + bytes: vec![0xff], + reason: Utf8Reason::InvalidStartByte, + }), + failed(TestFileError::Syntax { + class: SyntaxClass::TabError, + line: 2, + message: "inconsistent use of tabs and spaces in indentation".into(), + }), + ], + public_job: Some(bundle()), + } +} + +#[test] +fn test_file_errors_carry_data_tagged_by_kind() { + let errors = [ + (TestFileError::Missing {}, r#"{"kind":"missing"}"#), + ( + TestFileError::Unreadable { errno: 13 }, + r#"{"kind":"unreadable","errno":13}"#, + ), + // What `b"abc\xe2(".decode()` reports: the one byte at 3 that starts no valid sequence. + ( + TestFileError::NotUtf8 { + start: 3, + bytes: vec![0xe2], + reason: Utf8Reason::InvalidContinuationByte, + }, + r#"{"kind":"not_utf8","start":3,"bytes":[226],"reason":"invalid_continuation_byte"}"#, + ), + ( + TestFileError::Syntax { + class: SyntaxClass::SyntaxError, + line: 2, + message: "invalid syntax".into(), + }, + r#"{"kind":"syntax","class":"syntax_error","line":2,"message":"invalid syntax"}"#, + ), + ( + TestFileError::Syntax { + class: SyntaxClass::IndentationError, + line: 2, + message: "unexpected indent".into(), + }, + r#"{"kind":"syntax","class":"indentation_error","line":2,"message":"unexpected indent"}"#, + ), + ]; + + for (error, text) in errors { + assert_eq!(serde_json::to_string(&error).unwrap(), text); + assert_eq!(serde_json::from_str::(text).unwrap(), error); + } +} + +/// The error of decoding `value` as a `T` after `edit` changes the object at `path`. +fn decode_edited( + value: &impl Serialize, + path: &[&str], + edit: impl FnOnce(&mut Map), +) -> String { + let mut json = serde_json::to_value(value).unwrap(); + let mut object = &mut json; + + for step in path { + object = match step.parse::() { + Ok(index) => &mut object[index], + Err(_) => &mut object[*step], + }; + } + + edit(object.as_object_mut().unwrap()); + + match decode::(&json.to_string()) { + Ok(_) => panic!("decoded with the edit at {path:?}"), + Err(error) => error.to_string(), + } +} + +/// Decoding `value` without the key at `path` fails, naming the key. +fn rejects_without(value: &impl Serialize, path: &[&str], key: &str) { + let error = decode_edited::(value, path, |object| { + assert!(object.remove(key).is_some(), "no key {key} at {path:?}"); + }); + + assert!(error.contains(&format!("missing field `{key}`")), "{error}"); +} + +/// Decoding `value` with an extra key at `path` fails, naming the key. +fn rejects_extra(value: &impl Serialize, path: &[&str]) { + let error = decode_edited::(value, path, |object| { + object.insert("bogus".into(), Value::Null); + }); + + assert!(error.contains("unknown field `bogus`"), "{path:?}: {error}"); +} + +fn job() -> Job { + Job { + schema: SCHEMA, + bundle: bundle(), + submission: PathBuf::from("s.py"), + skip: vec![], + run_failed: None, + alarm: true, + } +} + +fn events() -> Vec { + let events = [ + Event::Loaded { + error: None, + unavailable: IndexMap::new(), + }, + Event::Loading { tests: vec![] }, + Event::Start { test: "t".into() }, + Event::Result(outcome()), + ]; + + events + .into_iter() + .map(|event| EventLine { + schema: SCHEMA, + event, + }) + .collect() +} + +#[test] +fn rejects_unknown_keys() { + for path in [ + &[][..], + &["bundle"], + &["bundle", "config"], + &["bundle", "config", "questions", "0"], + &["bundle", "cells", "0"], + &["bundle", "helpers", "0"], + ] { + rejects_extra::(&job(), path); + } + + for event in events() { + rejects_extra::(&event, &[]); + } + + for path in [ + &[][..], + &["config"], + &["questions", "0"], + &["answers", "0"], + &["test_files", "0"], + &["test_files", "1", "error"], + &["test_files", "2", "error"], + &["test_files", "3", "error"], + &["test_files", "4", "error"], + &["public_job"], + ] { + rejects_extra::(&inspect(), path); + } + + let results = r#"{"tests": [], "stdout_visibility": "hidden", "bogus": 1}"#; + let error = serde_json::from_str::(results) + .unwrap_err() + .to_string(); + + assert!(error.contains("unknown field `bogus`"), "{error}"); +} + +#[test] +fn rejects_nested_bundle_of_other_version() { + let other = |object: &mut Map| { + object.insert("schema".into(), 2.into()); + }; + + let error = decode_edited::(&job(), &["bundle"], other); + assert!(error.contains("schema version 2, expected 1"), "{error}"); + + let error = decode_edited::(&inspect(), &["public_job"], other); + assert!(error.contains("schema version 2, expected 1"), "{error}"); +} + +#[test] +fn keeps_the_order_of_unavailable_names() { + let line = r#"{"schema":1,"event":"loaded","error":null,"unavailable":{"b":"x","a":"y"}}"#; + let event = decode::(line).unwrap(); + + assert_eq!(serde_json::to_string(&event).unwrap(), line); +} + +#[test] +fn results_reject_null_for_left_out_keys() { + for key in ["score", "output", "output_format"] { + let text = format!(r#"{{"tests": [], "stdout_visibility": "hidden", "{key}": null}}"#); + + assert!(serde_json::from_str::(&text).is_err(), "{key}"); + } + + for key in ["number", "status"] { + let row = format!( + r#"{{"name": "n", "score": 0, "max_score": 0, "output": "", "output_format": "md", "visibility": "visible", "{key}": null}}"# + ); + let text = format!(r#"{{"tests": [{row}], "stdout_visibility": "hidden"}}"#); + + assert!(serde_json::from_str::(&text).is_err(), "{key}"); + } +} + +#[test] +fn rejects_missing_nullable_keys() { + let job = job(); + let [loaded, ..] = &events()[..] else { + unreachable!() + }; + let result = EventLine { + schema: SCHEMA, + event: Event::Result(Outcome { + reason: None, + ..outcome() + }), + }; + let inspect = Inspect { + config: None, + public_job: None, + ..inspect() + }; + + rejects_without::(&job, &[], "run_failed"); + rejects_without::(loaded, &[], "error"); + rejects_without::(&result, &[], "reason"); + rejects_without::(&bundle(), &["cells", "0"], "label"); + + for key in ["source_error", "config_error", "config", "public_job"] { + rejects_without::(&inspect, &[], key); + } + + rejects_without::(&inspect, &["answers", "0"], "text"); + rejects_without::(&inspect, &["test_files", "0"], "error"); +} + +#[test] +fn outcome_and_results_serialize_as_python_does() { + let line = EventLine { + schema: SCHEMA, + event: Event::Result(outcome()), + }; + let text = serde_json::to_string(&line).unwrap(); + + assert_eq!( + text, + r#"{"schema":1,"event":"result","name":"test_q1_a","passed":false,"message":"AssertionError","reason":"out_of_memory","seconds":0.5}"# + ); + + let results = Results { + tests: vec![Row { + name: "Question 1".into(), + score: 1.0, + max_score: 2.0, + output: "ok".into(), + output_format: "md".into(), + visibility: "hidden".into(), + number: Some("q1".into()), + status: None, + }], + stdout_visibility: "hidden".into(), + score: None, + output: None, + output_format: None, + }; + let text = serde_json::to_string(&results).unwrap(); + + assert_eq!( + text, + r#"{"tests":[{"name":"Question 1","score":1.0,"max_score":2.0,"output":"ok","output_format":"md","visibility":"hidden","number":"q1"}],"stdout_visibility":"hidden"}"# + ); + assert_eq!(serde_json::from_str::(&text).unwrap(), results); +} + +#[test] +fn rejects_other_schema_version() { + let error = decode::(r#"{"schema": 2, "bundle": {}}"#).unwrap_err(); + + assert_eq!(error.to_string(), "schema version 2, expected 1"); + + let error = decode::(r#"{"event": "start", "test": "t"}"#).unwrap_err(); + + assert_eq!(error.to_string(), "missing schema version, expected 1"); +} + +fn schema_dir() -> PathBuf { + Path::new(env!("CARGO_MANIFEST_DIR")).join("../../schemas") +} + +#[test] +fn checked_in_schemas_are_current() { + let bless = std::env::var_os("MOGS_BLESS").is_some_and(|value| value == "1"); + let mut stale = vec![]; + + for (name, schema) in schemas() { + let path = schema_dir().join(format!("{name}.schema.json")); + let fresh = serde_json::to_string_pretty(&schema).unwrap() + "\n"; + + if bless { + std::fs::write(&path, &fresh).unwrap(); + } else if std::fs::read_to_string(&path).ok().as_deref() != Some(fresh.as_str()) { + stale.push(path.display().to_string()); + } + } + + assert!( + stale.is_empty(), + "stale schemas, rerun with MOGS_BLESS=1: {stale:?}" + ); +} diff --git a/pyproject.toml b/pyproject.toml index c3b691b..6d5c36d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,7 @@ dev = [ "pypdf>=5", # The PDF tests need the pdf extra. "mogs[pdf]", + "jsonschema>=4", ] [tool.ty.src] diff --git a/schemas/bundle.schema.json b/schemas/bundle.schema.json new file mode 100644 index 0000000..bc19ad3 --- /dev/null +++ b/schemas/bundle.schema.json @@ -0,0 +1,232 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Bundle", + "description": "Everything a grading child needs besides the submission.", + "type": "object", + "properties": { + "schema": { + "description": "Format version, `SCHEMA`.", + "type": "integer", + "format": "uint32", + "minimum": 0, + "const": 1 + }, + "config": { + "description": "The assignment config the grader needs.", + "$ref": "#/$defs/BundleConfig" + }, + "setup_code": { + "description": "Body of the notebook's setup cell, run before the test cells.", + "type": "string" + }, + "cells": { + "description": "Test cells in file order.", + "type": "array", + "items": { + "$ref": "#/$defs/TestCell" + } + }, + "helpers": { + "description": "Hidden cells without tests, in file order.", + "type": "array", + "items": { + "$ref": "#/$defs/HiddenHelper" + } + } + }, + "additionalProperties": false, + "required": [ + "schema", + "config", + "setup_code", + "cells", + "helpers" + ], + "unevaluatedProperties": false, + "$defs": { + "BundleConfig": { + "description": "The assignment config, without the host path of `requirements`.", + "type": "object", + "properties": { + "name": { + "description": "Assignment name.", + "type": "string" + }, + "notebook": { + "description": "File name of the source notebook.", + "type": "string" + }, + "questions": { + "description": "Questions in notebook order.", + "type": "array", + "items": { + "$ref": "#/$defs/BundleQuestion" + } + }, + "files": { + "description": "Data files and folders shipped with the notebook, relative to it.", + "type": "array", + "items": { + "type": "string" + } + }, + "timeout": { + "description": "Seconds per test.", + "type": "number", + "format": "double" + }, + "budget": { + "description": "Seconds for the whole grading run.", + "type": "number", + "format": "double" + }, + "memory_mb": { + "description": "MB per grading process.", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "python": { + "description": "Python version on Gradescope.", + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name", + "notebook", + "questions", + "files", + "timeout", + "budget", + "memory_mb", + "python" + ], + "unevaluatedProperties": false + }, + "BundleQuestion": { + "description": "One question of the config.", + "type": "object", + "properties": { + "id": { + "description": "Question id, e.g. `q1`.", + "type": "string" + }, + "title": { + "description": "Question title.", + "type": "string" + }, + "points": { + "description": "Points for the question.", + "type": "number", + "format": "double" + }, + "manual": { + "description": "Whether the question is graded by hand.", + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "id", + "title", + "points", + "manual" + ], + "unevaluatedProperties": false + }, + "TestCell": { + "description": "One test cell of the source notebook.", + "type": "object", + "properties": { + "qid": { + "description": "Question id of the cell's tests.", + "type": "string" + }, + "label": { + "description": "The file name the runner compiles the cell under, which tracebacks and syntax errors\nshow: `-tests` for a cell of the notebook, the path relative to the notebook for\na public test file (as `selfcheck` runs it).", + "type": "string" + }, + "hidden": { + "description": "Whether the cell is marked `# HIDDEN`.", + "type": "boolean" + }, + "source": { + "description": "Cell body, run as a module.", + "type": "string" + }, + "tests": { + "description": "Test function names, in file order.", + "type": "array", + "items": { + "type": "string" + } + }, + "uses": { + "description": "Student names the cell refers to, bound from the submission.", + "type": "array", + "items": { + "type": "string" + } + }, + "needs": { + "description": "Names the cell reads from hidden helpers. Empty for public cells.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "qid", + "label", + "hidden", + "source", + "tests", + "uses", + "needs" + ], + "unevaluatedProperties": false + }, + "HiddenHelper": { + "description": "A `# HIDDEN` cell without tests, such as data or helpers for hidden tests.", + "type": "object", + "properties": { + "source": { + "description": "Cell body, run as a module.", + "type": "string" + }, + "defines": { + "description": "Names the cell binds at top level.", + "type": "array", + "items": { + "type": "string" + } + }, + "uses": { + "description": "Student names the cell refers to, bound from the submission.", + "type": "array", + "items": { + "type": "string" + } + }, + "needs": { + "description": "Names the cell reads from other hidden helpers.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "source", + "defines", + "uses", + "needs" + ], + "unevaluatedProperties": false + } + } +} diff --git a/schemas/event.schema.json b/schemas/event.schema.json new file mode 100644 index 0000000..b11b15f --- /dev/null +++ b/schemas/event.schema.json @@ -0,0 +1,182 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "EventLine", + "description": "One event line: the format version and the event.", + "type": "object", + "properties": { + "schema": { + "description": "Format version, `SCHEMA`.", + "type": "integer", + "format": "uint32", + "minimum": 0, + "const": 1 + } + }, + "required": [ + "schema" + ], + "oneOf": [ + { + "description": "Once, after setup and binding: the child is ready, or failed to set up.", + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "loaded" + }, + "error": { + "description": "Why setup failed, `None` when it worked.", + "type": [ + "string", + "null" + ] + }, + "unavailable": { + "description": "Each name the tests use that the submission could not provide, with why.", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "event", + "error", + "unavailable" + ] + }, + { + "description": "Before loading a test cell and the hidden helpers it needs.", + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "loading" + }, + "tests": { + "description": "The cell's tests that will run.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "event", + "tests" + ] + }, + { + "description": "Before each test.", + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "start" + }, + "test": { + "description": "The test.", + "type": "string" + } + }, + "required": [ + "event", + "test" + ] + }, + { + "description": "After each test, with the outcome's fields next to `event`.", + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "result" + }, + "name": { + "description": "Test name.", + "type": "string" + }, + "passed": { + "description": "Whether the test passed.", + "type": "boolean" + }, + "message": { + "description": "Failure message, empty when passed.", + "type": "string" + }, + "reason": { + "description": "Why the test failed, `None` when passed.", + "anyOf": [ + { + "$ref": "#/$defs/FailureReason" + }, + { + "type": "null" + } + ] + }, + "seconds": { + "description": "Wall time spent in the test.", + "type": "number", + "format": "double" + } + }, + "required": [ + "event", + "name", + "passed", + "message", + "reason", + "seconds" + ] + } + ], + "unevaluatedProperties": false, + "$defs": { + "FailureReason": { + "description": "Why a test did not pass. The values are `mogs.runner.FailureReason`'s.", + "oneOf": [ + { + "description": "An `assert` failed.", + "type": "string", + "const": "assertion" + }, + { + "description": "The test raised another exception.", + "type": "string", + "const": "error" + }, + { + "description": "The test ran past its time limit.", + "type": "string", + "const": "timeout" + }, + { + "description": "The process running the test died.", + "type": "string", + "const": "killed" + }, + { + "description": "The test ran out of memory.", + "type": "string", + "const": "out_of_memory" + }, + { + "description": "The grading run's time budget ran out.", + "type": "string", + "const": "budget" + }, + { + "description": "The test's cell, or what it needs, failed to load.", + "type": "string", + "const": "load_failed" + }, + { + "description": "The test never ran.", + "type": "string", + "const": "not_run" + } + ] + } + } +} diff --git a/schemas/inspect.schema.json b/schemas/inspect.schema.json new file mode 100644 index 0000000..1225c04 --- /dev/null +++ b/schemas/inspect.schema.json @@ -0,0 +1,608 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Inspect", + "description": "A saved notebook, source or student copy, as the Python notebook functions see it.", + "type": "object", + "properties": { + "schema": { + "description": "Format version, `SCHEMA`.", + "type": "integer", + "format": "uint32", + "minimum": 0, + "const": 1 + }, + "source_error": { + "description": "Why the notebook does not parse (`SourceError`). `assignment.assignment` lists it as\nthe problem; `export.package` warns that no answer could be read; `selfcheck.main`\nexits with it.", + "type": [ + "string", + "null" + ] + }, + "config_error": { + "description": "Why the config calls are invalid (`ConfigError`). `assignment.assignment` lists it as\nthe problem; `check._written_in_source` raises it.", + "type": [ + "string", + "null" + ] + }, + "config": { + "description": "The config, `None` when `config_error` is set. `assignment.summary` titles the panel\nwith it.", + "anyOf": [ + { + "$ref": "#/$defs/InspectConfig" + }, + { + "type": "null" + } + ] + }, + "problems": { + "description": "What the build would refuse: `source.validate` and the data-file check\n(`assignment._data_problems`). `assignment.assignment` lists them.", + "type": "array", + "items": { + "type": "string" + } + }, + "questions": { + "description": "The config's questions in notebook order, empty without a config. `assignment.summary`\nhas a row per question; `check._written_in_source` reads `manual` by id.", + "type": "array", + "items": { + "$ref": "#/$defs/InspectQuestion" + } + }, + "answers": { + "description": "Every cell whose name starts with `answer_`, in file order, whatever the grade calls\nand the config say. `export.unanswered_lines` and `export.answers_markdown` pick each\nmanual question's cells from them by name, as `Notebook.answer_cells` does.", + "type": "array", + "items": { + "$ref": "#/$defs/Answer" + } + }, + "test_files": { + "description": "The public test files that grade calls name (`selfcheck.test_files`).\n`check.file_outcomes` and `selfcheck.public_results` run them; `selfcheck` fails the\nunreadable ones.", + "type": "array", + "items": { + "$ref": "#/$defs/TestFile" + } + }, + "public_job": { + "description": "What `selfcheck.public_results` runs: the public phase of the notebook's bundle, then a\npublic cell for each readable test file, labelled with its path. `None` when\n`source_error` is set.", + "anyOf": [ + { + "$ref": "#/$defs/Bundle" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "schema", + "source_error", + "config_error", + "config", + "problems", + "questions", + "answers", + "test_files", + "public_job" + ], + "unevaluatedProperties": false, + "$defs": { + "InspectConfig": { + "description": "The config fields the notebook functions use.", + "type": "object", + "properties": { + "name": { + "description": "Assignment name. `assignment.summary` and `assignment._problems` title the panel.", + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name" + ], + "unevaluatedProperties": false + }, + "InspectQuestion": { + "description": "One question of the config, with its tests and prompts.", + "type": "object", + "properties": { + "id": { + "description": "Question id, e.g. `q1`.", + "type": "string" + }, + "title": { + "description": "Question title, shown by `assignment.summary`.", + "type": "string" + }, + "points": { + "description": "Points, shown and added up by `assignment.summary`.", + "type": "number", + "format": "double" + }, + "manual": { + "description": "Whether it is graded by hand. `assignment.summary` shows it as written;\n`check._written_in_source` reads it.", + "type": "boolean" + }, + "public": { + "description": "Public test names in file order (`Notebook.tests_by_question`), counted by\n`assignment.summary`.", + "type": "array", + "items": { + "type": "string" + } + }, + "hidden": { + "description": "Hidden test names in file order, counted by `assignment.summary`.", + "type": "array", + "items": { + "type": "string" + } + }, + "prompts": { + "description": "The first line of each prompt cell of a written question (`source.prompt_previews`),\nlisted by `assignment.summary`.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "id", + "title", + "points", + "manual", + "public", + "hidden", + "prompts" + ], + "unevaluatedProperties": false + }, + "Answer": { + "description": "One answer cell: a cell whose name starts with `answer_`.", + "type": "object", + "properties": { + "cell": { + "description": "Cell name, e.g. `answer_q3` or `answer_q3_2`. `export` picks the cells of question\n`` as `Notebook.answer_cells` does, by the name `answer_` or a name starting\nwith `answer__`, and looks each cell's placeholder up by its name. The name alone\ndoes not tell the question, since ids may hold `_`.", + "type": "string" + }, + "text": { + "description": "The Markdown of a cell that is just `mo.md(\"...\")`, `None` for other code\n(`source.answer_text`). `export` checks it against the placeholder and writes it.", + "type": [ + "string", + "null" + ] + }, + "source": { + "description": "The cell's lines as written (`source.cell_source`). `export.answers_markdown` shows a\ncode answer, one whose `text` is `None`, as this source.", + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "cell", + "text", + "source" + ], + "unevaluatedProperties": false + }, + "TestFile": { + "description": "A file of public tests that a grade call names as `test_file`.", + "type": "object", + "properties": { + "qid": { + "description": "Question id of the grade call.", + "type": "string" + }, + "path": { + "description": "The path as the grade call gives it, relative to the notebook's folder.", + "type": "string" + }, + "tests": { + "description": "Test function names in file order (`source.module_tests`), which `check.file_outcomes`\nruns.", + "type": "array", + "items": { + "type": "string" + } + }, + "error": { + "description": "Why the file cannot be read or parsed, `None` when it can. `check.file_outcomes` shows\nit; `selfcheck.public_results` fails the file with it.", + "anyOf": [ + { + "$ref": "#/$defs/TestFileError" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "qid", + "path", + "tests", + "error" + ], + "unevaluatedProperties": false + }, + "TestFileError": { + "description": "Why a test file cannot be read or parsed, tagged by `\"kind\"`. It carries data, not text:\neach call site words it itself.\n\n`selfcheck.public_results` fails the file with `cannot read ()`, where the\nsummary is `runner.exception_summary` of the exception Python would have raised, rebuilt\nfrom the variant as each variant says. `` below is the notebook's folder joined with\n`path`.", + "oneOf": [ + { + "description": "The file does not exist. `check.file_outcomes`: `Cannot find next to\n. Keep the `tests` folder of the assignment next to the notebook.`\n`selfcheck`: the exception is `FileNotFoundError(ENOENT, os.strerror(ENOENT), )`.", + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "missing" + } + }, + "additionalProperties": false, + "required": [ + "kind" + ] + }, + { + "description": "The file exists but cannot be read. `check.file_outcomes`: `Cannot read :\n`. Both call sites rebuild the exception as\n`OSError(errno, os.strerror(errno), )`, which picks the subclass, such as\n`PermissionError`.", + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "unreadable" + }, + "errno": { + "description": "The C `errno`, as Python's `OSError.errno` gives it.", + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "required": [ + "kind", + "errno" + ] + }, + { + "description": "The file is not UTF-8. `check.file_outcomes`: `Cannot read : `. Both\ncall sites rebuild the exception as\n`UnicodeDecodeError(\"utf-8\", bytes(start) + bytes, start, start + len(bytes), )`:\nthe zero padding puts `bytes` at `start`, so `str()` reads them where Python's decoder\nfound them.", + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "not_utf8" + }, + "start": { + "description": "Byte offset of the first byte that does not decode, `UnicodeDecodeError.start`.", + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "bytes": { + "description": "The bytes that do not decode, `object[start:end]` of the `UnicodeDecodeError`.", + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0, + "maximum": 255 + } + }, + "reason": { + "description": "Why they do not decode.", + "$ref": "#/$defs/Utf8Reason" + } + }, + "additionalProperties": false, + "required": [ + "kind", + "start", + "bytes", + "reason" + ] + }, + { + "description": "The file is not valid Python. `check.file_outcomes`: ` is not valid Python (line\n).` `selfcheck`: the exception is `(message, (\"\", line, None,\nNone))`, as `ast.parse` raises it.", + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "syntax" + }, + "class": { + "description": "Which `SyntaxError` class `ast.parse` raised.", + "$ref": "#/$defs/SyntaxClass" + }, + "line": { + "description": "Line of the error, from 1, `SyntaxError.lineno`.", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "message": { + "description": "Python's message for it, `SyntaxError.msg`, such as `invalid syntax`.", + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "kind", + "class", + "line", + "message" + ] + } + ], + "unevaluatedProperties": false + }, + "Utf8Reason": { + "description": "Why bytes are not UTF-8: the `reason` of Python's `UnicodeDecodeError`, with spaces as\nunderscores.", + "oneOf": [ + { + "description": "`invalid start byte`.", + "type": "string", + "const": "invalid_start_byte" + }, + { + "description": "`invalid continuation byte`.", + "type": "string", + "const": "invalid_continuation_byte" + }, + { + "description": "`unexpected end of data`.", + "type": "string", + "const": "unexpected_end_of_data" + } + ] + }, + "SyntaxClass": { + "description": "The class of a `SyntaxError` that `ast.parse` raises.", + "oneOf": [ + { + "description": "`SyntaxError`.", + "type": "string", + "const": "syntax_error" + }, + { + "description": "`IndentationError`.", + "type": "string", + "const": "indentation_error" + }, + { + "description": "`TabError`.", + "type": "string", + "const": "tab_error" + } + ] + }, + "Bundle": { + "description": "Everything a grading child needs besides the submission.", + "type": "object", + "properties": { + "schema": { + "description": "Format version, `SCHEMA`.", + "type": "integer", + "format": "uint32", + "minimum": 0, + "const": 1 + }, + "config": { + "description": "The assignment config the grader needs.", + "$ref": "#/$defs/BundleConfig" + }, + "setup_code": { + "description": "Body of the notebook's setup cell, run before the test cells.", + "type": "string" + }, + "cells": { + "description": "Test cells in file order.", + "type": "array", + "items": { + "$ref": "#/$defs/TestCell" + } + }, + "helpers": { + "description": "Hidden cells without tests, in file order.", + "type": "array", + "items": { + "$ref": "#/$defs/HiddenHelper" + } + } + }, + "additionalProperties": false, + "required": [ + "schema", + "config", + "setup_code", + "cells", + "helpers" + ], + "unevaluatedProperties": false + }, + "BundleConfig": { + "description": "The assignment config, without the host path of `requirements`.", + "type": "object", + "properties": { + "name": { + "description": "Assignment name.", + "type": "string" + }, + "notebook": { + "description": "File name of the source notebook.", + "type": "string" + }, + "questions": { + "description": "Questions in notebook order.", + "type": "array", + "items": { + "$ref": "#/$defs/BundleQuestion" + } + }, + "files": { + "description": "Data files and folders shipped with the notebook, relative to it.", + "type": "array", + "items": { + "type": "string" + } + }, + "timeout": { + "description": "Seconds per test.", + "type": "number", + "format": "double" + }, + "budget": { + "description": "Seconds for the whole grading run.", + "type": "number", + "format": "double" + }, + "memory_mb": { + "description": "MB per grading process.", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "python": { + "description": "Python version on Gradescope.", + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name", + "notebook", + "questions", + "files", + "timeout", + "budget", + "memory_mb", + "python" + ], + "unevaluatedProperties": false + }, + "BundleQuestion": { + "description": "One question of the config.", + "type": "object", + "properties": { + "id": { + "description": "Question id, e.g. `q1`.", + "type": "string" + }, + "title": { + "description": "Question title.", + "type": "string" + }, + "points": { + "description": "Points for the question.", + "type": "number", + "format": "double" + }, + "manual": { + "description": "Whether the question is graded by hand.", + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "id", + "title", + "points", + "manual" + ], + "unevaluatedProperties": false + }, + "TestCell": { + "description": "One test cell of the source notebook.", + "type": "object", + "properties": { + "qid": { + "description": "Question id of the cell's tests.", + "type": "string" + }, + "label": { + "description": "The file name the runner compiles the cell under, which tracebacks and syntax errors\nshow: `-tests` for a cell of the notebook, the path relative to the notebook for\na public test file (as `selfcheck` runs it).", + "type": "string" + }, + "hidden": { + "description": "Whether the cell is marked `# HIDDEN`.", + "type": "boolean" + }, + "source": { + "description": "Cell body, run as a module.", + "type": "string" + }, + "tests": { + "description": "Test function names, in file order.", + "type": "array", + "items": { + "type": "string" + } + }, + "uses": { + "description": "Student names the cell refers to, bound from the submission.", + "type": "array", + "items": { + "type": "string" + } + }, + "needs": { + "description": "Names the cell reads from hidden helpers. Empty for public cells.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "qid", + "label", + "hidden", + "source", + "tests", + "uses", + "needs" + ], + "unevaluatedProperties": false + }, + "HiddenHelper": { + "description": "A `# HIDDEN` cell without tests, such as data or helpers for hidden tests.", + "type": "object", + "properties": { + "source": { + "description": "Cell body, run as a module.", + "type": "string" + }, + "defines": { + "description": "Names the cell binds at top level.", + "type": "array", + "items": { + "type": "string" + } + }, + "uses": { + "description": "Student names the cell refers to, bound from the submission.", + "type": "array", + "items": { + "type": "string" + } + }, + "needs": { + "description": "Names the cell reads from other hidden helpers.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "source", + "defines", + "uses", + "needs" + ], + "unevaluatedProperties": false + } + } +} diff --git a/schemas/job.schema.json b/schemas/job.schema.json new file mode 100644 index 0000000..38ad35f --- /dev/null +++ b/schemas/job.schema.json @@ -0,0 +1,281 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Job", + "description": "What one grading child runs. The parent writes it as JSON to the child's stdin.", + "type": "object", + "properties": { + "schema": { + "description": "Format version, `SCHEMA`.", + "type": "integer", + "format": "uint32", + "minimum": 0, + "const": 1 + }, + "bundle": { + "description": "The bundle of one phase.", + "$ref": "#/$defs/Bundle" + }, + "submission": { + "description": "The student's notebook.", + "type": "string" + }, + "skip": { + "description": "Tests already done, e.g. by an earlier child that died.", + "type": "array", + "items": { + "type": "string" + } + }, + "run_failed": { + "description": "Why an earlier child died while running the whole notebook. When set, the child does\nnot run it again.", + "type": [ + "string", + "null" + ] + }, + "alarm": { + "description": "Whether the child times each test itself with an alarm.", + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "schema", + "bundle", + "submission", + "skip", + "run_failed", + "alarm" + ], + "unevaluatedProperties": false, + "$defs": { + "Bundle": { + "description": "Everything a grading child needs besides the submission.", + "type": "object", + "properties": { + "schema": { + "description": "Format version, `SCHEMA`.", + "type": "integer", + "format": "uint32", + "minimum": 0, + "const": 1 + }, + "config": { + "description": "The assignment config the grader needs.", + "$ref": "#/$defs/BundleConfig" + }, + "setup_code": { + "description": "Body of the notebook's setup cell, run before the test cells.", + "type": "string" + }, + "cells": { + "description": "Test cells in file order.", + "type": "array", + "items": { + "$ref": "#/$defs/TestCell" + } + }, + "helpers": { + "description": "Hidden cells without tests, in file order.", + "type": "array", + "items": { + "$ref": "#/$defs/HiddenHelper" + } + } + }, + "additionalProperties": false, + "required": [ + "schema", + "config", + "setup_code", + "cells", + "helpers" + ], + "unevaluatedProperties": false + }, + "BundleConfig": { + "description": "The assignment config, without the host path of `requirements`.", + "type": "object", + "properties": { + "name": { + "description": "Assignment name.", + "type": "string" + }, + "notebook": { + "description": "File name of the source notebook.", + "type": "string" + }, + "questions": { + "description": "Questions in notebook order.", + "type": "array", + "items": { + "$ref": "#/$defs/BundleQuestion" + } + }, + "files": { + "description": "Data files and folders shipped with the notebook, relative to it.", + "type": "array", + "items": { + "type": "string" + } + }, + "timeout": { + "description": "Seconds per test.", + "type": "number", + "format": "double" + }, + "budget": { + "description": "Seconds for the whole grading run.", + "type": "number", + "format": "double" + }, + "memory_mb": { + "description": "MB per grading process.", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "python": { + "description": "Python version on Gradescope.", + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name", + "notebook", + "questions", + "files", + "timeout", + "budget", + "memory_mb", + "python" + ], + "unevaluatedProperties": false + }, + "BundleQuestion": { + "description": "One question of the config.", + "type": "object", + "properties": { + "id": { + "description": "Question id, e.g. `q1`.", + "type": "string" + }, + "title": { + "description": "Question title.", + "type": "string" + }, + "points": { + "description": "Points for the question.", + "type": "number", + "format": "double" + }, + "manual": { + "description": "Whether the question is graded by hand.", + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "id", + "title", + "points", + "manual" + ], + "unevaluatedProperties": false + }, + "TestCell": { + "description": "One test cell of the source notebook.", + "type": "object", + "properties": { + "qid": { + "description": "Question id of the cell's tests.", + "type": "string" + }, + "label": { + "description": "The file name the runner compiles the cell under, which tracebacks and syntax errors\nshow: `-tests` for a cell of the notebook, the path relative to the notebook for\na public test file (as `selfcheck` runs it).", + "type": "string" + }, + "hidden": { + "description": "Whether the cell is marked `# HIDDEN`.", + "type": "boolean" + }, + "source": { + "description": "Cell body, run as a module.", + "type": "string" + }, + "tests": { + "description": "Test function names, in file order.", + "type": "array", + "items": { + "type": "string" + } + }, + "uses": { + "description": "Student names the cell refers to, bound from the submission.", + "type": "array", + "items": { + "type": "string" + } + }, + "needs": { + "description": "Names the cell reads from hidden helpers. Empty for public cells.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "qid", + "label", + "hidden", + "source", + "tests", + "uses", + "needs" + ], + "unevaluatedProperties": false + }, + "HiddenHelper": { + "description": "A `# HIDDEN` cell without tests, such as data or helpers for hidden tests.", + "type": "object", + "properties": { + "source": { + "description": "Cell body, run as a module.", + "type": "string" + }, + "defines": { + "description": "Names the cell binds at top level.", + "type": "array", + "items": { + "type": "string" + } + }, + "uses": { + "description": "Student names the cell refers to, bound from the submission.", + "type": "array", + "items": { + "type": "string" + } + }, + "needs": { + "description": "Names the cell reads from other hidden helpers.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "source", + "defines", + "uses", + "needs" + ], + "unevaluatedProperties": false + } + } +} diff --git a/schemas/results.schema.json b/schemas/results.schema.json new file mode 100644 index 0000000..d4e0680 --- /dev/null +++ b/schemas/results.schema.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Results", + "description": "The content of `results.json`.", + "type": "object", + "properties": { + "tests": { + "description": "One row per entry Gradescope shows.", + "type": "array", + "items": { + "$ref": "#/$defs/Row" + } + }, + "stdout_visibility": { + "description": "Who sees the grader's stdout.", + "type": "string" + }, + "score": { + "description": "The total, set only when `tests` is empty.", + "type": "number", + "format": "double" + }, + "output": { + "description": "The score summary for students.", + "type": "string" + }, + "output_format": { + "description": "Format of `output`.", + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "tests", + "stdout_visibility" + ], + "unevaluatedProperties": false, + "$defs": { + "Row": { + "description": "One entry of `tests` in `results.json`, with its keys in the order `results.row` adds them.", + "type": "object", + "properties": { + "name": { + "description": "Row title.", + "type": "string" + }, + "score": { + "description": "Points earned.", + "type": "number", + "format": "double" + }, + "max_score": { + "description": "Points possible.", + "type": "number", + "format": "double" + }, + "output": { + "description": "Text under the row.", + "type": "string" + }, + "output_format": { + "description": "Format of `output`.", + "type": "string" + }, + "visibility": { + "description": "Who sees the row.", + "type": "string" + }, + "number": { + "description": "Question id shown next to the title.", + "type": "string" + }, + "status": { + "description": "`failed` marks the row as failed.", + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name", + "score", + "max_score", + "output", + "output_format", + "visibility" + ], + "unevaluatedProperties": false + } + } +} diff --git a/src/mogs/grader/bundle.py b/src/mogs/grader/bundle.py index 06f6e44..95e2aa5 100644 --- a/src/mogs/grader/bundle.py +++ b/src/mogs/grader/bundle.py @@ -1,7 +1,8 @@ """The tests the grader runs, cut from the source notebook and stored as JSON. A bundle holds the setup cell and every test cell. Each grading phase gets only its own cells, -so the public phase never sees hidden test source. +so the public phase never sees hidden test source. Its JSON carries the format version; see +`wire`. """ import copy @@ -11,6 +12,7 @@ from typing import Self from mogs.config import AssignmentConfig, Question +from mogs.grader.wire import SCHEMA, check_schema, reject_extra from mogs.source import Notebook, SourceError, cell_names, question_id @@ -27,6 +29,9 @@ class TestCell: Attributes: qid: Question id of the cell's tests. + label: File name the cell is compiled under, shown in tracebacks and syntax errors: + `-tests` for a notebook cell, the path relative to the notebook for a file of + public tests. hidden: Whether the cell is marked `# HIDDEN`. source: Cell body, run as a module. tests: Test function names, in file order. @@ -37,6 +42,7 @@ class TestCell: __test__ = False qid: str + label: str hidden: bool source: str tests: tuple[str, ...] @@ -48,6 +54,7 @@ def to_dict(self) -> dict[str, object]: return { "qid": self.qid, + "label": self.label, "hidden": self.hidden, "source": self.source, "tests": list(self.tests), @@ -66,13 +73,17 @@ def from_dict(cls, data: object) -> Self: match data: case { "qid": str() as qid, + "label": str() as label, "hidden": bool() as hidden, "source": str() as source, "tests": list() as tests, "uses": list() as uses, "needs": list() as needs, + **extra, }: - return cls(qid, hidden, source, _strings(tests), _strings(uses), _strings(needs)) + reject_extra(extra, "test cell") + strings = _strings(tests), _strings(uses), _strings(needs) + return cls(qid, label, hidden, source, *strings) raise ValueError(f"not a test cell: {data!r}") @@ -120,7 +131,9 @@ def from_dict(cls, data: object) -> Self: "defines": list() as defines, "uses": list() as uses, "needs": list() as needs, + **extra, }: + reject_extra(extra, "hidden helper") return cls(source, _strings(defines), _strings(uses), _strings(needs)) raise ValueError(f"not a hidden helper: {data!r}") @@ -158,6 +171,7 @@ def to_dict(self) -> dict[str, object]: """JSON-ready fields.""" return { + "schema": SCHEMA, "config": _config_to_dict(self.config), "setup_code": self.setup_code, "cells": [cell.to_dict() for cell in self.cells], @@ -169,16 +183,22 @@ def from_dict(cls, data: object) -> Self: """Inverse of `to_dict`. Raises: - ValueError: If a field is missing or has the wrong type. + ValueError: If the schema version is not `SCHEMA`, or a field is missing or has + the wrong type. """ + check_schema(data) + match data: case { + "schema": _, "config": dict() as config, "setup_code": str() as setup, "cells": list() as cells, "helpers": list() as helpers, + **extra, }: + reject_extra(extra, "grading bundle") return cls( _config_from_dict(config), setup, @@ -198,7 +218,7 @@ def from_json(cls, text: str) -> Self: """Inverse of `to_json`. Raises: - ValueError: If the text is not JSON or not a bundle. + ValueError: If the text is not JSON or not a bundle of version `SCHEMA`. """ return cls.from_dict(json.loads(text)) @@ -251,7 +271,8 @@ def bundle_from_notebook(nb: Notebook, cfg: AssignmentConfig) -> GradingBundle: _, free = cell_names(source) uses = tuple(sorted(free & students)) needs = tuple(sorted(free & provided)) if cell.hidden else () - cells.append(TestCell(qids.pop(), cell.hidden, source, cell.tests, uses, needs)) + qid = qids.pop() + cells.append(TestCell(qid, f"{qid}-tests", cell.hidden, source, cell.tests, uses, needs)) return GradingBundle(cfg, nb.setup_source(), tuple(cells), tuple(helpers)) @@ -292,7 +313,9 @@ def _config_from_dict(data: dict) -> AssignmentConfig: "budget": int() | float() as budget, "memory_mb": int() as memory_mb, "python": str() as python, + **extra, }: + reject_extra(extra, "assignment config") return AssignmentConfig( name=name, notebook=notebook, @@ -314,7 +337,9 @@ def _question_from_dict(data: object) -> Question: "title": str() as title, "points": int() | float() as points, "manual": bool() as manual, + **extra, }: + reject_extra(extra, "question") return Question(qid, title, float(points), manual) raise ValueError(f"not a question: {data!r}") diff --git a/src/mogs/grader/child.py b/src/mogs/grader/child.py index 55bb37a..9427ea9 100644 --- a/src/mogs/grader/child.py +++ b/src/mogs/grader/child.py @@ -258,7 +258,7 @@ def _run_cell( namespace = {**base, **provided} - match _load(cell.source, f"{cell.qid}-tests", namespace, timeout): + match _load(cell.source, cell.label, namespace, timeout): case (message, reason): _fail_cell(cell, skip, f"the test cell {message}", reason, emit) return diff --git a/src/mogs/grader/protocol.py b/src/mogs/grader/protocol.py index c61f948..9083496 100644 --- a/src/mogs/grader/protocol.py +++ b/src/mogs/grader/protocol.py @@ -1,14 +1,18 @@ """Messages between the grader parent and a grading child. The parent writes one `Job` as JSON to the child's stdin. The child writes events, one JSON -object per line, to a separate file descriptor whose number is its first argument: +object per line, to a separate file descriptor whose number is its first argument. Each event +starts with `"schema": SCHEMA`, the format version: -- `{"event": "loaded", "error": str | None}` once, after setup and binding; +- `{"event": "loaded", "error": str | None, "unavailable": {name: reason}}` once, after setup + and binding; - `{"event": "loading", "tests": [name, ...]}` before loading each test cell (and the hidden helpers it needs), naming the cell's tests that will run; - `{"event": "start", "test": name}` before each test; - `{"event": "result", **outcome}` after each test, with the fields of `Outcome.to_dict`. +A job or event of another format version is a `ProtocolError`. + Student code writes to stdout and stderr freely; neither carries events. """ @@ -18,6 +22,7 @@ from typing import Self from mogs.grader.bundle import GradingBundle +from mogs.grader.wire import SCHEMA, check_schema, reject_extra from mogs.runner import Outcome @@ -35,22 +40,27 @@ class Job: skip: Tests already done, e.g. by an earlier child that died. run_failed: Why an earlier child died while running the whole notebook. When set, the child does not run it again; see `loader.bind`. + alarm: Whether the child times each test itself with an alarm. The child does not + read it yet. """ bundle: GradingBundle submission: Path skip: tuple[str, ...] = () run_failed: str | None = None + alarm: bool = True def to_json(self) -> str: """The job as JSON text.""" return json.dumps( { + "schema": SCHEMA, "bundle": self.bundle.to_dict(), "submission": str(self.submission), "skip": list(self.skip), "run_failed": self.run_failed, + "alarm": self.alarm, } ) @@ -59,31 +69,44 @@ def from_json(cls, text: str) -> Self: """Inverse of `to_json`. Raises: - ProtocolError: If the text is not a job. + ProtocolError: If the text is not a job of version `SCHEMA`. """ try: - match json.loads(text): + data = json.loads(text) + check_schema(data) + + match data: case { + "schema": _, "bundle": bundle, "submission": str() as submission, "skip": list() as skip, "run_failed": None | str() as run_failed, + "alarm": bool() as alarm, + **extra, } if all(isinstance(name, str) for name in skip): - return cls( - GradingBundle.from_dict(bundle), Path(submission), tuple(skip), run_failed - ) + reject_extra(extra, "job") + bundle = GradingBundle.from_dict(bundle) + return cls(bundle, Path(submission), tuple(skip), run_failed, alarm) except ValueError as e: raise ProtocolError(f"bad job: {e}") from e - raise ProtocolError("bad job: expected bundle, submission, skip and run_failed") + raise ProtocolError("bad job: expected bundle, submission, skip, run_failed and alarm") @dataclass(frozen=True, slots=True) class Loaded: - """The child is ready to run tests, or failed to set up (`error`).""" + """The child is ready to run tests, or failed to set up (`error`). + + Attributes: + error: Why setup failed, `None` when it worked. + unavailable: `(name, reason)` for each name the tests use that the submission could + not provide, in the order found. The child leaves it empty for now. + """ error: str | None + unavailable: tuple[tuple[str, str], ...] = () @dataclass(frozen=True, slots=True) @@ -114,8 +137,12 @@ def encode(event: Event) -> str: """One event as a JSON line, ending in a newline.""" match event: - case Loaded(error): - data: dict[str, object] = {"event": "loaded", "error": error} + case Loaded(error, unavailable): + data: dict[str, object] = { + "event": "loaded", + "error": error, + "unavailable": dict(unavailable), + } case Loading(tests): data = {"event": "loading", "tests": list(tests)} case Start(test): @@ -123,6 +150,8 @@ def encode(event: Event) -> str: case Result(outcome): data = {"event": "result", **outcome.to_dict()} + data = {"schema": SCHEMA, **data} + # `json.dumps` escapes newlines inside strings, so the line stays one line. return json.dumps(data) + "\n" @@ -151,22 +180,47 @@ def _decode(line: str) -> Event: except ValueError as e: raise ProtocolError(f"not JSON: {_excerpt(line)}") from e + try: + check_schema(data) + event = _event(data) + except ValueError as e: + raise ProtocolError(str(e)[:200]) from e + + if event is None: + raise ProtocolError(f"not an event: {_excerpt(line)}") + + return event + + +def _event(data: object) -> Event | None: + """The event in a decoded line of the right version, or `None` for another shape. + + Raises: + ValueError: If the line has a key its event does not, or a bad outcome. + """ + match data: - case {"event": "loaded", "error": None | str() as error}: - return Loaded(error) - case {"event": "loading", "tests": list() as tests} if all( + case { + "schema": _, + "event": "loaded", + "error": None | str() as error, + "unavailable": dict() as unavailable, + **extra, + } if all(isinstance(reason, str) for reason in unavailable.values()): + reject_extra(extra, "loaded event") + return Loaded(error, tuple(unavailable.items())) + case {"schema": _, "event": "loading", "tests": list() as tests, **extra} if all( isinstance(test, str) for test in tests ): + reject_extra(extra, "loading event") return Loading(tuple(tests)) - case {"event": "start", "test": str() as test}: + case {"schema": _, "event": "start", "test": str() as test, **extra}: + reject_extra(extra, "start event") return Start(test) - case {"event": "result", **fields}: - try: - return Result(Outcome.from_dict(fields)) - except ValueError as e: - raise ProtocolError(str(e)[:200]) from e + case {"schema": _, "event": "result", **fields}: + return Result(Outcome.from_dict(fields)) - raise ProtocolError(f"not an event: {_excerpt(line)}") + return None def _excerpt(line: str) -> str: diff --git a/src/mogs/grader/wire.py b/src/mogs/grader/wire.py new file mode 100644 index 0000000..2cd209f --- /dev/null +++ b/src/mogs/grader/wire.py @@ -0,0 +1,42 @@ +"""The version of the JSON that crosses between mogs processes. + +A grading bundle, a job and an event each carry `"schema": SCHEMA`. The Rust crate +`mogs-schema` defines their formats; `schemas/` in the repo holds their JSON Schemas. +""" + +import json +from collections.abc import Mapping + +SCHEMA = 1 + + +def check_schema(data: object) -> None: + """Check that a decoded message is of format version `SCHEMA`. + + Raises: + ValueError: If `data` has no `schema` key, or another version. The message names both + versions. + """ + + match data: + case {"schema": int() as version} if not isinstance(version, bool) and version == SCHEMA: + return + case {"schema": version}: + raise ValueError(f"schema version {json.dumps(version)}, expected {SCHEMA}") + + raise ValueError(f"missing schema version, expected {SCHEMA}") + + +def reject_extra(extra: Mapping[object, object], what: str) -> None: + """Fail on the keys a reader's pattern left over, as the Rust reader does. + + Args: + extra: The keys of a message besides the ones the reader knows. + what: The kind of message, for the error. + + Raises: + ValueError: If `extra` holds a key, naming the first one. + """ + + if extra: + raise ValueError(f"unknown field `{next(iter(extra))}` in {what}") diff --git a/src/mogs/runner.py b/src/mogs/runner.py index fae32b9..75b788c 100644 --- a/src/mogs/runner.py +++ b/src/mogs/runner.py @@ -12,6 +12,8 @@ from enum import StrEnum from typing import Self +from mogs.grader.wire import reject_extra + MAX_LINES = 25 MAX_BYTES = 4096 MAX_STATEMENT_LINES = 5 @@ -69,7 +71,8 @@ def from_dict(cls, data: object) -> Self: """Inverse of `to_dict`. Raises: - ValueError: If a field is missing or has the wrong type, or `reason` is unknown. + ValueError: If a field is missing, unknown or has the wrong type, or `reason` is + unknown. """ match data: @@ -79,7 +82,9 @@ def from_dict(cls, data: object) -> Self: "message": str() as message, "reason": None | str() as reason, "seconds": int() | float() as seconds, + **extra, } if not isinstance(seconds, bool): + reject_extra(extra, "outcome") kind = None if reason is None else FailureReason(reason) return cls(name, passed, message, kind, float(seconds)) diff --git a/src/mogs/selfcheck.py b/src/mogs/selfcheck.py index d222ac9..c37cac2 100644 --- a/src/mogs/selfcheck.py +++ b/src/mogs/selfcheck.py @@ -67,8 +67,7 @@ def public_results(path: Path) -> Summary: # The bundle keeps the config but does not read it; a student copy has none. cfg = AssignmentConfig(name=path.stem, notebook=path.name, questions={}) bundle = bundle_from_notebook(nb, cfg).for_phase(Phase.PUBLIC) - # Each cell with the name it reports a load failure under. - cells = [(cell, f"{cell.qid}-tests") for cell in bundle.cells] + cells = list(bundle.cells) outcomes: dict[str, list[Outcome]] = {} students = nb.student_names() @@ -83,7 +82,7 @@ def public_results(path: Path) -> Summary: outcomes.setdefault(qid, []).append(outcome) continue - cells.append((TestCell(qid, False, source, names, uses), relative)) + cells.append(TestCell(qid, relative, False, source, names, uses)) base: dict[str, object] = {"__name__": "__mogs_selfcheck__"} setup_error = None @@ -95,7 +94,7 @@ def public_results(path: Path) -> Summary: setup_error = cap(f"the setup cell failed ({exception_summary(exc)})") if setup_error is None: - uses = sorted({name for cell, _ in cells for name in cell.uses}) + uses = sorted({name for cell in cells for name in cell.uses}) bound = bind(path, uses) base.update(bound) missing = { @@ -104,7 +103,7 @@ def public_results(path: Path) -> Summary: if (reason := unavailable(value)) is not None } - for cell, label in cells: + for cell in cells: results = outcomes.setdefault(cell.qid, []) if setup_error is not None: @@ -112,7 +111,7 @@ def public_results(path: Path) -> Summary: results += [Outcome(name, False, setup_error, reason) for name in cell.tests] continue - results += run_test_source(cell.source, label, cell.tests, dict(base)) + results += run_test_source(cell.source, cell.label, cell.tests, dict(base)) questions: dict[str, dict[str, object]] = { qid: { diff --git a/tests/fixtures/forge_print.py b/tests/fixtures/forge_print.py index 32fe01d..a2ee926 100644 --- a/tests/fixtures/forge_print.py +++ b/tests/fixtures/forge_print.py @@ -19,9 +19,9 @@ def misbehave(): import sys for name in ["test_q1_bad", "test_q1_before", "test_q1_after", "test_q2_other"]: - result = {"event": "result", "name": name, "passed": True} + result = {"schema": 1, "event": "result", "name": name, "passed": True} result |= {"message": "", "reason": None, "seconds": 0.0} - for line in [{"event": "start", "test": name}, result]: + for line in [{"schema": 1, "event": "start", "test": name}, result]: print(json.dumps(line)) print(json.dumps(line), file=sys.stderr) diff --git a/tests/test_child.py b/tests/test_child.py index f16e166..b7b5eac 100644 --- a/tests/test_child.py +++ b/tests/test_child.py @@ -96,7 +96,7 @@ def config(timeout: float = 60) -> AssignmentConfig: def cell(source: str, tests: tuple[str, ...], uses: tuple[str, ...] = ()) -> TestCell: - return TestCell("q1", False, textwrap.dedent(source), tests, uses) + return TestCell("q1", "q1-tests", False, textwrap.dedent(source), tests, uses) def submission(tmp_path: Path, body: str = "") -> Path: @@ -245,6 +245,16 @@ def test_bundle_json_holds_no_host_paths(tmp_path): assert GradingBundle.from_json(text).config.requirements is None +def test_bundle_labels_each_cell_after_its_question(): + bundle = solution_bundle() + + assert [(c.qid, c.label) for c in bundle.cells] == [ + (c.qid, f"{c.qid}-tests") for c in bundle.cells + ] + assert {c.qid for c in bundle.cells} == {"q1", "q2"} + assert json.loads(bundle.to_json())["cells"][0]["label"] == "q1-tests" + + def test_for_phase_splits_cells(): bundle = solution_bundle() @@ -362,14 +372,33 @@ def test_outcome_from_bad_dict_raises(): def test_event_encoding(): outcome = Outcome("test_q1_a", False, "AssertionError", FailureReason.ASSERTION, 0.5) - assert json.loads(encode(Loaded(None))) == {"event": "loaded", "error": None} - assert json.loads(encode(Start("test_q1_a"))) == {"event": "start", "test": "test_q1_a"} - assert json.loads(encode(Loading(("a", "b")))) == {"event": "loading", "tests": ["a", "b"]} - assert json.loads(encode(Result(outcome))) == {"event": "result", **outcome.to_dict()} + unavailable = (("y", "it raised"), ("x", "no cell defines it")) + loaded = {"schema": 1, "event": "loaded", "error": None, "unavailable": dict(unavailable)} + start = {"schema": 1, "event": "start", "test": "test_q1_a"} + loading = {"schema": 1, "event": "loading", "tests": ["a", "b"]} + result = {"schema": 1, "event": "result", **outcome.to_dict()} + + assert json.loads(encode(Loaded(None, unavailable))) == loaded + assert list(json.loads(encode(Loaded(None, unavailable)))["unavailable"]) == ["y", "x"] + assert decode(encode(Loaded(None, unavailable))) == Loaded(None, unavailable) + assert json.loads(encode(Loaded(None)))["unavailable"] == {} + assert hash(Loaded(None, unavailable)) + assert json.loads(encode(Start("test_q1_a"))) == start + assert json.loads(encode(Loading(("a", "b")))) == loading + assert json.loads(encode(Result(outcome))) == result + assert list(json.loads(encode(Start("t")))) == ["schema", "event", "test"] assert encode(Loaded("x")).endswith("\n") assert encode(Loaded("x")).count("\n") == 1 - for event in [Loaded(None), Loaded("bad"), Loading(("t",)), Start("t"), Result(outcome)]: + events = [ + Loaded(None), + Loaded("bad", (("x", "y"),)), + Loading(("t",)), + Start("t"), + Result(outcome), + ] + + for event in events: assert decode(encode(event)) == event @@ -379,19 +408,27 @@ def test_event_encoding(): "", "not json", "[]", - '{"event": "nope"}', - '{"event": "start"}', - '{"event": "loading", "tests": "t"}', - '{"event": "loading", "tests": [1]}', + '{"event": "start", "test": "t"}', + '{"schema": 1, "event": "nope"}', + '{"schema": 1, "event": "start"}', + '{"schema": 1, "event": "loading", "tests": "t"}', + '{"schema": 1, "event": "loading", "tests": [1]}', "[" * 200_000 + "]" * 200_000, - '{"event": "result", "name": "t", "passed": true, "message": "", "reason": "x", ' - '"seconds": 0}', + '{"schema": 1, "event": "result", "name": "t", "passed": true, "message": "", ' + '"reason": "x", "seconds": 0}', + '{"schema": 1, "event": "loaded", "error": null}', + '{"schema": 1, "event": "loaded", "error": null, "unavailable": {"x": 1}}', + '{"schema": true, "event": "start", "test": "t"}', ], ) def test_decode_rejects_bad_lines(line): - with pytest.raises(ProtocolError): + with pytest.raises(ProtocolError) as error: decode(line) + # A line of the right version fails on its shape, not on the version check. + if line.startswith('{"schema": 1,'): + assert "schema version" not in str(error.value) + def test_job_json_round_trip(tmp_path): job = Job(solution_bundle(), tmp_path / "s.py", ("test_q1_add",)) @@ -405,6 +442,21 @@ def test_job_json_round_trip_with_run_failed(tmp_path): assert Job.from_json(job.to_json()) == job +def test_job_alarm_defaults_to_true_and_round_trips(tmp_path): + job = Job(solution_bundle(), tmp_path / "s.py") + + assert job.alarm + assert Job.from_json(copy.replace(job, alarm=False).to_json()).alarm is False + + +def test_job_without_alarm_is_rejected(tmp_path): + data = json.loads(Job(solution_bundle(), tmp_path / "s.py").to_json()) + del data["alarm"] + + with pytest.raises(ProtocolError, match="alarm"): + Job.from_json(json.dumps(data)) + + # Child process @@ -497,6 +549,15 @@ def test_cell_that_fails_to_load_fails_only_its_tests(tmp_path): assert "SyntaxError" in results["test_q1_c"].message +def test_cell_compiles_under_its_label(tmp_path): + broken = TestCell("q1", "tests/q1.py", False, "def test_q1_a(:\n", ("test_q1_a",), ()) + bundle = GradingBundle(config(), "", (broken,)) + results = by_name(run_child(tmp_path, Job(bundle, submission(tmp_path)))) + + assert results["test_q1_a"].reason is FailureReason.LOAD_FAILED + assert "q1.py" in results["test_q1_a"].message + + def test_test_missing_from_its_cell_fails(tmp_path): bundle = GradingBundle(config(), "", (cell("x = 1\n", ("test_q1_a",)),)) results = by_name(run_child(tmp_path, Job(bundle, submission(tmp_path)))) @@ -596,7 +657,7 @@ def test_q1_fast(): def test_student_streams_are_not_the_event_channel(tmp_path): - fake = json.dumps({"event": "result", **Outcome("test_q1_a", True).to_dict()}) + fake = json.dumps({"schema": 1, "event": "result", **Outcome("test_q1_a", True).to_dict()}) path = submission( tmp_path, f""" diff --git a/tests/test_results.py b/tests/test_results.py index 0f7718a..15b5fa5 100644 --- a/tests/test_results.py +++ b/tests/test_results.py @@ -18,8 +18,8 @@ def bundle() -> GradingBundle: "q2": Question("q2", "Essay", 5, manual=True), } cells = ( - TestCell("q1", False, "", PUBLIC, ()), - TestCell("q1", True, "", HIDDEN, ()), + TestCell("q1", "q1-tests", False, "", PUBLIC, ()), + TestCell("q1", "q1-tests", True, "", HIDDEN, ()), ) return GradingBundle(AssignmentConfig("A", "hw.py", questions), "", cells) @@ -60,7 +60,7 @@ def test_three_of_four_tests_give_three_quarters_of_the_points(): def test_score_is_rounded(): - cells = (TestCell("q1", False, "", ("test_q1_a", "test_q1_b", "test_q1_c"), ()),) + cells = (TestCell("q1", "q1-tests", False, "", ("test_q1_a", "test_q1_b", "test_q1_c"), ()),) grading = GradingBundle( AssignmentConfig("A", "hw.py", {"q1": Question("q1", "Q", 1)}), "", cells ) @@ -153,8 +153,8 @@ def test_question_with_only_hidden_tests_is_left_out_of_the_public_row(): "q2": Question("q2", "Secret", 5), } cells = ( - TestCell("q1", False, "", PUBLIC, ()), - TestCell("q2", True, "", ("test_q2_x",), ()), + TestCell("q1", "q1-tests", False, "", PUBLIC, ()), + TestCell("q2", "q2-tests", True, "", ("test_q2_x",), ()), ) grading = GradingBundle(AssignmentConfig("A", "hw.py", questions), "", cells) result = {name: Outcome(name, True) for name in (*PUBLIC, "test_q2_x")} @@ -166,7 +166,7 @@ def test_question_with_only_hidden_tests_is_left_out_of_the_public_row(): def test_no_public_tests_means_no_public_row(): - cells = (TestCell("q1", True, "", HIDDEN, ()),) + cells = (TestCell("q1", "q1-tests", True, "", HIDDEN, ()),) grading = GradingBundle( AssignmentConfig("A", "hw.py", {"q1": Question("q1", "Q", 1)}), "", cells ) diff --git a/tests/test_sandbox.py b/tests/test_sandbox.py index 1154715..c614e8f 100644 --- a/tests/test_sandbox.py +++ b/tests/test_sandbox.py @@ -63,7 +63,7 @@ def cell(qid: str, source: str, *, hidden: bool = False, uses=("add", "misbehave tests = tuple( line[4:].split("(")[0] for line in source.splitlines() if line.startswith("def test_") ) - return TestCell(qid, hidden, source, tests, tuple(uses)) + return TestCell(qid, f"{qid}-tests", hidden, source, tests, tuple(uses)) def bundle(*cells: TestCell, **kwargs) -> GradingBundle: @@ -164,7 +164,7 @@ def test_parent_keeps_first_result_and_ignores_unstarted_tests(tmp_path): import json, os, sys def send(name, passed): - result = {"event": "result", "name": name, "passed": passed} + result = {"schema": 1, "event": "result", "name": name, "passed": passed} result |= {"message": "forged", "reason": None if passed else "error", "seconds": 0.0} os.write(int(sys.argv[1]), (json.dumps(result) + "\\n").encode()) diff --git a/tests/test_schemas.py b/tests/test_schemas.py new file mode 100644 index 0000000..ed53b15 --- /dev/null +++ b/tests/test_schemas.py @@ -0,0 +1,326 @@ +import copy +import errno +import json +import os +import shutil +import subprocess +import sys +from pathlib import Path + +import jsonschema +import pytest + +from mogs.config import read_config +from mogs.grader.bundle import GradingBundle, HiddenHelper, Phase, bundle_from_notebook +from mogs.grader.protocol import ( + Job, + Loaded, + Loading, + ProtocolError, + Result, + Start, + decode, + encode, +) +from mogs.grader.results import build_results, failure_results +from mogs.grader.wire import SCHEMA, check_schema +from mogs.runner import FailureReason, Outcome, exception_summary +from mogs.source import module_tests, parse_notebook + +SCHEMAS = Path(__file__).parents[1] / "schemas" +SOLUTION = Path(__file__).parent / "fixtures" / "solution.py" + + +def schema(name: str) -> dict: + return json.loads((SCHEMAS / f"{name}.schema.json").read_text(encoding="utf-8")) + + +def validate(instance: object, name: str) -> None: + jsonschema.validate(instance, schema(name), cls=jsonschema.Draft202012Validator) + + +def solution_bundle() -> GradingBundle: + src = SOLUTION.read_text(encoding="utf-8") + return bundle_from_notebook(parse_notebook(src), read_config(src, SOLUTION)) + + +def test_child_events_match_schema(tmp_path): + submission = tmp_path / "submission.py" + shutil.copy(SOLUTION, submission) + events = tmp_path / "events.jsonl" + env = {key: value for key, value in os.environ.items() if key != "PYTEST_CURRENT_TEST"} + + for phase in Phase: + job = Job(solution_bundle().for_phase(phase), submission) + + with events.open("w") as sink: + result = subprocess.run( + [sys.executable, "-m", "mogs.grader.child", str(sink.fileno())], + input=job.to_json(), + pass_fds=(sink.fileno(),), + capture_output=True, + text=True, + env=env, + cwd=tmp_path, + timeout=120, + ) + + assert result.returncode == 0, result.stderr + lines = events.read_text(encoding="utf-8").splitlines() + kinds = {json.loads(line)["event"] for line in lines} + + assert kinds == {"loaded", "loading", "start", "result"} + + for line in lines: + validate(json.loads(line), "event") + + +def test_job_matches_schema(tmp_path): + job = Job(solution_bundle(), tmp_path / "s.py", ("test_q1_add",), run_failed="exit code 3") + data = json.loads(job.to_json()) + + validate(data, "job") + assert list(data) == ["schema", "bundle", "submission", "skip", "run_failed", "alarm"] + assert data["alarm"] is True + + +def test_bundle_json_matches_schema(): + bundle = solution_bundle() + + for part in [bundle, bundle.for_phase(Phase.PUBLIC), bundle.for_phase(Phase.HIDDEN)]: + validate(json.loads(part.to_json()), "bundle") + + +def test_results_match_schema(): + bundle = solution_bundle() + names = [name for cell in bundle.cells for name in cell.tests] + outcomes = {name: Outcome(name, False, "boom", FailureReason.ASSERTION) for name in names} + + validate(build_results(bundle, outcomes, ["No PDF found."]), "results") + validate(failure_results(bundle, RuntimeError()), "results") + validate(failure_results(None, RuntimeError()), "results") + + +def other_version(text: str) -> str: + return json.dumps({**json.loads(text), "schema": 2}) + + +def test_decode_rejects_other_version(tmp_path): + bundle = solution_bundle() + job = Job(bundle, tmp_path / "s.py") + event = '{"schema": 1, "event": "start", "test": "test_q1_add"}' + + with pytest.raises(ProtocolError, match="schema version 2, expected 1"): + Job.from_json(other_version(job.to_json())) + with pytest.raises(ProtocolError, match="schema version 2, expected 1"): + decode(other_version(event)) + with pytest.raises(ValueError, match="schema version 2, expected 1"): + GradingBundle.from_json(other_version(bundle.to_json())) + with pytest.raises(ProtocolError, match="missing schema version, expected 1"): + decode('{"event": "start", "test": "test_q1_add"}') + + +def test_check_schema_lives_in_wire(): + check_schema({"schema": SCHEMA}) + + with pytest.raises(ValueError, match="schema version 2, expected 1"): + check_schema({"schema": 2}) + + +def with_extra_key(data: dict, path: tuple[str | int, ...]) -> dict: + data = copy.deepcopy(data) + target = data + + for step in path: + target = target[step] + + target["bogus"] = 1 + return data + + +def test_schemas_reject_unknown_keys(tmp_path): + bundle = solution_bundle() + job = json.loads(Job(bundle, tmp_path / "s.py").to_json()) + passed = {name: Outcome(name, True) for cell in bundle.cells for name in cell.tests} + results = dict(build_results(bundle, passed, [])) + events = [ + {"schema": 1, "event": "loaded", "error": None, "unavailable": {}}, + {"schema": 1, "event": "loading", "tests": []}, + {"schema": 1, "event": "start", "test": "t"}, + {"schema": 1, "event": "result", **Outcome("t", True).to_dict()}, + ] + cases = [ + *[(job, path, "job") for path in [(), ("bundle",), ("bundle", "config")]], + (job, ("bundle", "config", "questions", 0), "job"), + (job, ("bundle", "cells", 0), "job"), + (json.loads(bundle.to_json()), (), "bundle"), + *[(event, (), "event") for event in events], + (results, (), "results"), + (results, ("tests", 0), "results"), + ] + + for data, path, name in cases: + validate(data, name) + + with pytest.raises(jsonschema.ValidationError, match="bogus"): + validate(with_extra_key(data, path), name) + + +def test_python_readers_reject_unknown_keys(tmp_path): + helper = HiddenHelper("secret = 1\n", ("secret",), (), ()) + bundle = copy.replace(solution_bundle(), helpers=(helper,)) + job = json.loads(Job(bundle, tmp_path / "s.py").to_json()) + events = [ + json.loads(encode(event)) + for event in [Loaded(None), Loading(("t",)), Start("t"), Result(Outcome("t", True))] + ] + job_paths = [ + (), + ("bundle",), + ("bundle", "config"), + ("bundle", "config", "questions", 0), + ("bundle", "cells", 0), + ("bundle", "helpers", 0), + ] + + for path in job_paths: + assert Job.from_json(json.dumps(job)) == Job(bundle, tmp_path / "s.py") + + with pytest.raises(ProtocolError, match="unknown field `bogus`"): + Job.from_json(json.dumps(with_extra_key(job, path))) + + if path: + with pytest.raises(ValueError, match="unknown field `bogus`"): + GradingBundle.from_dict(with_extra_key(job, path)["bundle"]) + + for event in events: + assert decode(json.dumps(event)) is not None + + with pytest.raises(ProtocolError, match="unknown field `bogus`"): + decode(json.dumps(with_extra_key(event, ()))) + + +@pytest.mark.parametrize("key", ["score", "output", "output_format"]) +def test_results_schema_rejects_null(key): + with pytest.raises(jsonschema.ValidationError): + validate({"tests": [], "stdout_visibility": "hidden", key: None}, "results") + + +# What `mogs inspect` writes for a test file it cannot read is the data of the exception, which +# each call site turns back into the exception Python raises. These check that the recipe in +# `crates/mogs-schema/src/inspect.rs` gives back the same text. + +SYNTAX_CLASSES: dict[type[SyntaxError], str] = { + SyntaxError: "syntax_error", + IndentationError: "indentation_error", + TabError: "tab_error", +} + + +def wire_error(exc: BaseException) -> dict: + """The `TestFileError` a producer writes for `exc`.""" + + match exc: + case FileNotFoundError(): + return {"kind": "missing"} + case OSError(errno=int() as number): + return {"kind": "unreadable", "errno": number} + case UnicodeDecodeError(start=start, end=end, object=data, reason=reason): + data = list(data[start:end]) + reason = reason.replace(" ", "_") + return {"kind": "not_utf8", "start": start, "bytes": data, "reason": reason} + case SyntaxError(lineno=int() as line, msg=message): + kind = SYNTAX_CLASSES[type(exc)] + return {"kind": "syntax", "class": kind, "line": line, "message": message} + + raise AssertionError(f"no wire error for {exc!r}") + + +def rebuilt(error: dict, file: Path) -> BaseException: + """The exception that `error` stands for, as the doc comments say to rebuild it.""" + + match error: + case {"kind": "missing"}: + return FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), str(file)) + case {"kind": "unreadable", "errno": int() as number}: + return OSError(number, os.strerror(number), str(file)) + case {"kind": "not_utf8", "start": int() as start, "bytes": list() as data}: + reason = error["reason"].replace("_", " ") + padded = bytes(start) + bytes(data) + return UnicodeDecodeError("utf-8", padded, start, start + len(data), reason) + case {"kind": "syntax", "class": str() as name, "line": int() as line}: + kind = {value: key for key, value in SYNTAX_CLASSES.items()}[name] + return kind(error["message"], ("", line, None, None)) + + raise AssertionError(f"not a test file error: {error!r}") + + +def read_test_file(path: Path) -> BaseException: + """The exception `selfcheck` and `check` get reading and parsing the test file at `path`.""" + + try: + module_tests(path.read_text(encoding="utf-8")) + except (OSError, UnicodeDecodeError, SyntaxError) as exc: + return exc + + raise AssertionError(f"{path} reads fine") + + +def assert_rebuilds(path: Path) -> dict: + real = read_test_file(path) + error = wire_error(real) + copy_of = rebuilt(error, path) + definitions = schema("inspect")["$defs"] + + jsonschema.validate( + error, + {"$ref": "#/$defs/TestFileError", "$defs": definitions}, + cls=jsonschema.Draft202012Validator, + ) + assert type(copy_of) is type(real) + assert str(copy_of) == str(real) + assert exception_summary(copy_of) == exception_summary(real) + + return error + + +@pytest.mark.parametrize( + ("data", "reason"), + [ + (b"abc\xff", "invalid_start_byte"), + (b"abc\xe2(", "invalid_continuation_byte"), + (b"abc\xe2\x82", "unexpected_end_of_data"), + (b"abc\xf0\x9f(", "invalid_continuation_byte"), + ], +) +def test_not_utf8_rebuilds_the_decode_error(tmp_path, data, reason): + path = tmp_path / "q1.py" + path.write_bytes(data) + + assert assert_rebuilds(path)["reason"] == reason + + +@pytest.mark.parametrize( + ("source", "kind"), + [ + ("def test_q1_a(:\n", "syntax_error"), + ("def test_q1_a():\nreturn 1\n", "indentation_error"), + ("if True:\n\tx = 1\n y = 2\n", "tab_error"), + ], +) +def test_syntax_rebuilds_each_class(tmp_path, source, kind): + path = tmp_path / "q1.py" + path.write_text(source, encoding="utf-8") + + assert assert_rebuilds(path)["class"] == kind + + +def test_missing_rebuilds_the_os_error(tmp_path): + assert assert_rebuilds(tmp_path / "q1.py") == {"kind": "missing"} + + +def test_unreadable_rebuilds_the_os_error(tmp_path): + folder = tmp_path / "q1.py" + folder.mkdir() + + assert assert_rebuilds(folder)["kind"] == "unreadable" diff --git a/uv.lock b/uv.lock index 7d04434..0d5567d 100644 --- a/uv.lock +++ b/uv.lock @@ -24,6 +24,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/a9/16/7757fb84c819accc7d7e9af5291b261e4abb8627ee040f99e7d35ef2457a/anyio-4.16.0-py3-none-any.whl", hash = "sha256:c66ae634e0b8228396b801741beb3294326d4b6102f7bba4041c0dfb58c29026", size = 134521, upload-time = "2026-11-01T11:20:05.59Z" }, ] +[[package]] +name = "attrs" +version = "26.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/9a/8e/82a0fe20a541c03148528be8cac2408564a6c9a0cc7e9171802bc1d26985/attrs-26.1.0.tar.gz", hash = "sha256:d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32", size = 952055, upload-time = "2026-03-19T14:22:25.026Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/64/b4/17d4b0b2a2dc85a6df63d1157e028ed19f90d4cd97c36717afef2bc2f395/attrs-26.1.0-py3-none-any.whl", hash = "sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309", size = 67548, upload-time = "2026-03-19T14:22:23.645Z" }, +] + [[package]] name = "cffi" version = "2.1.1" @@ -172,6 +181,33 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/be/c7/71eb0d51cdcbb63b857c931aa4e9218b078b5d9f8ecd383b234f28fe7b0f/jedi-0.20.1-py2.py3-none-any.whl", hash = "sha256:0fb16d86c4a4c73c37ba518c77419975e30fcc620658a8d14fbb5720cdd34142", size = 4885980, upload-time = "2026-10-12T17:42:21.585Z" }, ] +[[package]] +name = "jsonschema" +version = "4.26.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "attrs" }, + { name = "jsonschema-specifications" }, + { name = "referencing" }, + { name = "rpds-py" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b3/fc/e067678238fa451312d4c62bf6e6cf5ec56375422aee02f9cb5f909b3047/jsonschema-4.26.0.tar.gz", hash = "sha256:0c26707e2efad8aa1bfc5b7ce170f3fccc2e4918ff85989ba9ffa9facb2be326", size = 366583, upload-time = "2026-01-07T13:41:07.246Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/69/90/f63fb5873511e014207a475e2bb4e8b2e570d655b00ac19a9a0ca0a385ee/jsonschema-4.26.0-py3-none-any.whl", hash = "sha256:d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce", size = 90630, upload-time = "2026-01-07T13:41:05.306Z" }, +] + +[[package]] +name = "jsonschema-specifications" +version = "2025.9.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "referencing" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/19/74/a633ee74eb36c44aa6d1095e7cc5569bebf04342ee146178e2d36600708b/jsonschema_specifications-2025.9.1.tar.gz", hash = "sha256:b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d", size = 32855, upload-time = "2025-09-08T01:34:59.186Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/41/45/1a4ed80516f02155c51f51e8cedb3c1902296743db0bbc66608a0db2814f/jsonschema_specifications-2025.9.1-py3-none-any.whl", hash = "sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe", size = 18437, upload-time = "2025-09-08T01:34:57.871Z" }, +] + [[package]] name = "loro" version = "1.18.0" @@ -271,6 +307,7 @@ pdf = [ [package.dev-dependencies] dev = [ + { name = "jsonschema" }, { name = "mogs", extra = ["pdf"] }, { name = "pypdf" }, { name = "pytest" }, @@ -289,6 +326,7 @@ provides-extras = ["pdf"] [package.metadata.requires-dev] dev = [ + { name = "jsonschema", specifier = ">=4" }, { name = "mogs", extras = ["pdf"] }, { name = "pypdf", specifier = ">=5" }, { name = "pytest", specifier = ">=8" }, @@ -586,6 +624,100 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e8/5d/33c528d9b7ee074d0807e3af1a23a3e50bfdbe28cbc178e99f0466c13648/pyzmq-27.3.0-cp315-cp315t-win_arm64.whl", hash = "sha256:f0b9d192b285a9d38e390e762011f2672432742a301859b6c8cb4fab5f10f687", size = 594143, upload-time = "2026-11-04T00:30:24.33Z" }, ] +[[package]] +name = "referencing" +version = "0.37.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "attrs" }, + { name = "rpds-py" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/22/f5/df4e9027acead3ecc63e50fe1e36aca1523e1719559c499951bb4b53188f/referencing-0.37.0.tar.gz", hash = "sha256:44aefc3142c5b842538163acb373e24cce6632bd54bdb01b21ad5863489f50d8", size = 78036, upload-time = "2025-10-13T15:30:48.871Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2c/58/ca301544e1fa93ed4f80d724bf5b194f6e4b945841c5bfd555878eea9fcb/referencing-0.37.0-py3-none-any.whl", hash = "sha256:381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231", size = 26766, upload-time = "2025-10-13T15:30:47.625Z" }, +] + +[[package]] +name = "rpds-py" +version = "2026.9.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/42/68/3bd46b8a5e01d3c2ebdf9c5e9497912e3fe0cde02bac21a7130ca866e403/rpds_py-2026.9.1.tar.gz", hash = "sha256:4793ef7f78268b124b73fa933440f01d258bbae01de9fa53e9080c9ab0425a12", size = 63948, upload-time = "2026-10-04T16:32:36.469Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/83/ea/ee88fd9e756ff93fb6b1182a47ec09504a242620e33ce1d20679efefe841/rpds_py-2026.9.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:a36b70596407634ca82d4b989a3729074a008537a0522e4c8046a67c729103e9", size = 346229, upload-time = "2026-10-04T16:29:38.82Z" }, + { url = "https://files.pythonhosted.org/packages/57/71/a097d6552f837500fc36e6b23d09cfb9890c3cc47531f9ca64e149799615/rpds_py-2026.9.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:eba5d173f7d5708b22a93815017a4611873ed54db9f268077c0dd1ed99cfc858", size = 340514, upload-time = "2026-10-04T16:29:40.405Z" }, + { url = "https://files.pythonhosted.org/packages/bd/b7/497e85768bf4e0d8ddbaa096a4cac31d1509251dee2728a8490aa367e0b5/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:457866b85daf5034296666168b84a69e0b2e89dc4f1af102b46f6448a60b9063", size = 372611, upload-time = "2026-10-04T16:29:41.778Z" }, + { url = "https://files.pythonhosted.org/packages/52/4b/74ab4108916250b6e198e0d3af05bc6835eb046315f22f7a0ceb49667c5a/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a3a52a3ba86436ab3aef510fbe21512abc2ddd1993005dfe50514bd2284ef025", size = 377712, upload-time = "2026-10-04T16:29:43.242Z" }, + { url = "https://files.pythonhosted.org/packages/0c/8e/067e77d9d7b3cc793c9d909b7e97e7aadbbb1fb094093b6876902cc96d38/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d7841166b7fa64c9c56404617ae4341448847482d45933b13135d26c130519e5", size = 488106, upload-time = "2026-10-04T16:29:44.692Z" }, + { url = "https://files.pythonhosted.org/packages/3c/b4/c5aae6c2dde269bf955f6b7d35065c655a57e47750d9668052ad67e74dda/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:926bdd3e3b5998ddf70cc64bc8cf57209571f9044542913afb673799fec77dd0", size = 390795, upload-time = "2026-10-04T16:29:46.129Z" }, + { url = "https://files.pythonhosted.org/packages/a0/36/76fab39973ee11e7f9f357c55138197bb01c86f6502cb76487e3b4f42db0/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7868b85224291c6cb6759f9b5adb9745f486d226f62b16a614dd5a2a5ab2b35b", size = 370794, upload-time = "2026-10-04T16:29:47.603Z" }, + { url = "https://files.pythonhosted.org/packages/3d/fe/cd2a80e6d7b871937a60e935c5d507aa390d143f4ff3636f640b9733d5df/rpds_py-2026.9.1-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:3cd182d7291d29b92c521a0069d9c01ba6193628a9a105531d11b40a6d731a33", size = 375673, upload-time = "2026-10-04T16:29:49.223Z" }, + { url = "https://files.pythonhosted.org/packages/6c/18/7464a9953724e55a3b3206062fa0ffdeaa519584c6aabf65d3956d94f131/rpds_py-2026.9.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e6ea1cda8d8c688278430e4268a42f5e5da3bdd74578dfadc0820c3f1766ce83", size = 398758, upload-time = "2026-10-04T16:29:50.601Z" }, + { url = "https://files.pythonhosted.org/packages/c0/86/1534b436700fd49ff411063b7c4d7e938adfabf90895b6cf1622d5a7d1f6/rpds_py-2026.9.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:5943980471829f6de242a20b109de3111ba6b77e3af0ffc587028ac854b05e6c", size = 550370, upload-time = "2026-10-04T16:29:52.002Z" }, + { url = "https://files.pythonhosted.org/packages/57/1c/e1fa82a8a01e3c5820f3ba98a8b2673f642128eb368fa88871b01dd2c909/rpds_py-2026.9.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:76d3af9732d2dab69f28179b40ba2d87e2f1d5824b4a694780aa787d685e8f36", size = 613106, upload-time = "2026-10-04T16:29:53.655Z" }, + { url = "https://files.pythonhosted.org/packages/29/55/b20b8c4c3dde8755bfcd5b08492a02d0cd2e26929aedf6199ca2a377d42a/rpds_py-2026.9.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:78326f4cb4427a56ba4996c0762b63be45f06b85f086526420d2b3a66e40f84d", size = 578235, upload-time = "2026-10-04T16:29:55.157Z" }, + { url = "https://files.pythonhosted.org/packages/55/42/df3f7bbc3f7ab37a8a9db8d6c2ff2c985422899f1f7926afbf7ec3c0b8b4/rpds_py-2026.9.1-cp313-cp313-win32.whl", hash = "sha256:172e47169583f46ce118cbec68e6795d0da0f4606b488b6434f8276bca0a058c", size = 205293, upload-time = "2026-10-04T16:29:56.669Z" }, + { url = "https://files.pythonhosted.org/packages/31/9c/ba5a9569d719bfdd6ce863df4133ac6a1658cf1b07cc3534c31db729fbbc/rpds_py-2026.9.1-cp313-cp313-win_amd64.whl", hash = "sha256:3e93b2cd69a9830be33e03945cd7cda940a0a8bfcfbff41d6144f0cb0d3d8bd9", size = 222409, upload-time = "2026-10-04T16:29:58.049Z" }, + { url = "https://files.pythonhosted.org/packages/35/72/f28ca566f6c23c35bbf7445f65eb0364577b25a026305995e24f78b83d94/rpds_py-2026.9.1-cp313-cp313-win_arm64.whl", hash = "sha256:d151e148117294133bf8af7eeace085e7e87432db15ab6adf640330298a47f6f", size = 217681, upload-time = "2026-10-04T16:29:59.449Z" }, + { url = "https://files.pythonhosted.org/packages/8a/f2/67b94be1532767803415c1c5a1fd88ea487643d74a673cec1ba140af77bb/rpds_py-2026.9.1-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:c9d1aca01f49170fdcf5c92761b1fafe97f554b721ca4570c5949fff778f0d4b", size = 347178, upload-time = "2026-10-04T16:30:00.865Z" }, + { url = "https://files.pythonhosted.org/packages/04/37/b751de2b59b0197a1d92a5dd491de88e8a5e928c2e6562581974f1e85263/rpds_py-2026.9.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:3f0e9ac28fc067d4d34b88ae43c48e9489455c97fee9633d851f7eeed5a05d35", size = 341878, upload-time = "2026-10-04T16:30:02.564Z" }, + { url = "https://files.pythonhosted.org/packages/72/e2/5873bc4643c250db9e05d48dc0c93763d4aa68bc3b81164cb1af3b45b284/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:07deecbfce94c78473018bc7d10b337cc651d12df87a1eb2cb3e4024bc9c33d0", size = 373963, upload-time = "2026-10-04T16:30:04.026Z" }, + { url = "https://files.pythonhosted.org/packages/51/03/5acf7632158247f3f6386ff0af3a1ee48167d575037e8d0920594b76d92b/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:821b2755db9194409254012f429c56643416fb96ef9be090be82ec8826b7f477", size = 377975, upload-time = "2026-10-04T16:30:05.555Z" }, + { url = "https://files.pythonhosted.org/packages/e6/00/63fda451b8bffa5808fc8bb311ee7c073b340974b09f273c7b2a145d3d62/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c91c210ae7645626c608400e3519b4a642f837cce09ca830db3beb2e9f274d4", size = 490347, upload-time = "2026-10-04T16:30:07.156Z" }, + { url = "https://files.pythonhosted.org/packages/a1/ae/c093ffd070ba0fb02f76c565d06fecc65ad6e4afdbae78f7031076d3cdac/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:54ac2158a6f96cfbabff0b2eedaf94b90c5ec7ca8317fcadc61e1c2b2e0ff6ef", size = 392962, upload-time = "2026-10-04T16:30:08.77Z" }, + { url = "https://files.pythonhosted.org/packages/22/9d/d08a1128ab199b2f0cf25bfeb0639bd05119fff4b7c47bec24ef9a8ec23f/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eac2f5dbafd585dfe31f86a23ebf0d3ba480a9d49ebc87947267b5608d4ea0cd", size = 371623, upload-time = "2026-10-04T16:30:10.501Z" }, + { url = "https://files.pythonhosted.org/packages/53/c7/4758ddcbb75609414bbccfcb11d612436f9b3ee821bd2f33f0f1604ee648/rpds_py-2026.9.1-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:8aa5dda18d39b6143eb24809d158f9252c88f402749b6f1b62a506cc7d96cc35", size = 376997, upload-time = "2026-10-04T16:30:12.124Z" }, + { url = "https://files.pythonhosted.org/packages/87/e4/947bd7f608ff60faf46dc9d389c3dffd0e3d767d78a0be19978448ef0ce7/rpds_py-2026.9.1-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5c90e7fa02e8f5de0d10c17595c568ada48c5302e749462c0ea1a4c362111a86", size = 400169, upload-time = "2026-10-04T16:30:13.804Z" }, + { url = "https://files.pythonhosted.org/packages/4b/35/fe93e020a0543b5670472c18d7e6af3197c08da571240ce1965c84f85c0f/rpds_py-2026.9.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:e6d198bad4e49dd6732fbd636e2fc5c082f45c8cad0b4acb756b00c82c76072e", size = 551615, upload-time = "2026-10-04T16:30:15.332Z" }, + { url = "https://files.pythonhosted.org/packages/0d/4f/5d2a0136bb03b2a56a39dc6ff92d58a6e3e53a2e17079238b86228882f16/rpds_py-2026.9.1-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:96beca19ec79de272e8668585380ff9092c47077c1d7a1e098e00bbd921f4785", size = 614655, upload-time = "2026-10-04T16:30:16.92Z" }, + { url = "https://files.pythonhosted.org/packages/09/1c/3f1025aaf70d9bf7272cc41f8b64ee76b48bf01726248138430e16f23b38/rpds_py-2026.9.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:a5cf77eb04f20b720be95265a3e00eb2a14814074255cc27069c551b2db53118", size = 579602, upload-time = "2026-10-04T16:30:18.555Z" }, + { url = "https://files.pythonhosted.org/packages/53/0d/5c72e6204f76610608706da32b6b7e11ef7e10317558a7bb15a122e008dc/rpds_py-2026.9.1-cp314-cp314-win32.whl", hash = "sha256:a03d57b86d2a51d0a66c92177e2be154ad015f357791d306e714569999cdb4cc", size = 206315, upload-time = "2026-10-04T16:30:20.05Z" }, + { url = "https://files.pythonhosted.org/packages/a4/0b/489d48abbcc7d70cf3fbf662d9d22abf1f4650761c0a9ae05260800800d3/rpds_py-2026.9.1-cp314-cp314-win_amd64.whl", hash = "sha256:837c6b305e26fe0f75b15c92cf3b2ba29e0ae19dc40b1c557b026cb426347d0c", size = 222852, upload-time = "2026-10-04T16:30:21.604Z" }, + { url = "https://files.pythonhosted.org/packages/91/16/bbb05a7e6a10cf79ba639be7f799d770ee15f64175cc61d081b218dd402a/rpds_py-2026.9.1-cp314-cp314-win_arm64.whl", hash = "sha256:fce4b85234a0cbad67bf8e6e1201ee815d172c9aebad75f25645bc4d834f8e31", size = 218709, upload-time = "2026-10-04T16:30:23.036Z" }, + { url = "https://files.pythonhosted.org/packages/22/ac/ac507a0a4ec478ca470440a09583db4be5259ba7670aeba0620822f1e57a/rpds_py-2026.9.1-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:3a72c11530d71abfb66c8d7696a2f86c43e63fca8b948f1a784ac490f4ec688e", size = 349596, upload-time = "2026-10-04T16:30:24.558Z" }, + { url = "https://files.pythonhosted.org/packages/e9/f2/817a46b658d5070f477f722c298ee9a24525b0e4017347964146ef5fdd0e/rpds_py-2026.9.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:068c37bba854ec2fe42f7365c640af11dd9895890ccbf2df5070d0c059bd7f96", size = 343114, upload-time = "2026-10-04T16:30:26.048Z" }, + { url = "https://files.pythonhosted.org/packages/6c/42/6ade976b13ac1b4cb3bf2eb603f1be2fe74df19a29988d4c2b386be59d6f/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7fca4eb6df565e2a928f1c7dad92d27db8f9df0f449e76423ed5d7e713ed445", size = 374197, upload-time = "2026-10-04T16:30:27.699Z" }, + { url = "https://files.pythonhosted.org/packages/d9/70/77cdf1d3f1a07faabe936016ae623aec7981f73108a8fe7a203ed2e21998/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c933c6678c6f116ff8af47a4c6db0868b8ace74af0343016c0ef00f00272ea69", size = 378025, upload-time = "2026-10-04T16:30:29.451Z" }, + { url = "https://files.pythonhosted.org/packages/3f/6b/18a44a3beaa9b7931acb04af7bd9539836477c630a794452d4826d6185d4/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:028ad274ea951dac64491b5d1e65712a4aeabfdbdb9fccf797b57bd899b0c495", size = 491969, upload-time = "2026-10-04T16:30:30.995Z" }, + { url = "https://files.pythonhosted.org/packages/73/27/fb39cfd6bddaf741b024f813890374578ff8ac1f1adc473659c048b03b05/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:740d0a99cf9de0b17a3943388e9294a59becf75e7c43421f387bd3c7a9901f7c", size = 393905, upload-time = "2026-10-04T16:30:32.628Z" }, + { url = "https://files.pythonhosted.org/packages/ed/71/0fa7bb77b57af0d710273964180d11b503f62b8a5c358eb2d8c3f62feff6/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0da298fb372dc192610a4b9ecbc68a0cd8b675bbbd1fc519d01b41cfd658333e", size = 374569, upload-time = "2026-10-04T16:30:34.257Z" }, + { url = "https://files.pythonhosted.org/packages/54/22/f41cfac269af3b449513ef1bc3d7f32fde52abbbd2d01c7e76b47743acd9/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:eb61be926bb81567c1f48bdc8aa22b9855048dc2efd53871f9f7e6e9a5632346", size = 377482, upload-time = "2026-10-04T16:30:35.997Z" }, + { url = "https://files.pythonhosted.org/packages/b4/fc/312b49006e7f8f9ca5f96647577b8aa6f3df30519c46bd448f5c425af0b2/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:42e75466f83cd43f6026c81eab74246efb2bdadafb307b85700632d06c68f299", size = 400040, upload-time = "2026-10-04T16:30:37.76Z" }, + { url = "https://files.pythonhosted.org/packages/cf/a6/18cca7a878dc7fa95165a83343fd4d7b65643fd22e54e47340a451121d5c/rpds_py-2026.9.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:617f59cde379b4f648a09797b7f683d04b90a46344cddab85639da5aff0f5531", size = 551849, upload-time = "2026-10-04T16:30:39.443Z" }, + { url = "https://files.pythonhosted.org/packages/e4/6d/1f5685e20f39604691bdc3c05aaa6b8bd2f954e9e996477adf2376768e33/rpds_py-2026.9.1-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:3edae8c5ddfdb6985d49ae9d150516e5076888879022f91a26c2de9276ce0bdb", size = 614842, upload-time = "2026-10-04T16:30:41.231Z" }, + { url = "https://files.pythonhosted.org/packages/c6/25/98652109fd9f7e10268dd4571aa52b81987001b806f37ef1a18260de714a/rpds_py-2026.9.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:0f045bb053c9057720d72c56dffe30dffdc05997b2897a827b9325f0ab6623fa", size = 582606, upload-time = "2026-10-04T16:30:43.345Z" }, + { url = "https://files.pythonhosted.org/packages/19/03/11ca09099bab5f53373a80a334c424ec917c13d050760a59499d2af5171e/rpds_py-2026.9.1-cp314-cp314t-win32.whl", hash = "sha256:bf35d0568abda97233239ce32896d3ad53fccc537832c104e30c94aa5fb93569", size = 203341, upload-time = "2026-10-04T16:30:44.954Z" }, + { url = "https://files.pythonhosted.org/packages/6f/8a/88909e3ffd9f47f5b58211473875d8c3c09079f0058c46fb72c55a702a26/rpds_py-2026.9.1-cp314-cp314t-win_amd64.whl", hash = "sha256:1e8d4d79d828299bf44a55db22a9388ab967b49d17132c88eab0f4360b48da8e", size = 222843, upload-time = "2026-10-04T16:30:46.486Z" }, + { url = "https://files.pythonhosted.org/packages/f6/b7/a662f367d4896dd0a10cef2fc91f10b7f08af1c10858e287e019563f338d/rpds_py-2026.9.1-cp315-cp315-macosx_10_12_x86_64.whl", hash = "sha256:1d77b649e6f7cdf12ca5c2a98dad0ad37f9ea9b6f960408a92f0cb12bb3d04d9", size = 347463, upload-time = "2026-10-04T16:30:48.203Z" }, + { url = "https://files.pythonhosted.org/packages/ae/3f/ad45d03df4f84ebae5439577ee81f3999d182711e82235c8037b6528890e/rpds_py-2026.9.1-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:00ba2d8c7dd4ee537978ddf4b3fbd712bef2d8751603f7f3146b3f4287768e25", size = 342051, upload-time = "2026-10-04T16:30:49.872Z" }, + { url = "https://files.pythonhosted.org/packages/7e/31/3dcd68c13d4bcc59c1f7eb33ac8e80698f06f3eb0d8a1e06419836071c20/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ec450527cbf485e13c8d3602a54f428ab0432fdade0ede75efd74b735421c871", size = 374143, upload-time = "2026-10-04T16:30:51.508Z" }, + { url = "https://files.pythonhosted.org/packages/cf/0d/68c1f058a250fbd1380ebda9fc227cbf50117adf8ffe8161ef383ea79f68/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:306ee1850d8105b5baf977e78d45fcadd12c1a54678d614c9baf217708446e91", size = 378604, upload-time = "2026-10-04T16:30:53.206Z" }, + { url = "https://files.pythonhosted.org/packages/d7/d6/2d4c59b85397cb4800594fadf692688ccf5ce556adc930e7a5bf21061a5e/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ef6b65b03247c54692ad4fd9ee97cb772781927db72e3cb05e70b3db6d1ff14f", size = 490790, upload-time = "2026-10-04T16:30:54.925Z" }, + { url = "https://files.pythonhosted.org/packages/da/04/7e05dc3aebaf52f4e026766bd668fdd09a9d0e23f64a14686b36b3501892/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a575404ebc9cf2e91edd32eaf570ec1430eb900d4f56724ba7dd4bc1fc9c176d", size = 393146, upload-time = "2026-10-04T16:30:56.625Z" }, + { url = "https://files.pythonhosted.org/packages/57/ca/e2e9a0a46a74ed51a0498ba1fe10f4ea6b2d9a155f372a2f91e51f18cf10/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c16ab111bc27c646ba8aa005d0527754edc538ebb636f0b1bf8e244b48d1945", size = 372022, upload-time = "2026-10-04T16:30:58.295Z" }, + { url = "https://files.pythonhosted.org/packages/ba/cb/8f8774df5134e23424372838bcc5c7ed4127d723e1ff52f7bebd4dcb2563/rpds_py-2026.9.1-cp315-cp315-manylinux_2_31_riscv64.whl", hash = "sha256:7664419f27db41d4f1c43a78dccda7dd6e8ef2428df3ee01d0c2a07a6b071297", size = 377092, upload-time = "2026-10-04T16:30:59.984Z" }, + { url = "https://files.pythonhosted.org/packages/90/02/8d7095d73bf9114219be40230baa5df00611e0a82ed9517779ff9c19f82b/rpds_py-2026.9.1-cp315-cp315-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4b26b03d9d2658ee2fa234f8f4f19f38a09773fe5261028025032e26d4d35af0", size = 400830, upload-time = "2026-10-04T16:31:01.721Z" }, + { url = "https://files.pythonhosted.org/packages/ec/02/8206856f8f363cd042a8315dc86b3912f5dcb6d3c66bbb24b69c2bfb0775/rpds_py-2026.9.1-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:be3e47e2d91aa3942ff9bf4077a505226005abfc39b6f7554a91c1b9393986b9", size = 551478, upload-time = "2026-10-04T16:31:03.472Z" }, + { url = "https://files.pythonhosted.org/packages/41/6b/36211f1bb1f0b0313f496d92f5905b74ea107f27cb16fa3355a82f04575e/rpds_py-2026.9.1-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:6307a0da524939decb8ca4a3933b8ab62525794411d6984fca6726e732804af6", size = 615173, upload-time = "2026-10-04T16:31:05.281Z" }, + { url = "https://files.pythonhosted.org/packages/35/77/cda0c4a6f055446b692f0ed5692f73707cafd3dff82672ede31b1a9b59de/rpds_py-2026.9.1-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:159a7aab5c5e8b112c8830f54717ce56da1252ebdbb526f5be2df2309280b9e7", size = 579653, upload-time = "2026-10-04T16:31:07.065Z" }, + { url = "https://files.pythonhosted.org/packages/74/ec/d8385f446240aed643b9e92a5055cff3015cc04a13c61f73b2883c478ed5/rpds_py-2026.9.1-cp315-cp315-win32.whl", hash = "sha256:dbc2673f9223d420c91145599b3ba45a8a50c207d1976908e5fb5ddb0c9b9429", size = 206498, upload-time = "2026-10-04T16:31:08.989Z" }, + { url = "https://files.pythonhosted.org/packages/6d/a5/71b5cd00e0521e3b6b81828baea368c62b6b700ebdd9554cd7d41ddf12fa/rpds_py-2026.9.1-cp315-cp315-win_amd64.whl", hash = "sha256:75c38c50ab9aca840225d9a9a3810bf11d04bd5c1f186cabbb8aee56db3e9b15", size = 223121, upload-time = "2026-10-04T16:31:10.84Z" }, + { url = "https://files.pythonhosted.org/packages/33/58/dba857c3bc8221b31b62eb170a3080f4f191de79f047200389b7ed1b06a7/rpds_py-2026.9.1-cp315-cp315-win_arm64.whl", hash = "sha256:a431156bb41865fc14cd5d79bb9d7bbed83110b0159e34e62ae30951f96c0009", size = 218741, upload-time = "2026-10-04T16:31:12.592Z" }, + { url = "https://files.pythonhosted.org/packages/5b/d0/320ab28ccc1415eeb509d68682b0014fb74690cd49f1c2d29a232475af50/rpds_py-2026.9.1-cp315-cp315t-macosx_10_12_x86_64.whl", hash = "sha256:ef0d8c843e2827d6c120ab4687e9423fb1d893db1df27b7c1506615bcb9734a0", size = 349719, upload-time = "2026-10-04T16:31:14.48Z" }, + { url = "https://files.pythonhosted.org/packages/56/88/f5b12f1358f443c08b7ce3cc8391d82d335f4872580e2e097847fd36087a/rpds_py-2026.9.1-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:45bc6bccf78b20fd834237d18db64965d7ee68ba7f60440a26c7ab71e7b8d51a", size = 343267, upload-time = "2026-10-04T16:31:16.827Z" }, + { url = "https://files.pythonhosted.org/packages/f7/0c/c765b0059d532acb3b9c45d781ccc22f15a96dbe443d00903f643ba9df10/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1d55198263bb51f557550c6ed2e6d1cb6a6fed6eb5c9120b741c5926bef8a45d", size = 374555, upload-time = "2026-10-04T16:31:18.931Z" }, + { url = "https://files.pythonhosted.org/packages/6b/8a/cafddfda77564a10cd21184640c3bffda6a2b8d20972fb5dedd5e0166328/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a8763f20692da7df39b0afdd1ba3042b004c50a45994f76c2d9a25641f7673db", size = 378346, upload-time = "2026-10-04T16:31:20.75Z" }, + { url = "https://files.pythonhosted.org/packages/b9/01/5e626016eff72c183bf6c96539240cace15d402468647a453ec08415b2fc/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e43d4a1f673e8a1cbd8533e809e02b4bf9d4f2280269bb640436556312121250", size = 492373, upload-time = "2026-10-04T16:31:22.614Z" }, + { url = "https://files.pythonhosted.org/packages/3b/9c/15a2469e9389242f46896b3f0a01d68caea8a5a35c011fcb05ef333aae73/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ea394a937f17a54c51239348bdbe2e3518124c8d4a8951ba04a311d3095bd18f", size = 394371, upload-time = "2026-10-04T16:31:24.768Z" }, + { url = "https://files.pythonhosted.org/packages/63/f5/c100ff77e1e6366e947c75969c258fdfc4b7bc5bbfe7351e62ffbf2a1228/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cdeaa99ce822dca76cfb1b993e9120c5ea212f2eb66d48950ad63c349668a018", size = 375132, upload-time = "2026-10-04T16:31:26.588Z" }, + { url = "https://files.pythonhosted.org/packages/dd/f4/fe0269c9de253e99c81cabc12b8971a5feaa083debdaff1221e06264d9e3/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_31_riscv64.whl", hash = "sha256:b4f062343e7ad3fa94f2c66e5ae667dee47ee74dd41a9057c4fbe163236a123d", size = 377642, upload-time = "2026-10-04T16:31:28.677Z" }, + { url = "https://files.pythonhosted.org/packages/05/65/b34a7b257baccff8f4a24a722933166d4941d5ebdc9c3f4bc4ffcd5ce4f4/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:22ffd29a63d71fb1b81552c21f2c2b734949b7ac751a9be70675a939a900839b", size = 400855, upload-time = "2026-10-04T16:31:30.802Z" }, + { url = "https://files.pythonhosted.org/packages/98/32/844e54176b6071b90b38a564e6940bc6eb8f97b2890dc709c19db9dec0f4/rpds_py-2026.9.1-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:08dae4a4095150a7c4545a1fb40b98e1ab1744fbc2770d92c977b9dadaa49ab6", size = 552573, upload-time = "2026-10-04T16:31:32.709Z" }, + { url = "https://files.pythonhosted.org/packages/17/73/6041d20729dffbfdf155c02d65be58bc225a1c1fb548fd87c23ef306138f/rpds_py-2026.9.1-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:9a0460d43603d1fd9ef59c30278531e15d78581721ddb538fa560aa7817ea4ad", size = 615840, upload-time = "2026-10-04T16:31:34.565Z" }, + { url = "https://files.pythonhosted.org/packages/af/9e/418094adaee6b056ce199051b255448ed872829051e341b2294c80da0977/rpds_py-2026.9.1-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:1c2d1f6da5128eabf34e963d7163a818846075a52568250d006c4c953b40f903", size = 582764, upload-time = "2026-10-04T16:31:36.665Z" }, + { url = "https://files.pythonhosted.org/packages/3d/9b/1698ebf6b840ddfe8b472198abbed6ace35c6e398faeecd6c47dae742a4e/rpds_py-2026.9.1-cp315-cp315t-win32.whl", hash = "sha256:5c6ee90dee3e85e055ddfd502d611643d9b0fd94c818220bda84ec3dacd9b27b", size = 203795, upload-time = "2026-10-04T16:31:38.53Z" }, + { url = "https://files.pythonhosted.org/packages/8a/e2/91f70d804c61f8eac39a417e82aa1024f655ab9e8bdd7393b196242bc41b/rpds_py-2026.9.1-cp315-cp315t-win_amd64.whl", hash = "sha256:fe5ad0664ec772b02c45859041aa17655709cced7a31005817fbbbd988c25567", size = 223037, upload-time = "2026-10-04T16:31:40.468Z" }, +] + [[package]] name = "ruff" version = "0.17.6"