evaltrack 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. {evaltrack-0.1.0 → evaltrack-0.2.0}/CHANGELOG.md +9 -0
  2. {evaltrack-0.1.0 → evaltrack-0.2.0}/CONTRIBUTING.md +11 -7
  3. {evaltrack-0.1.0 → evaltrack-0.2.0}/PKG-INFO +12 -7
  4. {evaltrack-0.1.0 → evaltrack-0.2.0}/README.md +9 -6
  5. evaltrack-0.2.0/ROADMAP.md +30 -0
  6. {evaltrack-0.1.0 → evaltrack-0.2.0}/docs/ci-cd.md +7 -3
  7. {evaltrack-0.1.0 → evaltrack-0.2.0}/docs/configuration.md +6 -4
  8. {evaltrack-0.1.0 → evaltrack-0.2.0}/docs/repositories.md +28 -0
  9. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/repositories/__init__.py +15 -3
  10. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/repositories/azure.py +8 -8
  11. evaltrack-0.2.0/evaltrack/repositories/s3.py +266 -0
  12. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/repositories/store.py +6 -0
  13. {evaltrack-0.1.0 → evaltrack-0.2.0}/pyproject.toml +8 -2
  14. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/cli/test_ui_command.py +4 -18
  15. evaltrack-0.2.0/tests/conftest.py +21 -0
  16. evaltrack-0.2.0/tests/repositories/conftest.py +128 -0
  17. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/repositories/test_azure_store.py +2 -8
  18. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/repositories/test_open_repository.py +14 -6
  19. evaltrack-0.2.0/tests/repositories/test_s3_store.py +525 -0
  20. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/repositories/test_store_contract.py +2 -0
  21. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/translators/test_deepeval.py +1 -7
  22. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/ui/conftest.py +5 -18
  23. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/ui/test_hardening.py +1 -7
  24. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/ui/test_history.py +1 -7
  25. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/ui/test_reads.py +1 -7
  26. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/ui/test_static.py +2 -15
  27. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/ui/test_writes.py +1 -8
  28. evaltrack-0.1.0/tests/conftest.py +0 -81
  29. evaltrack-0.1.0/tests/repositories/conftest.py +0 -37
  30. {evaltrack-0.1.0 → evaltrack-0.2.0}/.gitignore +0 -0
  31. {evaltrack-0.1.0 → evaltrack-0.2.0}/LICENSE +0 -0
  32. {evaltrack-0.1.0 → evaltrack-0.2.0}/SECURITY.md +0 -0
  33. {evaltrack-0.1.0 → evaltrack-0.2.0}/docs/cli.md +0 -0
  34. {evaltrack-0.1.0 → evaltrack-0.2.0}/docs/eval-runners.md +0 -0
  35. {evaltrack-0.1.0 → evaltrack-0.2.0}/docs/eval-shape.md +0 -0
  36. {evaltrack-0.1.0 → evaltrack-0.2.0}/docs/flakiness.md +0 -0
  37. {evaltrack-0.1.0 → evaltrack-0.2.0}/docs/marker.md +0 -0
  38. {evaltrack-0.1.0 → evaltrack-0.2.0}/docs/translators.md +0 -0
  39. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/__init__.py +0 -0
  40. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/cli.py +0 -0
  41. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/config.py +0 -0
  42. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/context.py +0 -0
  43. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/core/__init__.py +0 -0
  44. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/core/errors.py +0 -0
  45. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/core/eval_round.py +0 -0
  46. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/core/gate.py +0 -0
  47. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/core/projection.py +0 -0
  48. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/core/recorder.py +0 -0
  49. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/core/refs.py +0 -0
  50. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/core/repetition.py +0 -0
  51. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/core/results.py +0 -0
  52. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/core/run_context.py +0 -0
  53. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/core/run_record.py +0 -0
  54. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/core/score_bars.py +0 -0
  55. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/core/user_values.py +0 -0
  56. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/failure.py +0 -0
  57. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/history/__init__.py +0 -0
  58. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/history/reliability.py +0 -0
  59. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/history/score_history.py +0 -0
  60. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/history/segments.py +0 -0
  61. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/marked_test.py +0 -0
  62. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/py.typed +0 -0
  63. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/pytest_plugin.py +0 -0
  64. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/repositories/file.py +0 -0
  65. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/repositories/lifecycle.py +0 -0
  66. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/repositories/repository.py +0 -0
  67. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/translators/__init__.py +0 -0
  68. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/translators/deepeval.py +0 -0
  69. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/translators/protocol.py +0 -0
  70. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/translators/pydantic_evals.py +0 -0
  71. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/ui/__init__.py +0 -0
  72. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/ui/app.py +0 -0
  73. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/ui/models.py +0 -0
  74. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/ui/routes/__init__.py +0 -0
  75. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/ui/routes/history.py +0 -0
  76. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/ui/routes/meta.py +0 -0
  77. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/ui/routes/refs.py +0 -0
  78. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/ui/routes/runs.py +0 -0
  79. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/ui/routes/static.py +0 -0
  80. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/ui/security.py +0 -0
  81. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/ui/static/assets/index-BZO2JqWB.css +0 -0
  82. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/ui/static/assets/index-Cg522kcf.js +0 -0
  83. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/ui/static/favicon.svg +0 -0
  84. {evaltrack-0.1.0 → evaltrack-0.2.0}/evaltrack/ui/static/index.html +0 -0
  85. {evaltrack-0.1.0 → evaltrack-0.2.0}/examples/README.md +0 -0
  86. {evaltrack-0.1.0 → evaltrack-0.2.0}/examples/test_01_function.py +0 -0
  87. {evaltrack-0.1.0 → evaltrack-0.2.0}/examples/test_02_scores.py +0 -0
  88. {evaltrack-0.1.0 → evaltrack-0.2.0}/examples/test_03_reliability.py +0 -0
  89. {evaltrack-0.1.0 → evaltrack-0.2.0}/examples/test_04_agent_tool_use.py +0 -0
  90. {evaltrack-0.1.0 → evaltrack-0.2.0}/examples/test_05_llm_judge.py +0 -0
  91. {evaltrack-0.1.0 → evaltrack-0.2.0}/examples/test_06_fake_tool_in_inputs.py +0 -0
  92. {evaltrack-0.1.0 → evaltrack-0.2.0}/examples/test_07_other_eval_runner.py +0 -0
  93. {evaltrack-0.1.0 → evaltrack-0.2.0}/examples/test_08_deepeval.py +0 -0
  94. {evaltrack-0.1.0 → evaltrack-0.2.0}/examples/test_09_deepeval_repeats.py +0 -0
  95. {evaltrack-0.1.0 → evaltrack-0.2.0}/examples/test_10_deepeval_traced.py +0 -0
  96. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/.gitignore +0 -0
  97. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/README.md +0 -0
  98. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/eslint.config.js +0 -0
  99. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/index.html +0 -0
  100. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/package-lock.json +0 -0
  101. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/package.json +0 -0
  102. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/public/favicon.svg +0 -0
  103. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/App.tsx +0 -0
  104. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/api.ts +0 -0
  105. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/attemptCounts.test.ts +0 -0
  106. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/attemptCounts.ts +0 -0
  107. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/attemptErrors.test.ts +0 -0
  108. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/attemptErrors.ts +0 -0
  109. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/baseline.test.ts +0 -0
  110. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/baseline.ts +0 -0
  111. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/binaryEnvelope.test.ts +0 -0
  112. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/binaryEnvelope.ts +0 -0
  113. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/caseFilter.test.ts +0 -0
  114. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/caseFilter.ts +0 -0
  115. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/caseSections.test.ts +0 -0
  116. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/caseSections.ts +0 -0
  117. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/checks.test.ts +0 -0
  118. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/checks.ts +0 -0
  119. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/clamp.test.ts +0 -0
  120. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/clamp.ts +0 -0
  121. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/ConfirmDialog.tsx +0 -0
  122. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/CopyButton.tsx +0 -0
  123. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/Drawer.tsx +0 -0
  124. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/EvaluatorList.tsx +0 -0
  125. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/JsonDiff.tsx +0 -0
  126. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/JsonView.test.ts +0 -0
  127. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/JsonView.tsx +0 -0
  128. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/OutcomeCard.test.ts +0 -0
  129. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/OutcomeCard.tsx +0 -0
  130. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/PrRef.tsx +0 -0
  131. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/RunDetail.test.ts +0 -0
  132. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/RunDetail.tsx +0 -0
  133. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/RunDiff.test.ts +0 -0
  134. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/RunDiff.tsx +0 -0
  135. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/ScoreMeter.tsx +0 -0
  136. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/ScoreTrend.tsx +0 -0
  137. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/Sidebar.tsx +0 -0
  138. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/TableScroll.tsx +0 -0
  139. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/TextDiff.test.ts +0 -0
  140. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/TextDiff.tsx +0 -0
  141. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/ThemeToggle.test.ts +0 -0
  142. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/components/ThemeToggle.tsx +0 -0
  143. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/diff.test.ts +0 -0
  144. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/diff.ts +0 -0
  145. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/extract.test.ts +0 -0
  146. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/extract.ts +0 -0
  147. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/format.test.ts +0 -0
  148. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/format.ts +0 -0
  149. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/grouping.test.ts +0 -0
  150. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/grouping.ts +0 -0
  151. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/index.css +0 -0
  152. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/load.test.ts +0 -0
  153. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/main.tsx +0 -0
  154. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/reliabilityNote.test.ts +0 -0
  155. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/reliabilityNote.ts +0 -0
  156. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/results.ts +0 -0
  157. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/runBody.test.ts +0 -0
  158. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/runOutcome.test.ts +0 -0
  159. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/runOutcome.ts +0 -0
  160. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/scoreTrend.test.ts +0 -0
  161. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/scoreTrend.ts +0 -0
  162. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/shortenUrl.test.ts +0 -0
  163. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/shortenUrl.ts +0 -0
  164. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/test-support.ts +0 -0
  165. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/src/types.ts +0 -0
  166. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/tsconfig.json +0 -0
  167. {evaltrack-0.1.0 → evaltrack-0.2.0}/frontend/vite.config.ts +0 -0
  168. {evaltrack-0.1.0 → evaltrack-0.2.0}/hatch_build.py +0 -0
  169. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/__init__.py +0 -0
  170. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/cli/__init__.py +0 -0
  171. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/cli/helpers.py +0 -0
  172. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/cli/test_export.py +0 -0
  173. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/cli/test_listing.py +0 -0
  174. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/cli/test_main.py +0 -0
  175. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/cli/test_promote.py +0 -0
  176. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/cli/test_push.py +0 -0
  177. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/core/__init__.py +0 -0
  178. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/core/test_errors.py +0 -0
  179. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/core/test_eval_round.py +0 -0
  180. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/core/test_recorder.py +0 -0
  181. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/core/test_refs.py +0 -0
  182. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/core/test_results.py +0 -0
  183. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/core/test_run_record.py +0 -0
  184. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/core/test_score_bars.py +0 -0
  185. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/core/test_user_values.py +0 -0
  186. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/factories.py +0 -0
  187. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/fakes.py +0 -0
  188. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/history/__init__.py +0 -0
  189. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/history/test_reliability.py +0 -0
  190. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/history/test_score_history.py +0 -0
  191. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/marked_test/__init__.py +0 -0
  192. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/marked_test/conftest.py +0 -0
  193. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/marked_test/test_api.py +0 -0
  194. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/marked_test/test_merge.py +0 -0
  195. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/marked_test/test_run_loop.py +0 -0
  196. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/plugin/__init__.py +0 -0
  197. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/plugin/helpers.py +0 -0
  198. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/plugin/test_async_plugins.py +0 -0
  199. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/plugin/test_context.py +0 -0
  200. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/plugin/test_gate_integration.py +0 -0
  201. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/plugin/test_marker.py +0 -0
  202. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/plugin/test_options.py +0 -0
  203. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/plugin/test_outcomes.py +0 -0
  204. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/plugin/test_reruns.py +0 -0
  205. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/plugin/test_termination.py +0 -0
  206. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/repositories/__init__.py +0 -0
  207. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/repositories/helpers.py +0 -0
  208. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/repositories/test_file_store.py +0 -0
  209. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/repositories/test_repository_refs.py +0 -0
  210. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/repositories/test_repository_retention.py +0 -0
  211. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/repositories/test_repository_runs.py +0 -0
  212. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/test_config.py +0 -0
  213. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/test_context.py +0 -0
  214. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/test_failure.py +0 -0
  215. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/test_public_api.py +0 -0
  216. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/translators/__init__.py +0 -0
  217. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/translators/contract.py +0 -0
  218. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/translators/test_pydantic_evals.py +0 -0
  219. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/translators/test_registry.py +0 -0
  220. {evaltrack-0.1.0 → evaltrack-0.2.0}/tests/ui/__init__.py +0 -0
