diff --git a/cli/.github/workflows/ci.yml b/.github/workflows/cli.yml similarity index 58% rename from cli/.github/workflows/ci.yml rename to .github/workflows/cli.yml index 1e08313..7e2bc82 100644 --- a/cli/.github/workflows/ci.yml +++ b/.github/workflows/cli.yml @@ -1,4 +1,4 @@ -name: standard ci checks +name: cli on: push: @@ -17,10 +17,18 @@ jobs: steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt,clippy - uses: mozilla-actions/sccache-action@v0.0.9 - uses: Swatinem/rust-cache@v2 with: workspaces: . - uses: jdx/mise-action@v2 + with: + version: 2026.6.11 + # TODO: consider cache: true + # https://github.com/marketplace/actions/mise-action#example-workflow + - name: Ensure rustfmt and clippy are installed for pinned Rust version + run: mise x -- rustup component add rustfmt clippy --toolchain 1.96.0 - name: Run CLI checks - run: mise r ci + run: mise //cli:ci diff --git a/python/.github/workflows/ci.yml b/.github/workflows/python.yml similarity index 63% rename from python/.github/workflows/ci.yml rename to .github/workflows/python.yml index 4669aae..d3bace6 100644 --- a/python/.github/workflows/ci.yml +++ b/.github/workflows/python.yml @@ -1,4 +1,4 @@ -name: standard ci +name: python-sdk on: push: @@ -18,8 +18,13 @@ jobs: # https://docs.astral.sh/uv/guides/integration/github/ uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b with: - version: "0.11.17" + # this is the actual uv version + version: "0.11.21" - uses: jdx/mise-action@v2 + with: + version: 2026.6.11 + # TODO: consider cache: true + # https://github.com/marketplace/actions/mise-action#example-workflow - name: Run Python SDK CI - run: mise run ci + run: mise //python:ci diff --git a/typescript/.github/workflows/ci.yml b/.github/workflows/typescript.yml similarity index 60% rename from typescript/.github/workflows/ci.yml rename to .github/workflows/typescript.yml index 48f22a0..8ddbef5 100644 --- a/typescript/.github/workflows/ci.yml +++ b/.github/workflows/typescript.yml @@ -1,4 +1,4 @@ -name: standard ci checks +name: typescript-sdk on: push: @@ -16,5 +16,9 @@ jobs: with: bun-version: 1.3.14 - uses: jdx/mise-action@v2 + with: + version: 2026.6.11 + # TODO: consider cache: true + # https://github.com/marketplace/actions/mise-action#example-workflow - name: run-ci - run: mise r ci + run: mise //typescript:ci diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8f73094 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.envrc +.DS_Store +/.quantiles diff --git a/cli/.gitignore b/cli/.gitignore index 6ae5d45..47b21b7 100644 --- a/cli/.gitignore +++ b/cli/.gitignore @@ -19,7 +19,6 @@ target # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ -.DS_Store /.quantiles /.wrangler /dist diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..36da1f4 --- /dev/null +++ b/mise.toml @@ -0,0 +1,12 @@ +monorepo_root = true + +[monorepo] +config_roots = [".", "cli", "typescript", "python"] + +[tools] +# keep this version inline with the version declared in .github/workflows/typescript +bun = "1.3.14" +# keep this version inline with rust stable +rust = "1.96.0" +# keep this version inline with the version declared in .github/workflows/python +uv = "0.11.21" diff --git a/python/src/quantiles/datasets.py b/python/src/quantiles/datasets.py index 947d307..f1280c9 100644 --- a/python/src/quantiles/datasets.py +++ b/python/src/quantiles/datasets.py @@ -186,7 +186,10 @@ async def _execute() -> JsonValue: # `list[JsonValue]` when resolving the recursive type alias. # The cast is a workaround for this limitation. The data is guaranteed # by `load_batch`'s return type. - return cast(JsonValue, await self._source.load_batch(self._offset, self._batch_size)) + raw: list[dict[str, JsonValue]] = await self._source.load_batch( + self._offset, self._batch_size + ) + return cast(JsonValue, raw) batch = await step( self._ctx, @@ -194,8 +197,14 @@ async def _execute() -> JsonValue: input_value=cast(JsonValue, batch_input), execute=_execute, ) + # Note that _execute must return a `JsonValue`, per the contract in `step`, + # but in reality it returns a `list[dict[str, JsonValue]]` and casts to a + # `JsonValue`. The narrower list[dict...] type actually is a JsonValue, so + # that's just an up-cast. this is a(n admittedly weak) attempt at downcasting, + # but in reality, as long as the typing here matches with that above in + # _execute, we're fine. batch_list = batch if isinstance(batch, list) else [] - self._buffer.extend(batch_list) + self._buffer.extend(cast(list[dict[str, JsonValue]], batch_list)) async def dataset[RowT: BaseModel]( diff --git a/typescript/README.md b/typescript/README.md index a3759f7..56c2968 100644 --- a/typescript/README.md +++ b/typescript/README.md @@ -1,4 +1,4 @@ -# @quantiles/sdk +# `@quantiles/sdk` TypeScript client for the local Quantiles eval runner. diff --git a/typescript/mise.toml b/typescript/mise.toml index 6264871..0377cef 100644 --- a/typescript/mise.toml +++ b/typescript/mise.toml @@ -1,21 +1,29 @@ +[tasks.install] +run = "bun install" + +[tasks.install-frozen] +run = "bun install --frozen-lockfile" + [tasks.check] +depends = ["install-frozen"] run = "bun run check" [tasks.typecheck] +depends = ["install-frozen"] run = "bunx tsc --noEmit" [tasks.lint] +depends = ["install-frozen"] run = "bunx biome ci" [tasks.fmt] +depends = ["install-frozen"] run = "bun run fmt" [tasks.example-prompt-eval] +depends = ["install-frozen"] run = "qt run support-triage -- bun run examples/prompt_eval.ts" -[tasks.install-frozen] -run = "bun install --frozen-lockfile" - [tasks.ci] run = [ "bun install --frozen-lockfile",