This is an automated email from the ASF dual-hosted git repository. tisonkun pushed a commit to branch codex/migrate-generators-to-go in repository https://gitbox.apache.org/repos/asf/datasketches-tck.git
commit 4e93af8db932919136c09a0eb4b917cfeab1d3cd Author: tison <[email protected]> AuthorDate: Mon Aug 10 01:24:06 2026 +0800 feat: migrate snapshot generators to Go Signed-off-by: tison <[email protected]> --- .gitignore | 4 +- README.md | 26 ++++- cmd/tck/main.go | 34 +++++++ go.mod | 20 ++++ internal/cli/run.go | 192 +++++++++++++++++++++++++++++++++++ internal/cli/run_test.go | 95 +++++++++++++++++ internal/snapshots/command.go | 59 +++++++++++ internal/snapshots/cpp.go | 58 +++++++++++ internal/snapshots/diff.go | 174 +++++++++++++++++++++++++++++++ internal/snapshots/diff_test.go | 122 ++++++++++++++++++++++ internal/snapshots/files.go | 93 +++++++++++++++++ internal/snapshots/generator.go | 61 +++++++++++ internal/snapshots/go.go | 39 +++++++ internal/snapshots/java.go | 87 ++++++++++++++++ internal/snapshots/reconcile.go | 184 +++++++++++++++++++++++++++++++++ internal/snapshots/revisions.go | 29 ++++++ internal/snapshots/stability.go | 102 +++++++++++++++++++ internal/snapshots/stability_test.go | 56 ++++++++++ mise.toml | 34 +++++++ pyproject.toml | 27 ----- serialization/cpp/generator.py | 101 ------------------ serialization/go/generator.py | 92 ----------------- serialization/java/generator.py | 98 ------------------ tools/tck/__init__.py | 49 --------- uv.lock | 167 ------------------------------ 25 files changed, 1465 insertions(+), 538 deletions(-) diff --git a/.gitignore b/.gitignore index 493ffe3..15f4d1c 100644 --- a/.gitignore +++ b/.gitignore @@ -16,9 +16,7 @@ # under the License. # Temporary files -tmp_datasketches_java/ -tmp_datasketches_cpp/ -tmp_datasketches_go/ +tmp_datasketches_*/ # VSCode project files .vscode diff --git a/README.md b/README.md index 22fe05a..04b8cf3 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,31 @@ The structure (or image) of a serialized sketch is independent of the language f This repository contains snapshots of serialized sketches, which a particular DataSketches implementation should be able to read. Snapshot generators are also included. +### Snapshot generators + +The repository-local Go CLI checks out pinned DataSketches implementations and runs their own snapshot generation suites. [mise](https://mise.jdx.dev/) installs the required Go, CMake, Java, and Maven toolchains and exposes the CLI: + +```shell +mise install +mise run tck -- snapshots check go +mise run tck -- snapshots update go +``` + +Replace `go` with `cpp`, `java`, or `all`. Git is required for every generator. The C++ generator additionally requires CTest and a C++ compiler, while the Go generator requires Make. + +`check` leaves the repository unchanged. It reports added, modified, and deleted files with their stability class, size, and SHA-256 digest. Added or deleted files and modifications to stable snapshots make the check fail. Modifications to known probabilistic snapshots are reported but allowed. `update` atomically replaces the selected snapshot directory with freshly generated files. + +The upstream repositories and exact commits are pinned together in `internal/snapshots/revisions.go`. The stability rules reflect repeated generation at those commits and the project discussion about probabilistic sketches: + +| Source | Snapshots allowed to vary | +| --- | --- | +| C++ and Java | Bloom filters; KLL and classic quantiles after compaction (`n >= 1000`); REQ after compaction (`n >= 100`); VarOpt sampling mode | +| Go | Bloom filters; REQ after compaction (`n >= 100`); reservoir and VarOpt sampling mode | + +The pinned Go KLL generator enables its deterministic test offset, so its generated KLL files remain strictly checked. These rules do not claim that probabilistic snapshots are logically unchecked: the upstream generation suites validate their construction, while consuming DataSketches implementations remain responsible for compatibility assertions with algorithm-appropriate tolerances. + +Background: [central snapshot generation issue](https://github.com/apache/datasketches-rust/issues/10#issuecomment-3663796398), [cross-language testing discussion](https://github.com/apache/datasketches-rust/discussions/4#discussioncomment-15226056), [dev mailing-list inventory](https://www.mail-archive.com/dev%40datasketches.apache.org/msg04302.html), and [KLL non-determinism discussion](https://github.com/apache/datasketches-java/issues/693). + ## Contribute Please visit the main [DataSketches website](https://datasketches.apache.org) for more information. @@ -21,4 +46,3 @@ If you are interested in making contributions to this site, please see our [Comm ## License Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 - diff --git a/cmd/tck/main.go b/cmd/tck/main.go new file mode 100644 index 0000000..18ed043 --- /dev/null +++ b/cmd/tck/main.go @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package main + +import ( + "context" + "os" + "os/signal" + "syscall" + + "github.com/apache/datasketches-tck/internal/cli" +) + +func main() { + ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) + code := cli.Run(ctx, os.Args[1:], os.Stdout, os.Stderr) + stop() + os.Exit(code) +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..e14a0bb --- /dev/null +++ b/go.mod @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +module github.com/apache/datasketches-tck + +go 1.26.0 + +toolchain go1.26.5 diff --git a/internal/cli/run.go b/internal/cli/run.go new file mode 100644 index 0000000..6ddaf41 --- /dev/null +++ b/internal/cli/run.go @@ -0,0 +1,192 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cli + +import ( + "context" + "encoding/hex" + "errors" + "fmt" + "io" + "os" + "os/exec" + "path/filepath" + "strings" + + "github.com/apache/datasketches-tck/internal/snapshots" +) + +var errSnapshotsOutOfDate = errors.New("stable snapshots are out of date") + +func Run(ctx context.Context, args []string, stdout, stderr io.Writer) int { + if err := run(ctx, args, stdout, stderr); err != nil { + fmt.Fprintf(stderr, "Error: %v\n", err) + return 1 + } + return 0 +} + +func run(ctx context.Context, args []string, stdout, stderr io.Writer) error { + if len(args) == 0 || (len(args) == 1 && isHelp(args[0])) { + printUsage(stdout) + return nil + } + if len(args) != 3 || args[0] != "snapshots" { + printUsage(stderr) + return errors.New("expected snapshots <check|update> <cpp|go|java|all>") + } + + mode := snapshots.Mode(args[1]) + if mode != snapshots.ModeCheck && mode != snapshots.ModeUpdate { + return fmt.Errorf("unsupported snapshot mode %q", args[1]) + } + + languages := []string{args[2]} + if args[2] == "all" { + languages = snapshots.Languages() + } else if !snapshots.HasLanguage(args[2]) { + return fmt.Errorf("unsupported snapshot language %q", args[2]) + } + + root, err := repositoryRoot(ctx) + if err != nil { + return err + } + + outOfDate := false + for _, language := range languages { + fmt.Fprintf(stdout, "--- %s %s snapshots ---\n", title(args[1]), language) + result, err := snapshots.Reconcile(ctx, root, language, mode, stdout, stderr) + if err != nil { + return err + } + printResult(stdout, root, mode, result) + outOfDate = outOfDate || (mode == snapshots.ModeCheck && result.HasBlockingChanges()) + } + if outOfDate { + return errSnapshotsOutOfDate + } + return nil +} + +func printResult(output io.Writer, root string, mode snapshots.Mode, result snapshots.Result) { + target := displayPath(root, result.Target) + if len(result.Changes) == 0 { + fmt.Fprintf(output, "%s is up to date.\n", target) + return + } + + counts := make(map[snapshots.ChangeStatus]int) + unstableModified := 0 + for _, change := range result.Changes { + counts[change.Status]++ + if change.Status == snapshots.ChangeModified && change.Stability == snapshots.Unstable { + unstableModified++ + } + fmt.Fprintf( + output, + "%s %-8s %s (%s)\n", + change.Status, + change.Stability, + change.Path, + changeDetails(change), + ) + } + + fmt.Fprintf( + output, + "Summary: %d added, %d modified (%d unstable), %d deleted.\n", + counts[snapshots.ChangeAdded], + counts[snapshots.ChangeModified], + unstableModified, + counts[snapshots.ChangeDeleted], + ) + + switch { + case mode == snapshots.ModeUpdate: + fmt.Fprintf(output, "Updated %s.\n", target) + case result.HasBlockingChanges(): + fmt.Fprintf(output, "%s has %d blocking change(s).\n", target, result.BlockingChangeCount()) + default: + fmt.Fprintf(output, "Stable snapshots are current; %d unstable modification(s) are allowed.\n", unstableModified) + } +} + +func changeDetails(change snapshots.Change) string { + switch change.Status { + case snapshots.ChangeAdded: + return formatMetadata(*change.After) + case snapshots.ChangeDeleted: + return formatMetadata(*change.Before) + case snapshots.ChangeModified: + return formatMetadata(*change.Before) + " -> " + formatMetadata(*change.After) + default: + panic(fmt.Sprintf("unsupported change status %q", change.Status)) + } +} + +func formatMetadata(metadata snapshots.FileMetadata) string { + return fmt.Sprintf( + "%d B, sha256:%s", + metadata.Size, + hex.EncodeToString(metadata.SHA256[:6]), + ) +} + +func repositoryRoot(ctx context.Context) (string, error) { + if configured := os.Getenv("TCK_REPOSITORY_ROOT"); configured != "" { + root, err := filepath.Abs(configured) + if err != nil { + return "", fmt.Errorf("resolve TCK_REPOSITORY_ROOT: %w", err) + } + return root, nil + } + + command := exec.CommandContext(ctx, "git", "rev-parse", "--show-toplevel") + output, err := command.Output() + if err != nil { + return "", fmt.Errorf("resolve repository root with git: %w", err) + } + return strings.TrimSpace(string(output)), nil +} + +func displayPath(root, filename string) string { + relative, err := filepath.Rel(root, filename) + if err != nil || relative == ".." || filepath.IsAbs(relative) { + return filename + } + if strings.HasPrefix(relative, ".."+string(filepath.Separator)) { + return filename + } + return filepath.ToSlash(relative) +} + +func printUsage(output io.Writer) { + fmt.Fprintln(output, "Usage: tck snapshots <check|update> <cpp|go|java|all>") +} + +func isHelp(argument string) bool { + return argument == "help" || argument == "-h" || argument == "--help" +} + +func title(value string) string { + if value == "" { + return value + } + return strings.ToUpper(value[:1]) + value[1:] +} diff --git a/internal/cli/run_test.go b/internal/cli/run_test.go new file mode 100644 index 0000000..9a086b2 --- /dev/null +++ b/internal/cli/run_test.go @@ -0,0 +1,95 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cli + +import ( + "bytes" + "path/filepath" + "strings" + "testing" + + "github.com/apache/datasketches-tck/internal/snapshots" +) + +func TestPrintResultIncludesDetailedFileChanges(t *testing.T) { + t.Parallel() + + root := t.TempDir() + before := testMetadata(12, 0xaa) + after := testMetadata(16, 0xbb) + result := snapshots.Result{ + Target: filepath.Join(root, "serialization", "go", "snapshots"), + Changes: []snapshots.Change{ + { + Status: snapshots.ChangeAdded, Stability: snapshots.Stable, + Path: "added.sk", After: &after, + }, + { + Status: snapshots.ChangeModified, Stability: snapshots.Unstable, + Path: "modified.sk", Before: &before, After: &after, + }, + { + Status: snapshots.ChangeDeleted, Stability: snapshots.Stable, + Path: "deleted.sk", Before: &before, + }, + }, + } + + var output bytes.Buffer + printResult(&output, root, snapshots.ModeCheck, result) + wantLines := []string{ + "A stable added.sk (16 B, sha256:bbbbbbbbbbbb)", + "M unstable modified.sk (12 B, sha256:aaaaaaaaaaaa -> 16 B, sha256:bbbbbbbbbbbb)", + "D stable deleted.sk (12 B, sha256:aaaaaaaaaaaa)", + "Summary: 1 added, 1 modified (1 unstable), 1 deleted.", + "serialization/go/snapshots has 2 blocking change(s).", + } + for _, line := range wantLines { + if !strings.Contains(output.String(), line+"\n") { + t.Fatalf("output does not contain %q:\n%s", line, output.String()) + } + } +} + +func TestPrintResultAllowsOnlyUnstableModifications(t *testing.T) { + t.Parallel() + + before := testMetadata(12, 0xaa) + after := testMetadata(12, 0xbb) + result := snapshots.Result{ + Target: "snapshots", + Changes: []snapshots.Change{{ + Status: snapshots.ChangeModified, Stability: snapshots.Unstable, + Path: "probabilistic.sk", Before: &before, After: &after, + }}, + } + + var output bytes.Buffer + printResult(&output, ".", snapshots.ModeCheck, result) + if !strings.Contains(output.String(), "Stable snapshots are current; 1 unstable modification(s) are allowed.\n") { + t.Fatalf("unexpected output:\n%s", output.String()) + } +} + +func testMetadata(size int64, fill byte) snapshots.FileMetadata { + metadata := snapshots.FileMetadata{Size: size} + for index := range metadata.SHA256 { + metadata.SHA256[index] = fill + } + return metadata +} diff --git a/internal/snapshots/command.go b/internal/snapshots/command.go new file mode 100644 index 0000000..73954cb --- /dev/null +++ b/internal/snapshots/command.go @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package snapshots + +import ( + "context" + "fmt" + "os/exec" + "strings" +) + +func (runner commandRunner) run(ctx context.Context, directory, name string, arguments ...string) error { + commandLine := strings.Join(append([]string{name}, arguments...), " ") + fmt.Fprintf(runner.stdout, "$ %s\n", commandLine) + + command := exec.CommandContext(ctx, name, arguments...) + command.Dir = directory + command.Stdout = runner.stdout + command.Stderr = runner.stderr + if err := command.Run(); err != nil { + return fmt.Errorf("run %s: %w", commandLine, err) + } + return nil +} + +func cloneAtCommit( + ctx context.Context, + runner commandRunner, + repository, commit, destination string, +) error { + if err := runner.run(ctx, "", "git", "init", "--quiet", destination); err != nil { + return err + } + if err := runner.run(ctx, "", "git", "-C", destination, "remote", "add", "origin", repository); err != nil { + return err + } + if err := runner.run(ctx, "", "git", "-C", destination, "fetch", "--depth", "1", "--no-tags", "origin", commit); err != nil { + return err + } + if err := runner.run(ctx, "", "git", "-C", destination, "checkout", "--quiet", "--detach", "FETCH_HEAD"); err != nil { + return err + } + return nil +} diff --git a/internal/snapshots/cpp.go b/internal/snapshots/cpp.go new file mode 100644 index 0000000..a25e210 --- /dev/null +++ b/internal/snapshots/cpp.go @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package snapshots + +import ( + "context" + "os" + "path/filepath" + "strings" +) + +func generateCPP(ctx context.Context, workspace, destination string, runner commandRunner) error { + source := filepath.Join(workspace, "source") + if err := cloneAtCommit(ctx, runner, cppRepository, cppCommit, source); err != nil { + return err + } + + build := filepath.Join(workspace, "build") + if err := os.Mkdir(build, 0o755); err != nil { + return err + } + if err := runner.run( + ctx, + "", + "cmake", + "-S", source, + "-B", build, + "-DGENERATE=true", + "-DCMAKE_BUILD_TYPE=Release", + ); err != nil { + return err + } + if err := runner.run(ctx, "", "cmake", "--build", build, "--config", "Release"); err != nil { + return err + } + if err := runner.run(ctx, "", "ctest", "--test-dir", build, "-C", "Release", "--output-on-failure"); err != nil { + return err + } + + return collectSnapshots(build, destination, func(name string) bool { + return strings.HasSuffix(name, "_cpp.sk") + }) +} diff --git a/internal/snapshots/diff.go b/internal/snapshots/diff.go new file mode 100644 index 0000000..869886a --- /dev/null +++ b/internal/snapshots/diff.go @@ -0,0 +1,174 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package snapshots + +import ( + "crypto/sha256" + "fmt" + "io" + "io/fs" + "os" + "path/filepath" + "sort" +) + +type ChangeStatus string + +const ( + ChangeAdded ChangeStatus = "A" + ChangeDeleted ChangeStatus = "D" + ChangeModified ChangeStatus = "M" +) + +type FileMetadata struct { + Size int64 + SHA256 [sha256.Size]byte +} + +type Change struct { + Status ChangeStatus + Stability Stability + Path string + Before *FileMetadata + After *FileMetadata +} + +type fileRecord struct { + filename string + metadata FileMetadata +} + +func compareDirectories( + current, generated string, + stability func(string) Stability, +) ([]Change, error) { + currentFiles, err := regularFiles(current) + if err != nil { + return nil, fmt.Errorf("inspect current snapshots: %w", err) + } + generatedFiles, err := regularFiles(generated) + if err != nil { + return nil, fmt.Errorf("inspect generated snapshots: %w", err) + } + + paths := make(map[string]struct{}, len(currentFiles)+len(generatedFiles)) + for path := range currentFiles { + paths[path] = struct{}{} + } + for path := range generatedFiles { + paths[path] = struct{}{} + } + + names := make([]string, 0, len(paths)) + for path := range paths { + names = append(names, path) + } + sort.Strings(names) + + changes := make([]Change, 0) + for _, name := range names { + currentFile, inCurrent := currentFiles[name] + generatedFile, inGenerated := generatedFiles[name] + snapshotStability := stability(name) + switch { + case !inCurrent: + after := generatedFile.metadata + changes = append(changes, Change{ + Status: ChangeAdded, Stability: snapshotStability, Path: name, After: &after, + }) + case !inGenerated: + before := currentFile.metadata + changes = append(changes, Change{ + Status: ChangeDeleted, Stability: snapshotStability, Path: name, Before: &before, + }) + case currentFile.metadata != generatedFile.metadata: + before := currentFile.metadata + after := generatedFile.metadata + changes = append(changes, Change{ + Status: ChangeModified, Stability: snapshotStability, Path: name, Before: &before, After: &after, + }) + } + } + return changes, nil +} + +func regularFiles(directory string) (map[string]fileRecord, error) { + info, err := os.Lstat(directory) + if err != nil { + if os.IsNotExist(err) { + return map[string]fileRecord{}, nil + } + return nil, err + } + if !info.IsDir() || info.Mode()&os.ModeSymlink != 0 { + return nil, fmt.Errorf("%s is not a directory", directory) + } + + files := make(map[string]fileRecord) + err = filepath.WalkDir(directory, func(filename string, entry fs.DirEntry, walkErr error) error { + if walkErr != nil { + return walkErr + } + if filename == directory || entry.IsDir() { + return nil + } + if entry.Type()&os.ModeSymlink != 0 { + return fmt.Errorf("%s is a symbolic link", filename) + } + + entryInfo, err := entry.Info() + if err != nil { + return err + } + if !entryInfo.Mode().IsRegular() { + return fmt.Errorf("%s is not a regular file", filename) + } + + relative, err := filepath.Rel(directory, filename) + if err != nil { + return err + } + metadata, err := fileMetadata(filename, entryInfo.Size()) + if err != nil { + return err + } + files[filepath.ToSlash(relative)] = fileRecord{filename: filename, metadata: metadata} + return nil + }) + if err != nil { + return nil, err + } + return files, nil +} + +func fileMetadata(filename string, size int64) (FileMetadata, error) { + file, err := os.Open(filename) + if err != nil { + return FileMetadata{}, err + } + defer func() { _ = file.Close() }() + + hash := sha256.New() + if _, err := io.Copy(hash, file); err != nil { + return FileMetadata{}, err + } + + var digest [sha256.Size]byte + copy(digest[:], hash.Sum(nil)) + return FileMetadata{Size: size, SHA256: digest}, nil +} diff --git a/internal/snapshots/diff_test.go b/internal/snapshots/diff_test.go new file mode 100644 index 0000000..eb0137f --- /dev/null +++ b/internal/snapshots/diff_test.go @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package snapshots + +import ( + "os" + "path/filepath" + "testing" +) + +func TestCompareDirectoriesReportsDetailedChanges(t *testing.T) { + t.Parallel() + + root := t.TempDir() + current := filepath.Join(root, "current") + generated := filepath.Join(root, "generated") + writeTestFile(t, filepath.Join(current, "deleted.sk"), "deleted") + writeTestFile(t, filepath.Join(current, "modified.sk"), "old") + writeTestFile(t, filepath.Join(current, "same.sk"), "same") + writeTestFile(t, filepath.Join(generated, "added.sk"), "added") + writeTestFile(t, filepath.Join(generated, "modified.sk"), "new") + writeTestFile(t, filepath.Join(generated, "same.sk"), "same") + + changes, err := compareDirectories(current, generated, func(path string) Stability { + if path == "modified.sk" { + return Unstable + } + return Stable + }) + if err != nil { + t.Fatal(err) + } + if len(changes) != 3 { + t.Fatalf("got %d changes, want 3: %#v", len(changes), changes) + } + + if got := changes[0]; got.Status != ChangeAdded || got.Path != "added.sk" || got.After == nil || got.After.Size != 5 { + t.Fatalf("unexpected added change: %#v", got) + } + if got := changes[1]; got.Status != ChangeDeleted || got.Path != "deleted.sk" || got.Before == nil || got.Before.Size != 7 { + t.Fatalf("unexpected deleted change: %#v", got) + } + if got := changes[2]; got.Status != ChangeModified || got.Path != "modified.sk" || got.Stability != Unstable { + t.Fatalf("unexpected modified change: %#v", got) + } + if changes[2].Before == nil || changes[2].After == nil || changes[2].Before.SHA256 == changes[2].After.SHA256 { + t.Fatalf("modified change lacks distinct hashes: %#v", changes[2]) + } +} + +func TestResultOnlyAllowsUnstableModifications(t *testing.T) { + t.Parallel() + + result := Result{Changes: []Change{{Status: ChangeModified, Stability: Unstable}}} + if result.HasBlockingChanges() { + t.Fatal("unstable modification should not block check mode") + } + + result.Changes = append(result.Changes, Change{Status: ChangeAdded, Stability: Unstable}) + result.Changes = append(result.Changes, Change{Status: ChangeModified, Stability: Stable}) + result.Changes = append(result.Changes, Change{Status: ChangeDeleted, Stability: Stable}) + if got := result.BlockingChangeCount(); got != 3 { + t.Fatalf("got %d blocking changes, want 3", got) + } +} + +func TestReplaceDirectoryReplacesTheExactFileSet(t *testing.T) { + t.Parallel() + + root := t.TempDir() + target := filepath.Join(root, "snapshots") + generated := filepath.Join(root, "generated") + writeTestFile(t, filepath.Join(target, "deleted.sk"), "deleted") + writeTestFile(t, filepath.Join(target, "modified.sk"), "old") + writeTestFile(t, filepath.Join(generated, "modified.sk"), "new") + writeTestFile(t, filepath.Join(generated, "nested", "added.sk"), "added") + + if err := replaceDirectory(target, generated); err != nil { + t.Fatal(err) + } + requireTestFile(t, filepath.Join(target, "modified.sk"), "new") + requireTestFile(t, filepath.Join(target, "nested", "added.sk"), "added") + if _, err := os.Stat(filepath.Join(target, "deleted.sk")); !os.IsNotExist(err) { + t.Fatalf("deleted file still exists or stat failed unexpectedly: %v", err) + } +} + +func writeTestFile(t *testing.T, filename, content string) { + t.Helper() + if err := os.MkdirAll(filepath.Dir(filename), 0o755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filename, []byte(content), 0o644); err != nil { + t.Fatal(err) + } +} + +func requireTestFile(t *testing.T, filename, expected string) { + t.Helper() + content, err := os.ReadFile(filename) + if err != nil { + t.Fatal(err) + } + if string(content) != expected { + t.Fatalf("%s contains %q, want %q", filename, content, expected) + } +} diff --git a/internal/snapshots/files.go b/internal/snapshots/files.go new file mode 100644 index 0000000..ecf9d08 --- /dev/null +++ b/internal/snapshots/files.go @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package snapshots + +import ( + "fmt" + "io" + "io/fs" + "os" + "path/filepath" +) + +func collectSnapshots(source, destination string, include func(string) bool) error { + info, err := os.Stat(source) + if err != nil { + return fmt.Errorf("inspect generated snapshots: %w", err) + } + if !info.IsDir() { + return fmt.Errorf("generated snapshot path %s is not a directory", source) + } + if err := os.MkdirAll(destination, 0o755); err != nil { + return fmt.Errorf("create snapshot staging directory: %w", err) + } + + seen := make(map[string]string) + err = filepath.WalkDir(source, func(filename string, entry fs.DirEntry, walkErr error) error { + if walkErr != nil { + return walkErr + } + if entry.IsDir() { + return nil + } + if entry.Type()&os.ModeSymlink != 0 { + return fmt.Errorf("generated file %s is a symbolic link", filename) + } + if !include(entry.Name()) { + return nil + } + + entryInfo, err := entry.Info() + if err != nil { + return err + } + if !entryInfo.Mode().IsRegular() { + return fmt.Errorf("generated file %s is not regular", filename) + } + if previous, found := seen[entry.Name()]; found { + return fmt.Errorf("duplicate generated snapshot %s in %s and %s", entry.Name(), previous, filename) + } + seen[entry.Name()] = filename + return copyFile(filename, filepath.Join(destination, entry.Name())) + }) + if err != nil { + return fmt.Errorf("collect generated snapshots: %w", err) + } + if len(seen) == 0 { + return fmt.Errorf("no snapshots found under %s", source) + } + return nil +} + +func copyFile(source, destination string) error { + input, err := os.Open(source) + if err != nil { + return err + } + defer func() { _ = input.Close() }() + + output, err := os.OpenFile(destination, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o644) + if err != nil { + return err + } + if _, err := io.Copy(output, input); err != nil { + _ = output.Close() + return err + } + return output.Close() +} diff --git a/internal/snapshots/generator.go b/internal/snapshots/generator.go new file mode 100644 index 0000000..07db185 --- /dev/null +++ b/internal/snapshots/generator.go @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package snapshots + +import ( + "context" + "io" +) + +type generator struct { + requirements []string + generate func(context.Context, string, string, commandRunner) error + stability func(string) Stability +} + +var generators = map[string]generator{ + "cpp": { + requirements: []string{"git", "cmake", "ctest"}, + generate: generateCPP, + stability: cppStability, + }, + "go": { + requirements: []string{"git", "go", "make"}, + generate: generateGo, + stability: goStability, + }, + "java": { + requirements: []string{"git", "java", "mvn"}, + generate: generateJava, + stability: javaStability, + }, +} + +func Languages() []string { + return []string{"cpp", "go", "java"} +} + +func HasLanguage(language string) bool { + _, found := generators[language] + return found +} + +type commandRunner struct { + stdout io.Writer + stderr io.Writer +} diff --git a/internal/snapshots/go.go b/internal/snapshots/go.go new file mode 100644 index 0000000..85ea200 --- /dev/null +++ b/internal/snapshots/go.go @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package snapshots + +import ( + "context" + "path/filepath" + "strings" +) + +func generateGo(ctx context.Context, workspace, destination string, runner commandRunner) error { + source := filepath.Join(workspace, "source") + if err := cloneAtCommit(ctx, runner, goRepository, goCommit, source); err != nil { + return err + } + if err := runner.run(ctx, source, "make", "generate-go-snapshots"); err != nil { + return err + } + + generated := filepath.Join(source, "serialization_test_data", "go_generated_files") + return collectSnapshots(generated, destination, func(name string) bool { + return strings.HasSuffix(name, "_go.sk") + }) +} diff --git a/internal/snapshots/java.go b/internal/snapshots/java.go new file mode 100644 index 0000000..d7ef452 --- /dev/null +++ b/internal/snapshots/java.go @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package snapshots + +import ( + "context" + "fmt" + "html" + "os" + "path/filepath" + "strings" +) + +func generateJava(ctx context.Context, workspace, destination string, runner commandRunner) error { + source := filepath.Join(workspace, "source") + if err := cloneAtCommit(ctx, runner, javaRepository, javaCommit, source); err != nil { + return err + } + + toolchains, err := writeMavenToolchains(workspace) + if err != nil { + return err + } + if err := runner.run( + ctx, + source, + "mvn", + "--toolchains", toolchains, + "test", + "-P", "generate-java-files", + ); err != nil { + return err + } + + generated := filepath.Join(source, "serialization_test_data", "java_generated_files") + return collectSnapshots(generated, destination, func(name string) bool { + return strings.HasSuffix(name, "_java.sk") + }) +} + +func writeMavenToolchains(workspace string) (string, error) { + javaHome := os.Getenv("JAVA_HOME") + if javaHome == "" { + return "", fmt.Errorf("JAVA_HOME must point to a JDK 25 installation; run the CLI through mise") + } + info, err := os.Stat(javaHome) + if err != nil { + return "", fmt.Errorf("inspect JAVA_HOME: %w", err) + } + if !info.IsDir() { + return "", fmt.Errorf("JAVA_HOME %s is not a directory", javaHome) + } + + filename := filepath.Join(workspace, "maven-toolchains.xml") + content := fmt.Sprintf(`<?xml version="1.0" encoding="UTF-8"?> +<toolchains> + <toolchain> + <type>jdk</type> + <provides> + <version>25</version> + </provides> + <configuration> + <jdkHome>%s</jdkHome> + </configuration> + </toolchain> +</toolchains> +`, html.EscapeString(javaHome)) + if err := os.WriteFile(filename, []byte(content), 0o600); err != nil { + return "", fmt.Errorf("write temporary Maven toolchains file: %w", err) + } + return filename, nil +} diff --git a/internal/snapshots/reconcile.go b/internal/snapshots/reconcile.go new file mode 100644 index 0000000..b9bc959 --- /dev/null +++ b/internal/snapshots/reconcile.go @@ -0,0 +1,184 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package snapshots + +import ( + "context" + "errors" + "fmt" + "io" + "os" + "os/exec" + "path/filepath" +) + +type Mode string + +const ( + ModeCheck Mode = "check" + ModeUpdate Mode = "update" +) + +type Result struct { + Target string + Changes []Change +} + +func (result Result) HasBlockingChanges() bool { + return result.BlockingChangeCount() > 0 +} + +func (result Result) BlockingChangeCount() int { + count := 0 + for _, change := range result.Changes { + if change.Status != ChangeModified || change.Stability == Stable { + count++ + } + } + return count +} + +func Reconcile( + ctx context.Context, + repositoryRoot, language string, + mode Mode, + stdout, stderr io.Writer, +) (Result, error) { + if mode != ModeCheck && mode != ModeUpdate { + return Result{}, fmt.Errorf("unsupported reconciliation mode %q", mode) + } + generator, found := generators[language] + if !found { + return Result{}, fmt.Errorf("unsupported snapshot language %q", language) + } + for _, requirement := range generator.requirements { + if _, err := exec.LookPath(requirement); err != nil { + return Result{}, fmt.Errorf("required command %q is not installed or not on PATH", requirement) + } + } + + workspace, err := os.MkdirTemp("", "datasketches-tck-"+language+"-") + if err != nil { + return Result{}, fmt.Errorf("create generator workspace: %w", err) + } + defer func() { _ = os.RemoveAll(workspace) }() + + generated := filepath.Join(workspace, "generated") + runner := commandRunner{stdout: stdout, stderr: stderr} + if err := generator.generate(ctx, workspace, generated, runner); err != nil { + return Result{}, fmt.Errorf("generate %s snapshots: %w", language, err) + } + + target := filepath.Join(repositoryRoot, "serialization", language, "snapshots") + changes, err := compareDirectories(target, generated, generator.stability) + if err != nil { + return Result{}, err + } + + result := Result{Target: target, Changes: changes} + if mode == ModeUpdate && len(changes) > 0 { + if err := replaceDirectory(target, generated); err != nil { + return Result{}, err + } + } + return result, nil +} + +func replaceDirectory(target, generated string) error { + parent := filepath.Dir(target) + if err := os.MkdirAll(parent, 0o755); err != nil { + return fmt.Errorf("create snapshot parent directory: %w", err) + } + + transaction, err := os.MkdirTemp(parent, "."+filepath.Base(target)+"-tck-") + if err != nil { + return fmt.Errorf("create snapshot update transaction: %w", err) + } + removeTransaction := true + defer func() { + if removeTransaction { + _ = os.RemoveAll(transaction) + } + }() + + next := filepath.Join(transaction, "next") + if err := copyDirectory(generated, next); err != nil { + return fmt.Errorf("stage generated snapshots: %w", err) + } + + previous := filepath.Join(transaction, "previous") + hadTarget := false + info, err := os.Lstat(target) + switch { + case err == nil: + if !info.IsDir() || info.Mode()&os.ModeSymlink != 0 { + return fmt.Errorf("replace snapshots: %s is not a directory", target) + } + hadTarget = true + if err := os.Rename(target, previous); err != nil { + return fmt.Errorf("preserve current snapshots: %w", err) + } + case os.IsNotExist(err): + case err != nil: + return fmt.Errorf("inspect snapshots before update: %w", err) + } + + if err := os.Rename(next, target); err != nil { + if !hadTarget { + return fmt.Errorf("install generated snapshots: %w", err) + } + if restoreErr := os.Rename(previous, target); restoreErr == nil { + return fmt.Errorf("install generated snapshots: %w", err) + } else { + removeTransaction = false + return fmt.Errorf( + "install generated snapshots: %w; restoring previous snapshots also failed: %v; previous files remain at %s", + err, + restoreErr, + previous, + ) + } + } + + if hadTarget { + if err := os.RemoveAll(previous); err != nil && !errors.Is(err, os.ErrNotExist) { + return fmt.Errorf("remove previous snapshots after update: %w", err) + } + } + return nil +} + +func copyDirectory(source, destination string) error { + files, err := regularFiles(source) + if err != nil { + return err + } + if err := os.MkdirAll(destination, 0o755); err != nil { + return err + } + for relative, file := range files { + output := filepath.Join(destination, filepath.FromSlash(relative)) + if err := os.MkdirAll(filepath.Dir(output), 0o755); err != nil { + return err + } + if err := copyFile(file.filename, output); err != nil { + return err + } + } + return nil +} diff --git a/internal/snapshots/revisions.go b/internal/snapshots/revisions.go new file mode 100644 index 0000000..02ce337 --- /dev/null +++ b/internal/snapshots/revisions.go @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package snapshots + +const ( + cppRepository = "https://github.com/apache/datasketches-cpp.git" + cppCommit = "401423367055acdf7502e8ed3126730a08039d91" + + goRepository = "https://github.com/apache/datasketches-go.git" + goCommit = "730c0ca31e00b8becf8b70591ae8ca73954912d0" + + javaRepository = "https://github.com/apache/datasketches-java.git" + javaCommit = "f3b334b380feee9f928500de9adb6bbf763fc104" +) diff --git a/internal/snapshots/stability.go b/internal/snapshots/stability.go new file mode 100644 index 0000000..7399c39 --- /dev/null +++ b/internal/snapshots/stability.go @@ -0,0 +1,102 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package snapshots + +import ( + "path/filepath" + "regexp" + "strconv" + "strings" +) + +type Stability string + +const ( + Stable Stability = "stable" + Unstable Stability = "unstable" +) + +var countPattern = regexp.MustCompile(`_n([0-9]+)(?:_|$)`) + +// The classifications below follow the project discussion at +// https://github.com/apache/datasketches-rust/issues/10#issuecomment-3663796398 +// and the repeated-generation inventory recorded at +// https://www.mail-archive.com/dev%40datasketches.apache.org/msg04302.html. +// They are intentionally source-specific: for example, the pinned Go KLL +// generator enables its deterministic test offset, while C++ and Java do not. + +func cppStability(path string) Stability { + if cppOrJavaUnstable(filepath.Base(path)) { + return Unstable + } + return Stable +} + +func javaStability(path string) Stability { + if cppOrJavaUnstable(filepath.Base(path)) { + return Unstable + } + return Stable +} + +func goStability(path string) Stability { + name := filepath.Base(path) + switch { + case strings.HasPrefix(name, "bf_"): + return Unstable + case strings.HasPrefix(name, "req_float_") && countAtLeast(name, 100): + return Unstable + case strings.HasPrefix(name, "reservoir_") && strings.Contains(name, "_sampling_"): + return Unstable + case varOptUnstable(name): + return Unstable + default: + return Stable + } +} + +func cppOrJavaUnstable(name string) bool { + switch { + case strings.HasPrefix(name, "bf_"): + return true + case (strings.HasPrefix(name, "kll_") || strings.HasPrefix(name, "quantiles_")) && countAtLeast(name, 1000): + return true + case strings.HasPrefix(name, "req_float_") && countAtLeast(name, 100): + return true + case varOptUnstable(name): + return true + default: + return false + } +} + +func varOptUnstable(name string) bool { + if !strings.HasPrefix(name, "varopt_") { + return false + } + return strings.Contains(name, "_sampling_") || countAtLeast(name, 100) +} + +func countAtLeast(name string, minimum int) bool { + match := countPattern.FindStringSubmatch(name) + if len(match) != 2 { + return false + } + count, err := strconv.Atoi(match[1]) + return err == nil && count >= minimum +} diff --git a/internal/snapshots/stability_test.go b/internal/snapshots/stability_test.go new file mode 100644 index 0000000..734eedd --- /dev/null +++ b/internal/snapshots/stability_test.go @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package snapshots + +import "testing" + +func TestSnapshotStability(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + stability func(string) Stability + path string + expected Stability + }{ + {name: "cpp deterministic theta", stability: cppStability, path: "theta_n1000000_cpp.sk", expected: Stable}, + {name: "cpp bloom filter seed", stability: cppStability, path: "bf_n0_h3_cpp.sk", expected: Unstable}, + {name: "cpp exact KLL", stability: cppStability, path: "kll_long_n100_cpp.sk", expected: Stable}, + {name: "cpp compacted KLL", stability: cppStability, path: "kll_long_n1000_cpp.sk", expected: Unstable}, + {name: "cpp exact REQ", stability: cppStability, path: "req_float_n10_cpp.sk", expected: Stable}, + {name: "cpp compacted REQ", stability: cppStability, path: "req_float_n100_cpp.sk", expected: Unstable}, + {name: "java compacted quantiles", stability: javaStability, path: "quantiles_string_n1000_java.sk", expected: Unstable}, + {name: "java varopt exact mode", stability: javaStability, path: "varopt_sketch_long_n10_java.sk", expected: Stable}, + {name: "java varopt sampling mode", stability: javaStability, path: "varopt_sketch_long_n100_java.sk", expected: Unstable}, + {name: "go deterministic test KLL", stability: goStability, path: "kll_float_n1000000_go.sk", expected: Stable}, + {name: "go bloom filter seed", stability: goStability, path: "bf_byte_array_n10000_h3_go.sk", expected: Unstable}, + {name: "go reservoir exact mode", stability: goStability, path: "reservoir_items_long_exact_n128_k128_go.sk", expected: Stable}, + {name: "go reservoir sampling mode", stability: goStability, path: "reservoir_items_long_sampling_n1000_k128_go.sk", expected: Unstable}, + {name: "go compacted REQ", stability: goStability, path: "req_float_n100_go.sk", expected: Unstable}, + {name: "go varopt union sampling", stability: goStability, path: "varopt_union_double_sampling_go.sk", expected: Unstable}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + t.Parallel() + if got := test.stability(test.path); got != test.expected { + t.Fatalf("%s classified as %s, want %s", test.path, got, test.expected) + } + }) + } +} diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..811bf05 --- /dev/null +++ b/mise.toml @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[tools] +cmake = "4.4.2" +go = "1.26.5" +java = "temurin-25.0.2+10.0.LTS" +maven = "3.9.16" + +[tasks.tck] +description = "Run the repository-local DataSketches TCK CLI" +dir = "{{ cwd }}" +env = { TCK_REPOSITORY_ROOT = "{{ config_root }}" } +run = 'go run "$MISE_PROJECT_ROOT/cmd/tck"' + +[tasks.check] +description = "Run Go checks" +dir = "{{ config_root }}" +run = [ + "go vet ./...", + "go test ./...", +] diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 0bf73f0..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,27 +0,0 @@ -[project] -name = "datasketches-tck" -version = "0.0.0" -requires-python = ">=3.14,<3.15" -classifiers = ["Private :: Do Not Upload"] -dependencies = ["typer"] - -[dependency-groups] -dev = [ - "pyright", - "ruff", -] - -[build-system] -requires = ["uv_build>=0.11.31,<0.12"] -build-backend = "uv_build" - -[tool.uv] -required-version = ">=0.11.31" - -[tool.uv.build-backend] -module-root = "tools" -module-name = "tck" - -[tool.ruff] -indent-width = 2 -target-version = "py314" diff --git a/serialization/cpp/generator.py b/serialization/cpp/generator.py deleted file mode 100755 index 8f2ecd8..0000000 --- a/serialization/cpp/generator.py +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env python3 - -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -import shutil - -import tck -import typer - - -def main(): - print("--- Generating C++ Test Data ---") - - # 1. Check prerequisites - tck.check_command_installed("git") - tck.check_command_installed("cmake") - tck.check_command_installed("ctest") - - # 2. Define paths - repository_dir = tck.repository_root() - temp_dir = repository_dir / "tmp_datasketches_cpp" - output_dir = repository_dir / "serialization" / "cpp" / "snapshots" - - # 3. Setup temporary directory - if temp_dir.exists(): - print(f"Removing existing temporary directory: {temp_dir}") - shutil.rmtree(temp_dir) - - temp_dir.mkdir() - - # 4. Clone repository - repo_url = "https://github.com/apache/datasketches-cpp.git" - commit = "401423367055acdf7502e8ed3126730a08039d91" - tck.run_command( - [ - "git", - "clone", - "--depth", - "1", - "--revision", - commit, - "--single-branch", - repo_url, - str(temp_dir), - ] - ) - - # 5. Build and Run CMake - build_dir = temp_dir / "build" - build_dir.mkdir(exist_ok=True) - - # Configure: Add CMAKE_BUILD_TYPE for single-config generators (Ninja/Make) - tck.run_command( - ["cmake", "..", "-DGENERATE=true", "-DCMAKE_BUILD_TYPE=Release"], cwd=build_dir - ) - - # Build: Release config - tck.run_command(["cmake", "--build", ".", "--config", "Release"], cwd=build_dir) - - # Test: Use ctest which is more portable than 'cmake --target test' (VS uses RUN_TESTS) - # --output-on-failure helps debug if a specific test fails - tck.run_command(["ctest", "-C", "Release", "--output-on-failure"], cwd=build_dir) - - # 6. Copy generated files - # The instructions say: cp datasketches-cpp/build/*/test/*_cpp.sk serialization_test_data/cpp_generated_files - # We need to find where they are exactly. - # It seems they might be in build/test/ or subdirectories depending on generator. - - print(f"Copying files to {output_dir}") - output_dir.mkdir(parents=True, exist_ok=True) - - files_copied = 0 - - for file_path in build_dir.rglob("*_cpp.sk"): - shutil.copy2(file_path, output_dir) - print(f"Copied: {file_path.name}") - files_copied += 1 - - if files_copied == 0: - print("Warning: No *_cpp.sk files were found to copy.") - else: - print(f"Successfully copied {files_copied} files.") - - -if __name__ == "__main__": - typer.run(main) diff --git a/serialization/go/generator.py b/serialization/go/generator.py deleted file mode 100755 index 6586f2c..0000000 --- a/serialization/go/generator.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python3 - -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -import shutil -import sys - -import tck -import typer - - -def main(): - print("--- Generating Go Test Data ---") - - # 1. Check prerequisites - tck.check_command_installed("git") - tck.check_command_installed("go") - tck.check_command_installed("make") - - # 2. Define paths - repository_dir = tck.repository_root() - temp_dir = repository_dir / "tmp_datasketches_go" - output_dir = repository_dir / "serialization" / "go" / "snapshots" - - # 3. Setup temporary directory - if temp_dir.exists(): - print(f"Removing existing temporary directory: {temp_dir}") - shutil.rmtree(temp_dir) - - temp_dir.mkdir() - - # 4. Clone repository - repo_url = "https://github.com/apache/datasketches-go.git" - commit = "730c0ca31e00b8becf8b70591ae8ca73954912d0" - tck.run_command( - [ - "git", - "clone", - "--depth", - "1", - "--revision", - commit, - "--single-branch", - repo_url, - str(temp_dir), - ] - ) - - # 5. Generate files - tck.run_command(["make", "generate-go-snapshots"], cwd=temp_dir) - - # 6. Copy generated files - generated_files_dir = temp_dir / "serialization_test_data" / "go_generated_files" - - if not generated_files_dir.exists(): - print( - f"Error: Expected generated files directory not found at {generated_files_dir}" - ) - sys.exit(1) - - print(f"Copying files from {generated_files_dir} to {output_dir}") - output_dir.mkdir(parents=True, exist_ok=True) - - files_copied = 0 - for file_path in generated_files_dir.glob("*.sk"): - shutil.copy2(file_path, output_dir) - print(f"Copied: {file_path.name}") - files_copied += 1 - - if files_copied == 0: - print("Warning: No .sk files were found to copy.") - else: - print(f"Successfully copied {files_copied} files.") - - -if __name__ == "__main__": - typer.run(main) diff --git a/serialization/java/generator.py b/serialization/java/generator.py deleted file mode 100755 index 7fc6383..0000000 --- a/serialization/java/generator.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python3 - -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -import os -import shutil -import sys - -import tck -import typer - - -def main(): - print("--- Generating Java Test Data ---") - - # 1. Check prerequisites - tck.check_command_installed("git") - tck.check_command_installed("java") - mvn_cmd_name = "mvn" - if os.name == "nt": - mvn_cmd_name = "mvn.cmd" - tck.check_command_installed(mvn_cmd_name) - - # 2. Define paths - repository_dir = tck.repository_root() - temp_dir = repository_dir / "tmp_datasketches_java" - output_dir = repository_dir / "serialization" / "java" / "snapshots" - - # 3. Setup temporary directory - if temp_dir.exists(): - print(f"Removing existing temporary directory: {temp_dir}") - shutil.rmtree(temp_dir) - - temp_dir.mkdir() - - # 4. Clone repository - repo_url = "https://github.com/apache/datasketches-java.git" - branch = "9.0.0" - tck.run_command( - [ - "git", - "clone", - "--depth", - "1", - "--branch", - branch, - "--single-branch", - repo_url, - str(temp_dir), - ] - ) - - # 5. Run Maven to generate files - mvn_cmd = [mvn_cmd_name, "test", "-P", "generate-java-files"] - use_shell = os.name == "nt" # Windows - tck.run_command(mvn_cmd, cwd=temp_dir, shell=use_shell) - - # 6. Copy generated files - generated_files_dir = temp_dir / "serialization_test_data" / "java_generated_files" - - if not generated_files_dir.exists(): - print( - f"Error: Expected generated files directory not found at {generated_files_dir}" - ) - sys.exit(1) - - print(f"Copying files from {generated_files_dir} to {output_dir}") - output_dir.mkdir(parents=True, exist_ok=True) - - files_copied = 0 - for file_path in generated_files_dir.glob("*.sk"): - shutil.copy2(file_path, output_dir) - print(f"Copied: {file_path.name}") - files_copied += 1 - - if files_copied == 0: - print("Warning: No .sk files were found to copy.") - else: - print(f"Successfully copied {files_copied} files.") - - -if __name__ == "__main__": - typer.run(main) diff --git a/tools/tck/__init__.py b/tools/tck/__init__.py deleted file mode 100644 index 9055ced..0000000 --- a/tools/tck/__init__.py +++ /dev/null @@ -1,49 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -import shutil -import subprocess -import sys -from pathlib import Path - - -def repository_root(): - """Returns the root directory of the repository.""" - return Path(__file__).resolve().parents[2] - - -def check_command_installed(command): - """Checks if a command is available in the system path.""" - if shutil.which(command) is None: - print(f"Error: '{command}' is not installed or not in PATH.") - sys.exit(1) - - -def run_command(command, cwd=None, shell=False): - """Runs a shell command, streaming output to stdout/stderr.""" - cmd_str = " ".join(command) if isinstance(command, list) else command - print(f"Running: {cmd_str}") - sys.stdout.flush() # Ensure 'Running' message appears before command output - try: - # Don't capture output; let it stream to sys.stdout/sys.stderr - subprocess.check_call(command, cwd=cwd, stderr=subprocess.STDOUT, shell=shell) - except subprocess.CalledProcessError as e: - print(f"Error running command: {e}") - print("--- OUTPUT ---") - print(e.stdout) - print("--- END OUTPUT ---") - sys.exit(1) diff --git a/uv.lock b/uv.lock deleted file mode 100644 index bf6eae9..0000000 --- a/uv.lock +++ /dev/null @@ -1,167 +0,0 @@ -version = 1 -revision = 3 -requires-python = "==3.14.*" - -[[package]] -name = "annotated-doc" -version = "0.0.4" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/57/ba/046ceea27344560984e26a590f90bc7f4a75b06701f653222458922b558c/annotated_doc-0.0.4.tar.gz", hash = "sha256:fbcda96e87e9c92ad167c2e53839e57503ecfda18804ea28102353485033faa4", size = 7288, upload-time = "2025-11-10T22:07:42.062Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/1e/d3/26bf1008eb3d2daa8ef4cacc7f3bfdc11818d111f7e2d0201bc6e3b49d45/annotated_doc-0.0.4-py3-none-any.whl", hash = "sha256:571ac1dc6991c450b25a9c2d84a3705e2ae7a53467b5d111c24fa8baabbed320", size = 5303, upload-time = "2025-11-10T22:07:40.673Z" }, -] - -[[package]] -name = "colorama" -version = "0.4.6" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, -] - -[[package]] -name = "datasketches-tck" -version = "0.0.0" -source = { editable = "." } -dependencies = [ - { name = "typer" }, -] - -[package.dev-dependencies] -dev = [ - { name = "pyright" }, - { name = "ruff" }, -] - -[package.metadata] -requires-dist = [{ name = "typer" }] - -[package.metadata.requires-dev] -dev = [ - { name = "pyright" }, - { name = "ruff" }, -] - -[[package]] -name = "markdown-it-py" -version = "4.2.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "mdurl" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/06/ff/7841249c247aa650a76b9ee4bbaeae59370dc8bfd2f6c01f3630c35eb134/markdown_it_py-4.2.0.tar.gz", hash = "sha256:04a21681d6fbb623de53f6f364d352309d4094dd4194040a10fd51833e418d49", size = 82454, upload-time = "2026-05-07T12:08:28.36Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/b3/81/4da04ced5a082363ecfa159c010d200ecbd959ae410c10c0264a38cac0f5/markdown_it_py-4.2.0-py3-none-any.whl", hash = "sha256:9f7ebbcd14fe59494226453aed97c1070d83f8d24b6fc3a3bcf9a38092641c4a", size = 91687, upload-time = "2026-05-07T12:08:27.182Z" }, -] - -[[package]] -name = "mdurl" -version = "0.1.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729, upload-time = "2022-08-14T12:40:10.846Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979, upload-time = "2022-08-14T12:40:09.779Z" }, -] - -[[package]] -name = "nodeenv" -version = "1.10.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/24/bf/d1bda4f6168e0b2e9e5958945e01910052158313224ada5ce1fb2e1113b8/nodeenv-1.10.0.tar.gz", hash = "sha256:996c191ad80897d076bdfba80a41994c2b47c68e224c542b48feba42ba00f8bb", size = 55611, upload-time = "2025-12-20T14:08:54.006Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/88/b2/d0896bdcdc8d28a7fc5717c305f1a861c26e18c05047949fb371034d98bd/nodeenv-1.10.0-py2.py3-none-any.whl", hash = "sha256:5bb13e3eed2923615535339b3c620e76779af4cb4c6a90deccc9e36b274d3827", size = 23438, upload-time = "2025-12-20T14:08:52.782Z" }, -] - -[[package]] -name = "pygments" -version = "2.20.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/c3/b2/bc9c9196916376152d655522fdcebac55e66de6603a76a02bca1b6414f6c/pygments-2.20.0.tar.gz", hash = "sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f", size = 4955991, upload-time = "2026-03-29T13:29:33.898Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/f4/7e/a72dd26f3b0f4f2bf1dd8923c85f7ceb43172af56d63c7383eb62b332364/pygments-2.20.0-py3-none-any.whl", hash = "sha256:81a9e26dd42fd28a23a2d169d86d7ac03b46e2f8b59ed4698fb4785f946d0176", size = 1231151, upload-time = "2026-03-29T13:29:30.038Z" }, -] - -[[package]] -name = "pyright" -version = "1.1.411" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "nodeenv" }, - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/7e/ab/265f7dc69d28113ebba19092e57b075f41543b2ed048429c5f56e2b88eac/pyright-1.1.411.tar.gz", hash = "sha256:d885a0551f2e763b089a02702174e7f4ba77548cddabc972ab86d1f7f1b0f998", size = 4112861, upload-time = "2026-06-25T02:14:06.37Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/0a/49/385be530a6a5b78d1cbcd5c2e38debc8959a2fc6bdb716f4e581002979fc/pyright-1.1.411-py3-none-any.whl", hash = "sha256:dc7c72a8e2700c55baa127554040e067041ea53ccfd50bf96308cc4291c7d5d9", size = 6181526, upload-time = "2026-06-25T02:14:04.691Z" }, -] - -[[package]] -name = "rich" -version = "15.0.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "markdown-it-py" }, - { name = "pygments" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/c0/8f/0722ca900cc807c13a6a0c696dacf35430f72e0ec571c4275d2371fca3e9/rich-15.0.0.tar.gz", hash = "sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36", size = 230680, upload-time = "2026-04-12T08:24:00.75Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/82/3b/64d4899d73f91ba49a8c18a8ff3f0ea8f1c1d75481760df8c68ef5235bf5/rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb", size = 310654, upload-time = "2026-04-12T08:24:02.83Z" }, -] - -[[package]] -name = "ruff" -version = "0.16.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/4d/94/1e5e4967626faf12fa56999cd6222dff6992ceb086ad7945756baf70c7a7/ruff-0.16.0.tar.gz", hash = "sha256:e460aafd5495ec89efaa6ced2e4a9a581116451e1c88b9d37ef497e0f8e93982", size = 4790557, upload-time = "2026-07-23T19:11:30.981Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/4b/81/1c8818fee7ce1a04cd7d1b3172e0a8f8e4f1dc4feb7fc390e16daa8af323/ruff-0.16.0-py3-none-linux_armv6l.whl", hash = "sha256:e5115729eb08c585e5121978ba5d5b60caeae394ce21b9fb5e6cd33a1c6c9b1e", size = 10754633, upload-time = "2026-07-23T19:10:46.415Z" }, - { url = "https://files.pythonhosted.org/packages/23/df/beaf59c09d68db84304d555f188b276a77132a5d5b0b67a5c762aa143628/ruff-0.16.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:3c954b1d580bfa035b41654f7858cc7e71d5fc3ac5b723dd62bd9133830ed522", size = 10969164, upload-time = "2026-07-23T19:10:50.271Z" }, - { url = "https://files.pythonhosted.org/packages/42/ce/741cd197496a1abbf51352710fd15ed995d2a2be87189c1da26a450d6e83/ruff-0.16.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e01c21d10eb1b29f47b7454e1f4056db9a3f0260c646aa88457c610291db9f81", size = 10488846, upload-time = "2026-07-23T19:10:52.639Z" }, - { url = "https://files.pythonhosted.org/packages/52/2a/a2db8e88cade358f5cdcb05674a917751074109315d014eb6352d9a893f7/ruff-0.16.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6e364e5ed22ed8dc05082fd78e35308618260907ac2d3c1d637b2e682415b6c9", size = 10889729, upload-time = "2026-07-23T19:10:54.89Z" }, - { url = "https://files.pythonhosted.org/packages/42/65/62a771694ebd63029dc953e27dbad40e1588bd4860ff9fe881018fddaa49/ruff-0.16.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d327b8fc113a1d4421a04f3839d3752057c8dd1ee320223a6f3f52d04ada462a", size = 10568275, upload-time = "2026-07-23T19:10:56.993Z" }, - { url = "https://files.pythonhosted.org/packages/3f/e2/ced249fe8af5f086c5c58cc21cc3356d50f32f7401c5df87050c999620a7/ruff-0.16.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a9b50c55e263103586b3dcf5f73d479eb8cb5fdb6098fec59a62891dab653717", size = 11385112, upload-time = "2026-07-23T19:10:59.615Z" }, - { url = "https://files.pythonhosted.org/packages/87/0b/05154977a8fd69eeb6c103271f55403bfd8711f5c0f8ed07489d95a504e7/ruff-0.16.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0ff4a79ce3ec0172f3241943835de1c4cb4e2dcd07f0f8c2d02603dbbbee4b17", size = 12207008, upload-time = "2026-07-23T19:11:02.154Z" }, - { url = "https://files.pythonhosted.org/packages/fb/29/98225831a3a1eab0e02f4acc6ca6559a98611dcc68b6965ff4b7234627c1/ruff-0.16.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e95c448fca1fb2a18372a9440926c5a6ee789639bb975c72e7ae6d0b04218ab4", size = 11650842, upload-time = "2026-07-23T19:11:04.557Z" }, - { url = "https://files.pythonhosted.org/packages/91/66/6bd3cf90500653d55dc0ffc8507aa8300bd49d0214b2e8cb4d3fef2943ba/ruff-0.16.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f11a8d11010301d0a398a2fdef67691feca7294da6aef55e2150e8fa2cd520b", size = 11400718, upload-time = "2026-07-23T19:11:09.233Z" }, - { url = "https://files.pythonhosted.org/packages/8e/a2/a54eb4eae05d66364050a5d3b8a9c5ef88196531b3cbe7109d873f87f819/ruff-0.16.0-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:48044c678e9cb8698246c99b14aaccfa6601dea7379eb48a6f8f73f7a6d86cd0", size = 11426177, upload-time = "2026-07-23T19:11:11.994Z" }, - { url = "https://files.pythonhosted.org/packages/1a/be/16e3eea4b2a478a496919f5e36f17c4559e54620bd3bbac5d6affa068006/ruff-0.16.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:7aa0959bad8eb8bef50340154fc9b58678dae31fa4293afa38b44b6e552c0213", size = 10856126, upload-time = "2026-07-23T19:11:14.221Z" }, - { url = "https://files.pythonhosted.org/packages/a2/84/252eb8b868a16eec7257c14f504f77537e734b2d69c762e639e588e304a3/ruff-0.16.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:28ea2b7df8ebf7f9da6b7d47b230ab48f387c0a29be3b474c4d0740e197bb9af", size = 10571208, upload-time = "2026-07-23T19:11:16.378Z" }, - { url = "https://files.pythonhosted.org/packages/21/09/817a482f542f7570cbb4554b26e896610c7114f539b1d9e2d2145bf6bef6/ruff-0.16.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:33a3dfac8c35f81498dea9181bccc2f4c4bc8f1521a1dd9406e77643e0f0fb09", size = 11063329, upload-time = "2026-07-23T19:11:19.173Z" }, - { url = "https://files.pythonhosted.org/packages/2e/23/9403c180ca1cb9b1f7335f5c3e5305c09d49ea5b345196682a36028bde4a/ruff-0.16.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:a5237a0bda500d30d81b8e07a6973a5cbc772864cbf746ae2f4e8a2e01c9f4ed", size = 11489751, upload-time = "2026-07-23T19:11:21.74Z" }, - { url = "https://files.pythonhosted.org/packages/b2/1d/1b2ef7bcde851c78d7f17f1cca13fd6dc695fc4b3d6197941e72cae5b132/ruff-0.16.0-py3-none-win32.whl", hash = "sha256:7fab76fa065c873f41ff744347c6e77bcc3dfec4bcc754dc26b63d23c0f7f5fb", size = 10785885, upload-time = "2026-07-23T19:11:23.947Z" }, - { url = "https://files.pythonhosted.org/packages/b2/a3/d5e4ef7a56be3f928ffb90b94c25ba7d3cb9c7fe0736aeaaedf361770712/ruff-0.16.0-py3-none-win_amd64.whl", hash = "sha256:429c117f022bf481fabd9d551e7a3952b24c65e6ef44337ea09d90bebef14472", size = 11923141, upload-time = "2026-07-23T19:11:26.409Z" }, - { url = "https://files.pythonhosted.org/packages/cb/9a/8415f2657cbe200f41a4531ccededf135505a92d4a012229121f885b26f9/ruff-0.16.0-py3-none-win_arm64.whl", hash = "sha256:14296fedcd2705c77ab8235439278bbb38f285cf7da5528b00b3e330c3d4872d", size = 11273407, upload-time = "2026-07-23T19:11:28.705Z" }, -] - -[[package]] -name = "shellingham" -version = "1.5.4" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/58/15/8b3609fd3830ef7b27b655beb4b4e9c62313a4e8da8c676e142cc210d58e/shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de", size = 10310, upload-time = "2023-10-24T04:13:40.426Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686", size = 9755, upload-time = "2023-10-24T04:13:38.866Z" }, -] - -[[package]] -name = "typer" -version = "0.27.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "annotated-doc" }, - { name = "colorama", marker = "sys_platform == 'win32'" }, - { name = "rich" }, - { name = "shellingham" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/37/78/fda3361b56efc27944f24225f6ecd13d96d6fcfe37bd0eb34e2f4c63f9fc/typer-0.27.0.tar.gz", hash = "sha256:629bd12ea5d13a17148125d9a264f949eb171fb3f120f9b04d85873cab054fa5", size = 203430, upload-time = "2026-07-15T19:21:07.007Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/40/03/26a383c9e58c213199d1aad1c3d353cfc22d4444ec6d2c0bf8ad02523843/typer-0.27.0-py3-none-any.whl", hash = "sha256:6f4b27631e47f077871b7dc30e933ec0131c1390fbe0e387ea5574b5bac9ccf1", size = 122716, upload-time = "2026-07-15T19:21:05.553Z" }, -] - -[[package]] -name = "typing-extensions" -version = "4.16.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555, upload-time = "2026-07-02T08:40:05.92Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" }, -] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