@@ -7,9 +7,18 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic
7
7
  [keep a changelog]: https://keepachangelog.com/en/1.1.0/
8
8
  [semantic versioning]: https://semver.org/spec/v2.0.0.html
9
9
 
10
+ ## [0.2.0] - 2026-09-15
11
+
12
+ ### Added
13
+
14
+ - Amazon S3 as a remote repository backend, addressed as `s3://bucket[/prefix]` and installed with
15
+ the `[s3]` extra. Authentication uses boto3's default credential chain. See
16
+ [Repositories › Amazon S3](docs/repositories.md#amazon-s3).
17
+
10
18
  ## [0.1.0] - 2026-09-11
11
19
 
12
20
  The first public release. evaltrack is a pytest plugin that records, gates and tracks LLM evals. See
13
21
  the [README](README.md) to get started.
14
22
 
23
+ [0.2.0]: https://github.com/jesrav/evaltrack/releases/tag/v0.2.0
15
24
  [0.1.0]: https://github.com/jesrav/evaltrack/releases/tag/v0.1.0
@@ -10,7 +10,7 @@ not pass on Windows. Under WSL2 you are on Linux, so that works.
10
10
  Install [uv](https://docs.astral.sh/uv/) and [just](https://github.com/casey/just). Then run:
11
11
 
12
12
  ```bash
13
- just install_dev # uv sync --all-groups --extra ui --extra azure + install pre-commit hooks
13
+ just install_dev # uv sync --all-groups + install pre-commit hooks
14
14
  ```
15
15
 
16
16
  For the dashboard frontend (TypeScript/React):
@@ -29,16 +29,20 @@ just test # run the test suite
29
29
  just lint # ruff, basedpyright (strict), bandit, prettier (via pre-commit)
30
30
  ```
31
31
 
32
- The justfile has the rest: the frontend checks, the runnable examples, and the live-Azure
32
+ The justfile has the rest: the frontend checks, the runnable examples, and the live cloud
33
33
  integration tests. Run what matches your change (for the frontend, also `npm run lint`, which
34
34
  `just lint` does not cover). CI runs all of it on every PR bar the one exception below, so anything
35
35
  you skip locally is still caught there.
36
36
 
37
- The integration tests need credentials for the maintainer's Azure test account, so most contributors
38
- cannot run them locally. That is fine. A PR from a fork is not given the secret either, so that job
39
- skips there rather than failing on empty credentials, and the run against live Azure happens after
40
- merge. If your change touches the Azure backend, say so in the PR and I will run them. The azure
41
- fixtures in `tests/conftest.py` have the details.
37
+ The integration tests need credentials for the maintainer's Azure and AWS test accounts, so most
38
+ contributors cannot run them locally. That is fine. A PR from a fork is not given the secrets
39
+ either, so that job skips there rather than failing on empty credentials, and the run against live
40
+ storage happens after merge. If your change touches the Azure or S3 backend, say so in the PR and I
41
+ will run them. The azure and s3 fixtures in `tests/repositories/conftest.py` have the details.
42
+
43
+ Locally, the Azure tests use `az login`. The S3 tests use the AWS profile that `AWS_PROFILE` names.
44
+ Run `AWS_PROFILE=<profile> just integration_test`, or put `AWS_PROFILE=<profile>` in a `.env` file.
45
+ The justfile loads that file and git ignores it.
42
46
 
43
47
  ## Conventions
44
48
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: evaltrack
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Pytest plugin to record, gate and track LLM eval runs from pydantic-evals, DeepEval or a runner you write a translator for
5
5
  Project-URL: Homepage, https://github.com/jesrav/evaltrack
6
6
  Project-URL: Repository, https://github.com/jesrav/evaltrack
@@ -37,6 +37,8 @@ Provides-Extra: deepeval
37
37
  Requires-Dist: deepeval>=4.2; extra == 'deepeval'
38
38
  Provides-Extra: pydantic-evals
39
39
  Requires-Dist: pydantic-evals>=2; extra == 'pydantic-evals'
40
+ Provides-Extra: s3
41
+ Requires-Dist: boto3>=1.35.60; extra == 's3'
40
42
  Provides-Extra: ui
41
43
  Requires-Dist: fastapi>=0.115.8; extra == 'ui'
42
44
  Requires-Dist: starlette>=0.45.1; extra == 'ui'
@@ -71,10 +73,10 @@ suite and CI pipeline that you already have, with the eval runner you already us
71
73
  rerun only the evals that fail (not the whole CI pipeline) and track each case's pass-rate over
72
74
  time. See [Flakiness & reliability].
73
75
 
74
- evaltrack records every run in a repository you own (local files, or Azure Blob as the supported
75
- remote), with a dashboard you run locally to inspect runs and compare them across PRs and releases.
76
- Over the mainline (the runs you have promoted) it tracks each case's pass-rate and each score, so
77
- changes in quality that never trip the gate are still visible.
76
+ evaltrack records every run in a repository you own (local files, or Azure Blob Storage or Amazon S3
77
+ as the remote), with a dashboard you run locally to inspect runs and compare them across PRs and
78
+ releases. Over the mainline (the runs you have promoted) it tracks each case's pass-rate and each
79
+ score, so changes in quality that never trip the gate are still visible.
78
80
 
79
81
  ![Animated demo: a failing eval run in the dashboard, with per-case verdicts, scores against their bars, reliability history, and a comparison against the baseline][dashboard-demo]
80
82
 
@@ -214,8 +216,8 @@ history over the mainline.
214
216
  ### 5. Track a shared remote (optional)
215
217
 
216
218
  Declare your repositories in `pyproject.toml`. `local` is where the plugin saves runs. `remote` is a
217
- shared repository that your CI writes to (right now only Azure Blob Storage is supported). It stores
218
- the baseline (the run recorded for what is currently deployed) and the PR history.
219
+ shared repository that your CI writes to (Azure Blob Storage or Amazon S3). It stores the baseline
220
+ (the run recorded for what is currently deployed) and the PR history.
219
221
 
220
222
  ```toml
221
223
  [tool.evaltrack]
@@ -255,6 +257,8 @@ keep stable: the names `import evaltrack` exports, `evaltrack.translators.regist
255
257
  the `[tool.evaltrack]` keys, and the stored run JSON, where fields may be added but keep their
256
258
  meaning. `raw_results` is the exception, since the runner decides its shape.
257
259
 
260
+ Planned additions are in a rough [roadmap].
261
+
258
262
  [pydantic-evals]: https://ai.pydantic.dev/evals/
259
263
  [DeepEval]: https://deepeval.com/
260
264
  [Eval runners]: https://github.com/jesrav/evaltrack/blob/main/docs/eval-runners.md
@@ -279,3 +283,4 @@ meaning. `raw_results` is the exception, since the runner decides its shape.
279
283
  [security policy]: https://github.com/jesrav/evaltrack/blob/main/SECURITY.md
280
284
  [dashboard trust model]:
281
285
  https://github.com/jesrav/evaltrack/blob/main/SECURITY.md#dashboard-trust-model
286
+ [roadmap]: https://github.com/jesrav/evaltrack/blob/main/ROADMAP.md
@@ -26,10 +26,10 @@ suite and CI pipeline that you already have, with the eval runner you already us
26
26
  rerun only the evals that fail (not the whole CI pipeline) and track each case's pass-rate over
27
27
  time. See [Flakiness & reliability].
28
28
 
29
- evaltrack records every run in a repository you own (local files, or Azure Blob as the supported
30
- remote), with a dashboard you run locally to inspect runs and compare them across PRs and releases.
31
- Over the mainline (the runs you have promoted) it tracks each case's pass-rate and each score, so
32
- changes in quality that never trip the gate are still visible.
29
+ evaltrack records every run in a repository you own (local files, or Azure Blob Storage or Amazon S3
30
+ as the remote), with a dashboard you run locally to inspect runs and compare them across PRs and
31
+ releases. Over the mainline (the runs you have promoted) it tracks each case's pass-rate and each
32
+ score, so changes in quality that never trip the gate are still visible.
33
33
 
34
34
  ![Animated demo: a failing eval run in the dashboard, with per-case verdicts, scores against their bars, reliability history, and a comparison against the baseline][dashboard-demo]
35
35
 
@@ -169,8 +169,8 @@ history over the mainline.
169
169
  ### 5. Track a shared remote (optional)
170
170
 
171
171
  Declare your repositories in `pyproject.toml`. `local` is where the plugin saves runs. `remote` is a
172
- shared repository that your CI writes to (right now only Azure Blob Storage is supported). It stores
173
- the baseline (the run recorded for what is currently deployed) and the PR history.
172
+ shared repository that your CI writes to (Azure Blob Storage or Amazon S3). It stores the baseline
173
+ (the run recorded for what is currently deployed) and the PR history.
174
174
 
175
175
  ```toml
176
176
  [tool.evaltrack]
@@ -210,6 +210,8 @@ keep stable: the names `import evaltrack` exports, `evaltrack.translators.regist
210
210
  the `[tool.evaltrack]` keys, and the stored run JSON, where fields may be added but keep their
211
211
  meaning. `raw_results` is the exception, since the runner decides its shape.
212
212
 
213
+ Planned additions are in a rough [roadmap].
214
+
213
215
  [pydantic-evals]: https://ai.pydantic.dev/evals/
214
216
  [DeepEval]: https://deepeval.com/
215
217
  [Eval runners]: https://github.com/jesrav/evaltrack/blob/main/docs/eval-runners.md
@@ -234,3 +236,4 @@ meaning. `raw_results` is the exception, since the runner decides its shape.
234
236
  [security policy]: https://github.com/jesrav/evaltrack/blob/main/SECURITY.md
235
237
  [dashboard trust model]:
236
238
  https://github.com/jesrav/evaltrack/blob/main/SECURITY.md#dashboard-trust-model
239
+ [roadmap]: https://github.com/jesrav/evaltrack/blob/main/ROADMAP.md
@@ -0,0 +1,30 @@
1
+ # Roadmap
2
+
3
+ This is directional and priorities and scope will change.
4
+
5
+ ## More storage remotes
6
+
7
+ - Google Cloud Storage, alongside the existing Azure Blob and S3 remotes.
8
+
9
+ ## Sharing results
10
+
11
+ - A single-file HTML report of a run, or of a run against the baseline, that opens anywhere with no
12
+ server. Meant for CI artifacts and release notes.
13
+ - A Markdown summary of a run against the baseline, for posting on a pull request.
14
+
15
+ ## CI integration
16
+
17
+ - A GitHub Action that wraps the push and promote flow.
18
+
19
+ ## Running evals
20
+
21
+ - pytest-xdist support, to run evals in parallel across workers.
22
+
23
+ ## Dashboard
24
+
25
+ - The pooling window as a project setting and as a control in the dashboard.
26
+
27
+ - Runner details on every attempt, and link templates that turn a recorded trace id into a link to
28
+ an observability platform.
29
+
30
+ - Images in inputs and outputs, stored once by content hash and rendered inline.
@@ -35,9 +35,11 @@ flowchart TB
35
35
 
36
36
  ## Prerequisites
37
37
 
38
- You need a shared `azure://` remote and credentials for it:
38
+ You need a shared remote and credentials for it. The examples use `azure://`, and an `s3://` remote
39
+ works the same way with the AWS credentials in place of the Azure ones:
39
40
 
40
- - For the URL shape and how evaltrack authenticates, see [Repositories › Azure Blob Storage].
41
+ - For the URL shape and how evaltrack authenticates, see [Repositories › Azure Blob Storage] or
42
+ [Repositories › Amazon S3].
41
43
  - Point `[tool.evaltrack].remote` at the remote, so `evaltrack ui` mounts it next to your local
42
44
  runs:
43
45
 
@@ -73,7 +75,8 @@ evaltrack push --run-file run.json \
73
75
 
74
76
  That is the whole integration. What the job around it has to get right:
75
77
 
76
- - **Install `evaltrack[azure]`** alongside your project's own dependencies, or the push fails.
78
+ - **Install `evaltrack[azure]`**, or `evaltrack[s3]`, alongside your project's own dependencies, or
79
+ the push fails.
77
80
  - **Name the remote once.** Set `EVALTRACK_REMOTE` for the job and neither command needs to name a
78
81
  repository (see [Configuration › Precedence rules](./configuration.md#precedence-rules)).
79
82
  - **Push even when an eval failed.** The run is written when the pytest session finishes, whatever
@@ -143,5 +146,6 @@ biases the [tracked pass-rate][cross-run reliability] upward.
143
146
  [`baseline`]: ./repositories.md#baseline-and-mainline
144
147
  [adapting the flow]: #adapting-the-flow-to-your-delivery-process
145
148
  [repositories › azure blob storage]: ./repositories.md#azure-blob-storage
149
+ [repositories › amazon s3]: ./repositories.md#amazon-s3
146
150
  [pytest-xdist]: https://github.com/pytest-dev/pytest-xdist
147
151
  [cross-run reliability]: ./flakiness.md#cross-run-reliability
@@ -74,8 +74,10 @@ Missing parent directories are fine. They are created when the run is written.
74
74
  | `EVALTRACK_LABEL_<KEY>` | run context | arbitrary label, lowercased key (for example `EVALTRACK_LABEL_BUILD_ID=42`) |
75
75
 
76
76
  The Azure backend also reads the standard `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, and
77
- `AZURE_CLIENT_SECRET` variables via `DefaultAzureCredential`. See
78
- [Repositories › Authentication](./repositories.md#authentication).
77
+ `AZURE_CLIENT_SECRET` variables via `DefaultAzureCredential`, and the S3 backend reads the standard
78
+ `AWS_*` variables and profiles via boto3. See
79
+ [Repositories › Authentication](./repositories.md#authentication) and
80
+ [Repositories › Amazon S3](./repositories.md#amazon-s3).
79
81
 
80
82
  ## Precedence rules
81
83
 
@@ -97,8 +99,8 @@ The local repository, plus the remote when one is configured, resolved exactly a
97
99
 
98
100
  ## Repository names
99
101
 
100
- A repository is named by a directory path, or by an `azure://account/container[/prefix]` URL
101
- ([Backends](./repositories.md#backends)).
102
+ A repository is named by a directory path, or by a URL such as `azure://account/container[/prefix]`
103
+ or `s3://bucket[/prefix]` ([Backends](./repositories.md#backends)).
102
104
 
103
105
  Where a relative path resolves from depends on where you wrote it:
104
106
 
@@ -71,6 +71,7 @@ A repository is named by a directory path, or by a URL whose scheme picks the ba
71
71
  | --------------------------- | ------------------------------------ |
72
72
  | `./.evaltrack` | Local directory (default) |
73
73
  | `azure://account/container` | Azure Blob Storage (`[azure]` extra) |
74
+ | `s3://bucket` | Amazon S3 (`[s3]` extra) |
74
75
 
75
76
  How a relative path resolves is in
76
77
  [Configuration › Repository names](./configuration.md#repository-names).
@@ -105,6 +106,32 @@ secret to manage:
105
106
 
106
107
  Both need the Storage Blob Data Contributor role on the account.
107
108
 
109
+ ## Amazon S3
110
+
111
+ > Requires the `[s3]` extra: `uv add "evaltrack[s3]"`.
112
+
113
+ A shared remote is an S3 bucket, addressed as `s3://<bucket>[/<prefix>]`. The optional prefix keeps
114
+ projects apart inside one bucket, for example `s3://myevals/project-a`. The region is not part of
115
+ the URL. It comes from your AWS configuration. If that region is wrong, S3 redirects the request
116
+ once.
117
+
118
+ Only Amazon S3 is supported.
119
+
120
+ ### Authentication
121
+
122
+ evaltrack authenticates with boto3's default credential chain, so there is no evaltrack-specific
123
+ secret to manage:
124
+
125
+ - **Developers** use the profile they already use for AWS. With IAM Identity Center that is
126
+ `aws sso login`, and with an access key it is `aws configure`. If the profile is not the default
127
+ one, set `AWS_PROFILE`. The dashboard runs as you, so it uses the same profile.
128
+ - **CI** on GitHub Actions can use `aws-actions/configure-aws-credentials` with an OpenID Connect
129
+ role, which stores no secret. Any CI can instead set `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`
130
+ and, for temporary credentials, `AWS_SESSION_TOKEN`.
131
+
132
+ Both need `s3:ListBucket` on the bucket and `s3:GetObject`, `s3:PutObject` and `s3:DeleteObject` on
133
+ its objects.
134
+
108
135
  ## Cleaning up runs
109
136
 
110
137
  A shared remote repository grows with every PR run, and merged or abandoned PRs leave behind
@@ -137,6 +164,7 @@ The dashboard shows the ref as `unreadable history`.
137
164
 
138
165
  To repair it, write the readable lines back without the torn one, each ending in a newline. On
139
166
  Azure, write them in one append to a new append blob, since a block blob refuses every later append.
167
+ On S3 a plain upload of the repaired file is enough.
140
168
 
141
169
  ## Reading runs from Python
142
170
 
@@ -24,6 +24,10 @@ __all__ = [
24
24
  "promote",
25
25
  ]
26
26
 
27
+ # All backend URL schemes for the messages that list them.
28
+ _KNOWN_SCHEMES = ("azure", "s3")
29
+ _KNOWN_SCHEMES_TEXT = "known schemes: " + ", ".join(_KNOWN_SCHEMES)
30
+
27
31
 
28
32
  def open_repository(location: str) -> RunRepository:
29
33
  """Open a `RunRepository` for `location`, a directory path, or a URL with a
@@ -43,14 +47,14 @@ def open_repository(location: str) -> RunRepository:
43
47
  scheme_prefix, colon, _ = location.partition(":")
44
48
  raise ValueError(
45
49
  f"repository URL {scheme_prefix + colon!r} is missing '://' "
46
- "(known schemes: azure). A directory path must have no ':' in "
50
+ f"({_KNOWN_SCHEMES_TEXT}). A directory path must have no ':' in "
47
51
  "its first segment."
48
52
  )
49
53
  import evaltrack.repositories.file as file_repository
50
54
 
51
55
  return file_repository.open_from_path(location)
52
56
  scheme = location.split("://", 1)[0]
53
- # Each scheme's module is imported on use, because the azure one needs an
57
+ # Each scheme's module is imported on use, because every remote needs an
54
58
  # optional extra.
55
59
  match scheme:
56
60
  case "azure":
@@ -62,7 +66,15 @@ def open_repository(location: str) -> RunRepository:
62
66
  f"({exc})"
63
67
  ) from exc
64
68
  return azure_repository.open_from_url(location)
69
+ case "s3":
70
+ try:
71
+ import evaltrack.repositories.s3 as s3_repository
72
+ except ImportError as exc:
73
+ raise ImportError(
74
+ f"the 's3' repository requires the `evaltrack[s3]` extra ({exc})"
75
+ ) from exc
76
+ return s3_repository.open_from_url(location)
65
77
  case _:
66
78
  raise ValueError(
67
- f"unknown repository scheme: {scheme!r} (known schemes: azure)"
79
+ f"unknown repository scheme: {scheme!r} ({_KNOWN_SCHEMES_TEXT})"
68
80
  )
@@ -20,12 +20,12 @@ from azure.storage.blob import BlobServiceClient, ContainerClient
20
20
 
21
21
  from evaltrack.core.errors import RepositoryUnavailableError
22
22
  from evaltrack.repositories.repository import RunRepository
23
- from evaltrack.repositories.store import ObjectNotFoundError, ObjectStore
24
-
25
- # Pinned so an SDK default change cannot move them. `read_timeout` bounds the
26
- # gap between two chunks, so a large streaming blob never trips it.
27
- _CONNECTION_TIMEOUT = 20
28
- _READ_TIMEOUT = 120
23
+ from evaltrack.repositories.store import (
24
+ CONNECTION_TIMEOUT,
25
+ READ_TIMEOUT,
26
+ ObjectNotFoundError,
27
+ ObjectStore,
28
+ )
29
29
 
30
30
 
31
31
  @contextmanager
@@ -53,8 +53,8 @@ class AzureBlobStore(ObjectStore):
53
53
  service = BlobServiceClient(
54
54
  account_url=f"https://{account}.blob.core.windows.net",
55
55
  credential=DefaultAzureCredential(),
56
- connection_timeout=_CONNECTION_TIMEOUT,
57
- read_timeout=_READ_TIMEOUT,
56
+ connection_timeout=CONNECTION_TIMEOUT,
57
+ read_timeout=READ_TIMEOUT,
58
58
  )
59
59
  container = service.get_container_client(container_name)
60
60
  return cls(container, prefix)
@@ -0,0 +1,266 @@
1
+ """Amazon S3 `ObjectStore` and the `s3://<bucket>[/<prefix>]` URL scheme. Needs
2
+ the `[s3]` extra. Authentication uses the default credential chain of boto3, so
3
+ a profile, the standard `AWS_*` variables, a web identity token and an instance
4
+ role all work. Only Amazon S3 is supported.
5
+ """
6
+
7
+ import random
8
+ import re
9
+ import time
10
+ from collections.abc import Generator, Iterator
11
+ from contextlib import contextmanager
12
+ from dataclasses import dataclass
13
+ from typing import Any, Protocol, Self, cast
14
+ from urllib.parse import urlparse
15
+
16
+ import boto3
17
+ from botocore.config import Config
18
+ from botocore.exceptions import BotoCoreError, ClientError
19
+
20
+ from evaltrack.core.errors import RepositoryUnavailableError
21
+ from evaltrack.repositories.repository import RunRepository
22
+ from evaltrack.repositories.store import (
23
+ CONNECTION_TIMEOUT,
24
+ READ_TIMEOUT,
25
+ ObjectNotFoundError,
26
+ ObjectStore,
27
+ )
28
+
29
+ # How many times `append` tries before it gives up. Each lost put means that
30
+ # another writer won.
31
+ _APPEND_ATTEMPTS = 8
32
+ # The longest pause before a retry, in seconds. The pause is random and grows
33
+ # with each attempt, so writers that collide spread out.
34
+ _RETRY_JITTER = 0.05
35
+
36
+ # The error codes of a conditional put that lost to another writer.
37
+ # `PreconditionFailed` is the 412 for both headers. `ConditionalRequestConflict`
38
+ # is a 409 for two conditional puts that overlapped. `NoSuchKey` is an
39
+ # `If-Match` put on an object that was deleted after the read.
40
+ _LOST_CONDITIONAL_WRITE = frozenset(
41
+ {"PreconditionFailed", "ConditionalRequestConflict", "NoSuchKey"}
42
+ )
43
+ # GetObject reports a missing object as `NoSuchKey`. A HEAD request has no
44
+ # body, so the client only sees the status code.
45
+ _NOT_FOUND = frozenset({"NoSuchKey", "NotFound", "404"})
46
+
47
+ # `SystemRandom` so the pause does not use or change the global random state
48
+ # of the process.
49
+ _jitter = random.SystemRandom()
50
+
51
+
52
+ class S3Client(Protocol):
53
+ """The calls that the store makes on a boto3 S3 client. boto3 has no client
54
+ type to import, so this is the type that a fake implements."""
55
+
56
+ def head_bucket(self, **kwargs: Any) -> Any: ...
57
+ def head_object(self, **kwargs: Any) -> Any: ...
58
+ def get_object(self, **kwargs: Any) -> Any: ...
59
+ def put_object(self, **kwargs: Any) -> Any: ...
60
+ def delete_object(self, **kwargs: Any) -> Any: ...
61
+ def get_paginator(self, operation_name: str) -> Any: ...
62
+
63
+
64
+ @dataclass(frozen=True)
65
+ class _Snapshot:
66
+ """An object as one read saw it. The ETag identifies that version. A later
67
+ conditional put uses it to make sure that the object has not changed."""
68
+
69
+ content: bytes
70
+ etag: str
71
+
72
+
73
+ def _error_code(exc: ClientError) -> str:
74
+ return str(exc.response.get("Error", {}).get("Code", ""))
75
+
76
+
77
+ @contextmanager
78
+ def _translating_transport_errors() -> Generator[None]:
79
+ """Re-raise a failed request as `RepositoryUnavailableError`.
80
+ `ObjectNotFoundError` must be raised inside the block."""
81
+ try:
82
+ yield
83
+ except (BotoCoreError, ClientError) as exc:
84
+ raise RepositoryUnavailableError(str(exc)) from exc
85
+
86
+
87
+ class S3ObjectStore(ObjectStore):
88
+ """`ObjectStore` backed by an S3 bucket. `prefix` is a key prefix inside the
89
+ bucket. `append_attempts` is how many times `append` tries before it gives
90
+ up."""
91
+
92
+ def __init__(
93
+ self,
94
+ client: S3Client,
95
+ bucket: str,
96
+ *,
97
+ prefix: str = "",
98
+ append_attempts: int = _APPEND_ATTEMPTS,
99
+ ) -> None:
100
+ self._client = client
101
+ self._bucket = bucket
102
+ self._prefix = (prefix.strip("/") + "/") if prefix.strip("/") else ""
103
+ self._append_attempts = append_attempts
104
+
105
+ @classmethod
106
+ def from_url(cls, url: str) -> Self:
107
+ bucket, prefix = parse_s3_url(url)
108
+ with _translating_transport_errors():
109
+ # boto3 looks for credentials on the first request, not here. So a
110
+ # missing login fails in `verify_available` or in the first operation.
111
+ client = boto3.Session().client(
112
+ "s3",
113
+ config=Config(
114
+ connect_timeout=CONNECTION_TIMEOUT,
115
+ read_timeout=READ_TIMEOUT,
116
+ retries={"mode": "standard"},
117
+ ),
118
+ )
119
+ return cls(cast(S3Client, client), bucket, prefix=prefix)
120
+
121
+ def verify_available(self) -> None:
122
+ with _translating_transport_errors():
123
+ try:
124
+ self._client.head_bucket(Bucket=self._bucket)
125
+ except ClientError as exc:
126
+ if _error_code(exc) in _NOT_FOUND:
127
+ raise ValueError(
128
+ f"bucket {self._bucket!r} does not exist. Create it first."
129
+ ) from None
130
+ raise
131
+
132
+ def _build_key(self, path: str) -> str:
133
+ return self._prefix + path
134
+
135
+ def _read_snapshot(self, key: str) -> _Snapshot | None:
136
+ """The object as it is now, or `None` when absent."""
137
+ try:
138
+ response = self._client.get_object(Bucket=self._bucket, Key=key)
139
+ except ClientError as exc:
140
+ if _error_code(exc) in _NOT_FOUND:
141
+ return None
142
+ raise
143
+ return _Snapshot(response["Body"].read(), response["ETag"])
144
+
145
+ def read(self, path: str) -> bytes:
146
+ with _translating_transport_errors():
147
+ snapshot = self._read_snapshot(self._build_key(path))
148
+ if snapshot is None:
149
+ raise ObjectNotFoundError(path)
150
+ return snapshot.content
151
+
152
+ def write(self, content: bytes, path: str) -> None:
153
+ with _translating_transport_errors():
154
+ self._client.put_object(
155
+ Bucket=self._bucket, Key=self._build_key(path), Body=content
156
+ )
157
+
158
+ def append(self, content: bytes, path: str) -> None:
159
+ """S3 cannot append to an object, so this reads the object, adds
160
+ `content` and puts the whole object back. The put only succeeds if the
161
+ object still has the ETag that the read saw, or does not exist yet when
162
+ the read found nothing. If another writer changed it, the put fails and
163
+ the loop reads again, up to `append_attempts` times.
164
+ """
165
+ key = self._build_key(path)
166
+ with _translating_transport_errors():
167
+ for attempt in range(self._append_attempts):
168
+ current = self._read_snapshot(key)
169
+ # On a new key the put must only create. If another writer
170
+ # created the object first, the put fails instead of replacing it.
171
+ if current is None:
172
+ body, condition = content, {"IfNoneMatch": "*"}
173
+ else:
174
+ body, condition = (
175
+ current.content + content,
176
+ {"IfMatch": current.etag},
177
+ )
178
+ try:
179
+ self._client.put_object(
180
+ Bucket=self._bucket, Key=key, Body=body, **condition
181
+ )
182
+ return
183
+ except ClientError as exc:
184
+ if _error_code(exc) not in _LOST_CONDITIONAL_WRITE:
185
+ raise
186
+ time.sleep(_jitter.uniform(0, _RETRY_JITTER * (attempt + 1)))
187
+ raise RepositoryUnavailableError(
188
+ f"append to {path} failed {self._append_attempts} times in a row "
189
+ "because another writer kept changing the object"
190
+ )
191
+
192
+ def delete(self, path: str) -> None:
193
+ key = self._build_key(path)
194
+ with _translating_transport_errors():
195
+ # S3 reports success for a delete of a missing object. So the store
196
+ # first makes sure that the object exists.
197
+ try:
198
+ self._client.head_object(Bucket=self._bucket, Key=key)
199
+ except ClientError as exc:
200
+ if _error_code(exc) in _NOT_FOUND:
201
+ raise ObjectNotFoundError(path) from None
202
+ raise
203
+ self._client.delete_object(Bucket=self._bucket, Key=key)
204
+
205
+ def list(self, prefix: str) -> Iterator[str]:
206
+ full = self._build_key(prefix)
207
+ prefix_len = len(self._prefix)
208
+ with _translating_transport_errors():
209
+ # The paginator fetches each page when the loop reaches it, so a
210
+ # transport failure can occur in the middle of the iteration.
211
+ paginator = self._client.get_paginator("list_objects_v2")
212
+ for page in paginator.paginate(Bucket=self._bucket, Prefix=full):
213
+ for entry in page.get("Contents", []):
214
+ yield entry["Key"][prefix_len:]
215
+
216
+
217
+ # The naming rule of S3 for general purpose buckets. Without this check, a typo
218
+ # or a port fails at the endpoint, far from the mistake.
219
+ _BUCKET_NAME = re.compile(r"[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]")
220
+
221
+
222
+ def parse_s3_url(url: str) -> tuple[str, str]:
223
+ """Split an `s3://bucket[/prefix]` URL into (bucket, prefix).
224
+
225
+ Raises:
226
+ ValueError: for a malformed URL. No message quotes the URL, which can
227
+ carry a credential.
228
+ """
229
+ parsed = urlparse(url)
230
+ if parsed.scheme != "s3":
231
+ raise ValueError("S3ObjectStore expects an s3:// URL")
232
+ bucket = parsed.netloc
233
+ if not bucket:
234
+ raise ValueError(
235
+ "s3:// URL is missing the bucket. Use s3://<bucket>[/<prefix>]."
236
+ )
237
+ if "@" in bucket:
238
+ # Before the bucket name is quoted below, so a password never reaches
239
+ # the message.
240
+ raise ValueError(
241
+ "s3:// URL must not carry credentials. A username and password in "
242
+ "the URL are not supported. Authentication uses the AWS default "
243
+ "credential chain."
244
+ )
245
+ if not _BUCKET_NAME.fullmatch(bucket):
246
+ raise ValueError(
247
+ f"s3:// URL has an invalid bucket name {bucket!r}: bucket names are "
248
+ "3-63 lowercase letters, digits, dots and hyphens. A port or an "
249
+ "endpoint in the URL is not supported."
250
+ )
251
+ if parsed.query or parsed.fragment:
252
+ # Otherwise the signature of a presigned URL is dropped silently.
253
+ raise ValueError(
254
+ "s3:// URL must not carry a query or fragment. Presigned URLs are "
255
+ "not supported. Authentication uses the AWS default credential "
256
+ "chain (see https://github.com/jesrav/evaltrack/blob/main/docs/"
257
+ "repositories.md#authentication-1)."
258
+ )
259
+ # urlparse keeps the leading slash on path.
260
+ prefix = parsed.path.lstrip("/")
261
+ return bucket, prefix
262
+
263
+
264
+ def open_from_url(url: str) -> RunRepository:
265
+ """Open a repository for an `s3://` URL."""
266
+ return RunRepository(S3ObjectStore.from_url(url))
@@ -5,6 +5,12 @@ it was used the wrong way and reaches the caller unchanged."""
5
5
  from abc import ABC, abstractmethod
6
6
  from collections.abc import Iterator
7
7
 
8
+ # Fixed here so an SDK default cannot change them and every remote behaves the
9
+ # same. `READ_TIMEOUT` is how long to wait for the next bytes, not for the whole
10
+ # download, so a large object on a slow connection still completes.
11
+ CONNECTION_TIMEOUT = 20
12
+ READ_TIMEOUT = 120
13
+
8
14
 
9
15
  class ObjectNotFoundError(Exception):
10
16
  """Raised by `ObjectStore.read` and `delete` when the path does not exist.