hone-flow 0.1.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 (172) hide show
  1. hone_flow-0.1.0/.gitignore +59 -0
  2. hone_flow-0.1.0/AGENTS.md +83 -0
  3. hone_flow-0.1.0/CHANGELOG.md +158 -0
  4. hone_flow-0.1.0/CONTRIBUTING.md +156 -0
  5. hone_flow-0.1.0/LICENSE +202 -0
  6. hone_flow-0.1.0/PKG-INFO +202 -0
  7. hone_flow-0.1.0/README.md +167 -0
  8. hone_flow-0.1.0/design/README.md +87 -0
  9. hone_flow-0.1.0/design/changes/0001-initial-design.md +136 -0
  10. hone_flow-0.1.0/design/changes/0002-run-folders.md +166 -0
  11. hone_flow-0.1.0/design/changes/0003-progress-while-a-run-runs.md +60 -0
  12. hone_flow-0.1.0/design/changes/0004-steps-over-all-items.md +67 -0
  13. hone_flow-0.1.0/design/changes/0005-items-from-a-step.md +72 -0
  14. hone_flow-0.1.0/design/changes/0006-previous-output-on-revise.md +53 -0
  15. hone_flow-0.1.0/design/changes/0007-select-items-mid-run.md +67 -0
  16. hone_flow-0.1.0/design/changes/0008-read-api-for-browsers.md +66 -0
  17. hone_flow-0.1.0/design/changes/0009-run-labels.md +58 -0
  18. hone_flow-0.1.0/design/changes/0010-seed-and-actor-kind-in-records.md +51 -0
  19. hone_flow-0.1.0/design/current.md +857 -0
  20. hone_flow-0.1.0/design/decisions.md +237 -0
  21. hone_flow-0.1.0/design/history/0000-research.md +139 -0
  22. hone_flow-0.1.0/design/history/v0.1-design.md +136 -0
  23. hone_flow-0.1.0/design/versioning.md +160 -0
  24. hone_flow-0.1.0/docs/across-items.md +164 -0
  25. hone_flow-0.1.0/docs/adapters.md +300 -0
  26. hone_flow-0.1.0/docs/cli.md +134 -0
  27. hone_flow-0.1.0/docs/concepts.md +353 -0
  28. hone_flow-0.1.0/docs/gates.md +210 -0
  29. hone_flow-0.1.0/docs/index.md +24 -0
  30. hone_flow-0.1.0/docs/measurements.md +136 -0
  31. hone_flow-0.1.0/docs/notifications.md +161 -0
  32. hone_flow-0.1.0/docs/read-api.md +241 -0
  33. hone_flow-0.1.0/docs/records.md +196 -0
  34. hone_flow-0.1.0/docs/resume-and-fork.md +292 -0
  35. hone_flow-0.1.0/docs/run-folders.md +177 -0
  36. hone_flow-0.1.0/docs/run-format.md +227 -0
  37. hone_flow-0.1.0/docs/storage.md +242 -0
  38. hone_flow-0.1.0/examples/README.md +46 -0
  39. hone_flow-0.1.0/examples/cli_session.py +77 -0
  40. hone_flow-0.1.0/examples/crash_recovery.py +80 -0
  41. hone_flow-0.1.0/examples/failure_and_resume.py +58 -0
  42. hone_flow-0.1.0/examples/fan_in.py +54 -0
  43. hone_flow-0.1.0/examples/fork_diff.py +64 -0
  44. hone_flow-0.1.0/examples/fork_refresh.py +55 -0
  45. hone_flow-0.1.0/examples/global_steps.py +42 -0
  46. hone_flow-0.1.0/examples/gpu_batching.py +61 -0
  47. hone_flow-0.1.0/examples/incompatible_resume.py +66 -0
  48. hone_flow-0.1.0/examples/measurements.py +53 -0
  49. hone_flow-0.1.0/examples/notifications.py +61 -0
  50. hone_flow-0.1.0/examples/params_and_context.py +59 -0
  51. hone_flow-0.1.0/examples/partial_runs.py +53 -0
  52. hone_flow-0.1.0/examples/pin_and_cleanup.py +52 -0
  53. hone_flow-0.1.0/examples/produced_items.py +59 -0
  54. hone_flow-0.1.0/examples/progress.py +56 -0
  55. hone_flow-0.1.0/examples/quickstart.py +40 -0
  56. hone_flow-0.1.0/examples/read_api.py +72 -0
  57. hone_flow-0.1.0/examples/records_and_traces.py +62 -0
  58. hone_flow-0.1.0/examples/review_gates.py +67 -0
  59. hone_flow-0.1.0/examples/revise_incrementally.py +53 -0
  60. hone_flow-0.1.0/examples/run_folder.py +58 -0
  61. hone_flow-0.1.0/examples/run_labels.py +47 -0
  62. hone_flow-0.1.0/examples/s3_storage.py +51 -0
  63. hone_flow-0.1.0/examples/select_items.py +56 -0
  64. hone_flow-0.1.0/examples/serializers.py +67 -0
  65. hone_flow-0.1.0/examples/video_pipeline.py +108 -0
  66. hone_flow-0.1.0/pyproject.toml +113 -0
  67. hone_flow-0.1.0/src/hone_flow/__init__.py +92 -0
  68. hone_flow-0.1.0/src/hone_flow/_records.py +236 -0
  69. hone_flow-0.1.0/src/hone_flow/_tracing.py +110 -0
  70. hone_flow-0.1.0/src/hone_flow/adapters/__init__.py +1 -0
  71. hone_flow-0.1.0/src/hone_flow/adapters/hone_models.py +34 -0
  72. hone_flow-0.1.0/src/hone_flow/cli.py +477 -0
  73. hone_flow-0.1.0/src/hone_flow/commit.py +296 -0
  74. hone_flow-0.1.0/src/hone_flow/dag.py +270 -0
  75. hone_flow-0.1.0/src/hone_flow/errors.py +46 -0
  76. hone_flow-0.1.0/src/hone_flow/executor.py +220 -0
  77. hone_flow-0.1.0/src/hone_flow/fork.py +341 -0
  78. hone_flow-0.1.0/src/hone_flow/fsspec_storage.py +129 -0
  79. hone_flow-0.1.0/src/hone_flow/history.py +223 -0
  80. hone_flow-0.1.0/src/hone_flow/inputs.py +208 -0
  81. hone_flow-0.1.0/src/hone_flow/invoke.py +61 -0
  82. hone_flow-0.1.0/src/hone_flow/leases.py +73 -0
  83. hone_flow-0.1.0/src/hone_flow/metrics.py +190 -0
  84. hone_flow-0.1.0/src/hone_flow/notifications.py +231 -0
  85. hone_flow-0.1.0/src/hone_flow/ports.py +76 -0
  86. hone_flow-0.1.0/src/hone_flow/produced.py +96 -0
  87. hone_flow-0.1.0/src/hone_flow/progress.py +56 -0
  88. hone_flow-0.1.0/src/hone_flow/py.typed +0 -0
  89. hone_flow-0.1.0/src/hone_flow/reports.py +95 -0
  90. hone_flow-0.1.0/src/hone_flow/resume.py +87 -0
  91. hone_flow-0.1.0/src/hone_flow/reviews.py +228 -0
  92. hone_flow-0.1.0/src/hone_flow/run.py +345 -0
  93. hone_flow-0.1.0/src/hone_flow/run_format.py +381 -0
  94. hone_flow-0.1.0/src/hone_flow/run_lease.py +125 -0
  95. hone_flow-0.1.0/src/hone_flow/schedule.py +118 -0
  96. hone_flow-0.1.0/src/hone_flow/serialize.py +136 -0
  97. hone_flow-0.1.0/src/hone_flow/spans.py +206 -0
  98. hone_flow-0.1.0/src/hone_flow/storage.py +248 -0
  99. hone_flow-0.1.0/src/hone_flow/testing/__init__.py +8 -0
  100. hone_flow-0.1.0/src/hone_flow/testing/contracts.py +131 -0
  101. hone_flow-0.1.0/src/hone_flow/testing/fakes.py +42 -0
  102. hone_flow-0.1.0/src/hone_flow/testing/memory.py +73 -0
  103. hone_flow-0.1.0/src/hone_flow/testing/webhooks.py +71 -0
  104. hone_flow-0.1.0/src/hone_flow/types.py +274 -0
  105. hone_flow-0.1.0/src/hone_flow/workflow.py +374 -0
  106. hone_flow-0.1.0/tests/__init__.py +0 -0
  107. hone_flow-0.1.0/tests/conftest.py +78 -0
  108. hone_flow-0.1.0/tests/contract/__init__.py +0 -0
  109. hone_flow-0.1.0/tests/contract/test_gpu_lease.py +59 -0
  110. hone_flow-0.1.0/tests/contract/test_record_sink.py +31 -0
  111. hone_flow-0.1.0/tests/contract/test_run_storage.py +150 -0
  112. hone_flow-0.1.0/tests/e2e/__init__.py +0 -0
  113. hone_flow-0.1.0/tests/e2e/song_video.py +64 -0
  114. hone_flow-0.1.0/tests/e2e/test_ac10_fork_diff.py +188 -0
  115. hone_flow-0.1.0/tests/e2e/test_ac11_dry_run_fork_plan.py +56 -0
  116. hone_flow-0.1.0/tests/e2e/test_ac12_fork_as_step_rerun.py +49 -0
  117. hone_flow-0.1.0/tests/e2e/test_ac13_gates_approve_edit.py +156 -0
  118. hone_flow-0.1.0/tests/e2e/test_ac14_reject_and_revise.py +118 -0
  119. hone_flow-0.1.0/tests/e2e/test_ac15_attempts.py +53 -0
  120. hone_flow-0.1.0/tests/e2e/test_ac16_pin_and_cleanup.py +160 -0
  121. hone_flow-0.1.0/tests/e2e/test_ac17_notifications.py +101 -0
  122. hone_flow-0.1.0/tests/e2e/test_ac18_notification_outage.py +164 -0
  123. hone_flow-0.1.0/tests/e2e/test_ac19_measurements_and_reports.py +104 -0
  124. hone_flow-0.1.0/tests/e2e/test_ac1_song_video.py +59 -0
  125. hone_flow-0.1.0/tests/e2e/test_ac20_spans_and_trace_linking.py +159 -0
  126. hone_flow-0.1.0/tests/e2e/test_ac21_read_api.py +129 -0
  127. hone_flow-0.1.0/tests/e2e/test_ac22_s3_via_fsspec.py +44 -0
  128. hone_flow-0.1.0/tests/e2e/test_ac23_gpu_batching_and_order.py +154 -0
  129. hone_flow-0.1.0/tests/e2e/test_ac24_cli.py +243 -0
  130. hone_flow-0.1.0/tests/e2e/test_ac25_definition_errors.py +118 -0
  131. hone_flow-0.1.0/tests/e2e/test_ac26_secrets.py +33 -0
  132. hone_flow-0.1.0/tests/e2e/test_ac2_run_folder_format.py +123 -0
  133. hone_flow-0.1.0/tests/e2e/test_ac30_progress.py +106 -0
  134. hone_flow-0.1.0/tests/e2e/test_ac31_final_steps.py +232 -0
  135. hone_flow-0.1.0/tests/e2e/test_ac32_produced_items.py +199 -0
  136. hone_flow-0.1.0/tests/e2e/test_ac33_previous_output.py +103 -0
  137. hone_flow-0.1.0/tests/e2e/test_ac34_select_steps.py +181 -0
  138. hone_flow-0.1.0/tests/e2e/test_ac35_read_api_for_browsers.py +126 -0
  139. hone_flow-0.1.0/tests/e2e/test_ac36_run_labels.py +135 -0
  140. hone_flow-0.1.0/tests/e2e/test_ac37_seed_and_actor_kind.py +69 -0
  141. hone_flow-0.1.0/tests/e2e/test_ac3_serializers_and_outputs.py +160 -0
  142. hone_flow-0.1.0/tests/e2e/test_ac4_params_context_seeds.py +94 -0
  143. hone_flow-0.1.0/tests/e2e/test_ac5_failure_and_resume.py +196 -0
  144. hone_flow-0.1.0/tests/e2e/test_ac6_crash_and_lease.py +211 -0
  145. hone_flow-0.1.0/tests/e2e/test_ac7_incompatible_resume.py +146 -0
  146. hone_flow-0.1.0/tests/e2e/test_ac8_partial_runs.py +61 -0
  147. hone_flow-0.1.0/tests/e2e/test_ac9_fork_refresh.py +111 -0
  148. hone_flow-0.1.0/tests/e2e/test_docs.py +139 -0
  149. hone_flow-0.1.0/tests/e2e/test_examples.py +65 -0
  150. hone_flow-0.1.0/tests/gpu/__init__.py +0 -0
  151. hone_flow-0.1.0/tests/gpu/test_ac28_ollama.py +83 -0
  152. hone_flow-0.1.0/tests/gpu/test_ac29_comfyui.py +72 -0
  153. hone_flow-0.1.0/tests/gpu/test_gpu_metrics.py +24 -0
  154. hone_flow-0.1.0/tests/integration/__init__.py +0 -0
  155. hone_flow-0.1.0/tests/integration/test_remote_runs.py +49 -0
  156. hone_flow-0.1.0/tests/integration/test_s3_storage.py +70 -0
  157. hone_flow-0.1.0/tests/integration/test_sqlite_concurrency.py +29 -0
  158. hone_flow-0.1.0/tests/unit/__init__.py +0 -0
  159. hone_flow-0.1.0/tests/unit/test_changelog_script.py +118 -0
  160. hone_flow-0.1.0/tests/unit/test_claude_files.py +146 -0
  161. hone_flow-0.1.0/tests/unit/test_claude_hooks.py +214 -0
  162. hone_flow-0.1.0/tests/unit/test_cli.py +47 -0
  163. hone_flow-0.1.0/tests/unit/test_dag.py +147 -0
  164. hone_flow-0.1.0/tests/unit/test_import_boundaries.py +19 -0
  165. hone_flow-0.1.0/tests/unit/test_invoke.py +68 -0
  166. hone_flow-0.1.0/tests/unit/test_metrics.py +88 -0
  167. hone_flow-0.1.0/tests/unit/test_records.py +114 -0
  168. hone_flow-0.1.0/tests/unit/test_run_format.py +152 -0
  169. hone_flow-0.1.0/tests/unit/test_serialize.py +92 -0
  170. hone_flow-0.1.0/tests/unit/test_spans.py +30 -0
  171. hone_flow-0.1.0/tests/unit/test_types.py +68 -0
  172. hone_flow-0.1.0/tests/unit/test_version.py +5 -0
@@ -0,0 +1,59 @@
1
+ # Virtual environments
2
+ .venv/
3
+ venv/
4
+ env/
5
+
6
+ # Python caches and build artefacts
7
+ __pycache__/
8
+ *.py[cod]
9
+ *.egg-info/
10
+ dist/
11
+ build/
12
+ .eggs/
13
+ wheels/
14
+
15
+ # Tool caches
16
+ .pytest_cache/
17
+ .ruff_cache/
18
+ .mypy_cache/
19
+ .pyright/
20
+ .hypothesis/
21
+ .tox/
22
+ .nox/
23
+
24
+ # Coverage
25
+ .coverage
26
+ .coverage.*
27
+ coverage.xml
28
+ htmlcov/
29
+
30
+ # Run folders and generated output
31
+ .hone/
32
+ out/
33
+ runs/
34
+ pinned_runs/
35
+ *.log
36
+
37
+ # Media produced by workflows
38
+ *.mp4
39
+ *.mov
40
+ *.webm
41
+ *.wav
42
+ *.mp3
43
+ *.flac
44
+ *.ogg
45
+
46
+ # Secrets
47
+ .env
48
+ .env.*
49
+ !.env.example
50
+
51
+ # Editors and OS
52
+ .idea/
53
+ .vscode/
54
+ *.swp
55
+ .DS_Store
56
+ Thumbs.db
57
+
58
+ # Claude Code: machine-specific settings
59
+ .claude/settings.local.json
@@ -0,0 +1,83 @@
1
+ # AGENTS.md: hone-flow
2
+
3
+ A brief for AI coding tools (Claude Code, Codex, Cursor and others) helping with this repository.
4
+ People follow the same rules; they are in [CONTRIBUTING.md](CONTRIBUTING.md).
5
+
6
+ ## What this is
7
+
8
+ `hone-flow` (import `hone_flow`) runs AI workflows of plain-function steps as self-contained run folders,
9
+ with resume, fork, partial runs and human gates. Read [design/current.md](design/current.md) before
10
+ changing behaviour; it is the design as it stands, and its §7 lists the guarantees the tests check. Why
11
+ the design looks like this: [design/changes/](design/changes/) and [design/decisions.md](design/decisions.md).
12
+
13
+ ## Commands
14
+
15
+ ```bash
16
+ uv sync --all-extras # install everything (dev included)
17
+ scripts/check.sh # all quality gates: lint, format, types, tests + coverage, build, wheel smoke test
18
+ uv run pytest # default suite (fast, offline, deterministic)
19
+ uv run pytest tests/e2e # acceptance cases only
20
+ scripts/gpu-lock.sh uv run pytest -m gpu # real-model tests, under the machine-wide GPU lock
21
+ uv run ruff check . && uv run ruff format .
22
+ uv run pyright # strict for src/
23
+ ```
24
+
25
+ ## Layout
26
+
27
+ ```text
28
+ src/hone_flow/
29
+ workflow.py Workflow, decorators, validation, run / open_run / runs / cleanup
30
+ dag.py types.py serialize.py invoke.py inputs.py DAG inference, user types, serializers, calling steps, input snapshots
31
+ storage.py LocalStorage, open_storage; fsspec_storage.py: FsspecStorage (extra s3)
32
+ run_format.py manifest / metadata / lease models (format_version "1", docs/run-format.md)
33
+ run_lease.py run lease: acquire, heartbeat, takeover
34
+ commit.py attempt commit (metadata.json last), retire, cleanup
35
+ executor.py order, GPU batching, failure isolation
36
+ schedule.py resume.py produced.py per-unit decisions, resume checks, items made by a step
37
+ run.py fork.py reviews.py history.py Run, fork diff, gates, listings / pin / cleanup
38
+ notifications.py Slack / Mattermost / Discord / HTTP webhooks, delivery states
39
+ metrics.py reports.py spans.py measurements, reports/, spans.jsonl
40
+ progress.py progress events: INFO logs and the on_event callback
41
+ leases.py GpuLease implementations; ports.py: the Protocols
42
+ adapters/ optional integrations, imported lazily
43
+ testing/ MemoryStorage, FakeGpuLease, WebhookServer, contract checkers
44
+ _tracing.py _records.py trace context, span sinks
45
+ tests/unit|contract|integration|e2e|gpu
46
+ docs/ user docs; every Python block is run by tests/e2e/test_docs.py
47
+ examples/ one explained, runnable example per concept (tests/e2e/test_examples.py)
48
+ design/ why and how: README, current.md, changes/, decisions.md, history/
49
+ ```
50
+
51
+ Run folders under `<storage>/<name>/runs/<run_id>/` are the only state: there is no database and no
52
+ cache.
53
+
54
+ ## Rules
55
+
56
+ 1. **Keep it simple**: the simplest code that passes the acceptance cases; no speculative abstractions;
57
+ complexity at most 10 per function, about 40 lines per function and 300 per module.
58
+ 2. **The core is useful alone**: it never imports another honeworks package or an optional extra at import
59
+ time; integrations go through the ports in `ports.py` and lazily imported adapters.
60
+ 3. **Explicit failure**: typed errors (`HoneFlowError` subclasses) with messages that say what to do.
61
+ 4. **Run folders**: self-contained (copies, not references); `metadata.json` written last; manifest writes
62
+ conditional and under the run lease; the format is versioned and documented in `docs/run-format.md`.
63
+ 5. **Records and secrets**: spans as in `docs/records.md`, in each run's `spans.jsonl`; never record
64
+ secrets or webhook URLs anywhere.
65
+ 6. **Determinism**: explicit seeds; `hashlib`, never `hash()`, for ids.
66
+ 7. **Tests first** for public behaviour; each acceptance case has a `tests/e2e/test_ac<N>_*` test; docs and
67
+ examples are executed by tests. Green means `scripts/check.sh` passes; never weaken a test to pass.
68
+ 8. **Real models** only through `scripts/gpu-lock.sh`; unload what you load.
69
+ 9. **Design changes** get a record in `design/changes/` first; small choices go into
70
+ `design/decisions.md`; update `design/current.md` when behaviour changes.
71
+ 10. **Git**: Conventional Commits, small commits; AI-written commits end with a `Co-Authored-By:` line.
72
+ Push a branch and open a pull request only when the user asks ("push", "ship it"). Inside that pull
73
+ request's flow, reviewing it on GitHub and pushing fixes the user asked for need no new request.
74
+ Never push to `main`, tag or publish unless the maintainer asks.
75
+
76
+ ## Workflow and tooling
77
+
78
+ One branch per task; a change record before a design change; tests first; the docs updated with the
79
+ code (the table in [`.claude/skills/sync-docs/SKILL.md`](.claude/skills/sync-docs/SKILL.md));
80
+ `scripts/check.sh` green; a pull request from
81
+ [`.github/pull_request_template.md`](.github/pull_request_template.md). Claude Code users get this flow
82
+ as skills, reviewer agents and hooks in [`.claude/`](.claude/); see [`CLAUDE.md`](CLAUDE.md). Other
83
+ tools: the skills are plain Markdown and can be followed as they are.
@@ -0,0 +1,158 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
5
+ [Semantic Versioning](https://semver.org/). Why the design changed is recorded in
6
+ [design/changes/](design/changes/).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2026-12-02
11
+
12
+ ### Added (from the demo apps, change records 0003-0009)
13
+ - Run labels ([0009](design/changes/0009-run-labels.md)): `wf.run(label=, description=)`,
14
+ `run.fork(label=, description=)`, `run.set_label(...)`, `ctx.set_run_label(...)`; optional manifest
15
+ keys `label` / `description`, `RunSummary.label` / `.description`, the `hone.flow.run.label` span
16
+ attribute, `label` in notification messages, `hone-flow run --label`, `hone-flow label RUN_ID TEXT`.
17
+ - Steps over all items ([0004](design/changes/0004-steps-over-all-items.md)): `@wf.final_step()`
18
+ (kind `final`, `partial_ok=`) receives `dict[item_id, output]` of item steps; `run.fork(refresh=
19
+ {"step": ["02"]})` and `hone-flow fork --refresh step=02` refresh a step for some items; the fork
20
+ reason `items_changed`; depth-first runs walk phases split at fan-in steps.
21
+ - Items from a step's output ([0005](design/changes/0005-items-from-a-step.md)): a global step
22
+ annotated `-> fk.Items` produces items; `@wf.step(per="<step>")` / `@wf.gate(per=...)` run per
23
+ produced item; optional manifest keys `items[].items_from` and `steps[].per`; the fork reason
24
+ `produced_item_changed`.
25
+ - Choosing which items continue mid-run ([0007](design/changes/0007-select-items-mid-run.md)):
26
+ `@wf.select_step()` returns the ids that continue (`fk.Selection(keep, reasons)`); the step state
27
+ `not_selected` (terminal, counts as done); `resume(items=[...])` refuses not-selected items.
28
+ - A revised producer receives its previous output
29
+ ([0006](design/changes/0006-previous-output-on-revise.md)): a parameter named `previous` (and
30
+ `ctx.previous_output()`) gives the step's latest rejected or replaced output.
31
+ - Seeds and who decided, in the records ([0010](design/changes/0010-seed-and-actor-kind-in-records.md)):
32
+ `hone.flow.seed` on run and step spans; `approve` / `edit` / `reject(..., automated=True)` (CLI
33
+ `--automated`) record `reviews[].actor_kind` and `hone.flow.gate.actor_kind`.
34
+ - Read API for browsers ([0008](design/changes/0008-read-api-for-browsers.md)):
35
+ `RunHistory.run_ids()` (no manifest read) and `RunHistory.summaries(run_ids)`, `Run.lease()` →
36
+ `fk.LeaseInfo`, optional storage methods `list_dir` / `size` / `read_range` (`fk.Entry`) on every
37
+ built-in storage with fallbacks in `hone_flow.storage`, and the optional manifest key `attempts`
38
+ (also `RunSummary.attempts`). `runs()` and `cleanup` no longer list every file recursively.
39
+ - Progress while a run runs ([0003](design/changes/0003-progress-while-a-run-runs.md)): `INFO` log
40
+ lines on the `hone_flow` logger and `on_event=` on `wf.run`, `run.resume` and `run.fork`
41
+ (`run_started` with the run id and location, step, lease and `run_finished` events).
42
+
43
+ First release. Design: [0002 run folders](design/changes/0002-run-folders.md), which supersedes the
44
+ unpublished [0001 initial design](design/changes/0001-initial-design.md).
45
+
46
+ ### Fixed (concurrent writers)
47
+ - `SqliteSpanSink` sets `busy_timeout` before switching to WAL and retries the switch briefly: when several
48
+ processes created the same fresh store at once, the switch ignored the timeout and a writer dropped its
49
+ spans ("database is locked").
50
+
51
+ ### Added (design history)
52
+ - `design/`: why hone-flow exists, the design today (`design/current.md`), one record per design change
53
+ (`design/changes/`), the implementation decisions and the early history; `CONTRIBUTING.md`.
54
+
55
+ The first 0.1.0 build (content-addressed asset store, SQLite metadata, automatic cross-run cache) was
56
+ never published and is replaced by the run-folder design. Why: design change
57
+ [0002 (run folders)](design/changes/0002-run-folders.md), which supersedes
58
+ [0001 (the first design)](design/changes/0001-initial-design.md); the design today is
59
+ [design/current.md](design/current.md). The entries below the redesign section describe that first build;
60
+ git history keeps its code.
61
+
62
+ ### Added (run-folder redesign)
63
+ - **Run folders** (`<storage>/<name>/runs/<run_id>/`): `manifest.json`, one folder per step (and item)
64
+ with `inputs/` snapshots (copies), `output/` with readable names (`<step>.json`, the file's own name
65
+ for `fk.File` / `fk.Dir`, `<output>.<extension>` for registered serializers) and `metadata.json`
66
+ written last as the commit marker; `spans.jsonl`; `reports/`. The format is versioned
67
+ (`format_version: "1"`), modelled in `run_format.py` and documented in `docs/run-format.md`.
68
+ - `fk.Workflow(name, *, storage, version, measure, notifications, order, fail_fast, gpu, sink)`;
69
+ `wf.run(items, params=, until=, items_filter=, seed=, trace=)` returns a `fk.Run`.
70
+ - `RunStorage` port with `fk.LocalStorage` (atomic writes, folder-lock conditional writes, read-only
71
+ hardlinked files), `fk.FsspecStorage` (extra `s3`: S3 / any fsspec URL, exclusive create on S3) and
72
+ `fk.testing.MemoryStorage`; `contracts.check_run_storage`.
73
+ - The run lease (`lease.json`: owner, host, pid, heartbeat every 10 s, 60 s TTL), takeover of stale
74
+ leases, `fk.RunLocked`; recovery after a crash (`interrupted` steps, uncommitted folders removed).
75
+ - `run.resume(until=, items=, trace=)`: pending, failed, interrupted, blocked and skipped work, as new
76
+ attempts; `fk.IncompatibleRun` when step versions would mix; source-change warnings.
77
+ - `run.fork(refresh=, items=, params=, dry_run=, trace=)` with the fork diff (`fk.ForkPlan`,
78
+ `fk.ForkPlanRow`: `refresh_requested`, `version_changed`, `source_changed`, `param_changed`,
79
+ `input_changed`, `workflow_version_changed`, `new_step`, `new_item`, `not_done_in_source`,
80
+ `downstream_of`); reused results are copied and labeled `reused` with `reused_from`.
81
+ - Gates: `run.approve` / `run.edit` / `run.reject` (reject-and-revise: the producer reruns with
82
+ `review_note`), attempts kept under `attempts/<n>/`, decisions in `reviews` and `hone.flow.gate` spans.
83
+ - Read API: `fk.open_runs(storage, name)` → `fk.RunHistory` (`runs(updated_since=)`, `open_run`,
84
+ `cleanup`), `fk.RunSummary`, `fk.StepRecord`, detached runs; `run.pin()` (verified copy to
85
+ `pinned_runs/`) and `cleanup(keep_last=, older_than=, dry_run=)` → `fk.CleanupReport`.
86
+ - Measurements (`measure=`: timing, output_sizes, cpu, memory, disk, gpu) and `reports/`.
87
+ - Notifications (`hone_flow.notifications`: `SlackWebhook`, `MattermostWebhook`, `DiscordWebhook`,
88
+ `HttpWebhook`): pending events committed before delivery, delivery states, `run.retry_notifications()`
89
+ → `fk.Delivery`; `fk.testing.WebhookServer`; webhook URLs are never recorded.
90
+ - The `hone-flow` CLI: `run`, `resume`, `fork` (`--dry-run`), `status`, `show`, `runs`, `approve`,
91
+ `edit`, `reject`, `pin`, `cleanup`, `notify-retry`, with `--json`, `--storage/--name` and exit codes.
92
+ - Twenty-one explained examples (`examples/`), the README and `docs/` rewritten, real-model tests
93
+ (AC-28 Ollama, AC-29 ComfyUI).
94
+
95
+ ### Changed (run-folder redesign)
96
+ - Package description: "Run AI workflows of plain-function steps as self-contained run folders, with
97
+ resume, fork, partial runs and human gates."
98
+ - `fk.Workflow(name, *, version="1", gpu=None)`: `version` is keyword-only; the workflow name must be a
99
+ safe folder name (`[A-Za-z0-9_.-]+`, not `.` / `..`), else `WorkflowDefinitionError`.
100
+ - `@wf.global_step` takes `outputs=` like `@wf.step`.
101
+ - The wheel smoke test runs `examples/quickstart.py` (the README quickstart).
102
+
103
+ ### Removed (run-folder redesign)
104
+ - `LocalAssetStore`, `FsspecAssetStore`, `SqliteMetaStore` (`stores/`), the `AssetStore` port,
105
+ `fk.testing.MemoryAssetStore` / `MemoryMetaStore`, `contracts.check_asset_store`.
106
+ - Cache keys, miss reasons and `wf.plan` (`cache.py`, `plan.py`); `cache=`, `cache_expiration`,
107
+ `strict_versions`; `fk.Select`, `fk.Plan`, `fk.PlanRow`, `fk.RunResult`, `fk.RunStatus`,
108
+ `fk.StepResult`.
109
+ - The old `wf.run` / `wf.status` / `wf.output`, `wf.rerun` (use `run.fork(refresh=...)`),
110
+ `wf.approve` / `edit` / `reject` (now on `Run`), `wf.export` (the run folder is the export), `wf.gc`
111
+ (now `cleanup`), `wf.pin` / `unpin` (now `run.pin()`), asset hooks (`wf.on_asset_committed` /
112
+ `on_asset_deleted`, `fk.AssetEvent`), `Workflow(store=, meta=, strict_versions=, metrics=,
113
+ metrics_interval=)` and the old executor.
114
+ - `fk.GateBlocked`, `fk.AssetNotFound`.
115
+ - The CLI commands `plan`, `export` and `gc`.
116
+ - The old acceptance tests, the old docs pages and the `respx` dev dependency.
117
+
118
+ ### Changed (working with the other honeworks packages, first build)
119
+ - A cached / reused pair whose step source changed without a version bump records the reason
120
+ `cache_hit; source_changed_version_unchanged` (or `reused_from_run:<id>; ...`), so the warning reaches
121
+ the span store, where hone-lens's `cache_health` detector reads it.
122
+
123
+ ### Added (first build)
124
+ - `Workflow` with `@wf.step`, `@wf.gate`, `@wf.global_step`; DAG inferred from parameter names;
125
+ `WorkflowDefinitionError` for unknown names, cycles and duplicates.
126
+ - Canonical JSON / Pydantic / `File` / `Dir` assets, `register_serializer`.
127
+ - `LocalAssetStore` (content-addressed, crash-safe writes) and `SqliteMetaStore` (WAL).
128
+ - Cache keys with explained miss reasons, `wf.plan`, breadth-/depth-first executor, failure isolation.
129
+ - `fk.Select` (`only`, `from_`, `until`, `items`, `force`, `refresh`), `cache=False`, source-change
130
+ warnings with `strict_versions`, `reused` labels for non-deterministic steps, `wf.rerun`.
131
+ - Gates: `wf.approve` / `wf.edit` / `wf.reject` with decisions and labels; rejection notes reach the
132
+ gated step as `review_note`. Asset hooks `wf.on_asset_committed` / `wf.on_asset_deleted`
133
+ (`fk.AssetEvent`). `wf.export(run_id, dir)`.
134
+ - Crash safety: runs and steps of killed processes are marked `interrupted` and resumed; scratch
135
+ folders of killed runs are removed; Ctrl-C marks the running step `interrupted`.
136
+ - Records: `hone.flow.run` / `hone.flow.step` / `hone.flow.gate` spans (the shared honeworks span format) in the caller's
137
+ trace (`wf.run(trace=...)`, `wf.rerun(..., trace=...)`, `fk.current_trace()`, `ctx.current_trace()`);
138
+ `SqliteSpanSink` (default), `JsonlSpanSink`, `MemorySink`, `NullSink`; secrets stripped; content capture
139
+ switch (`HONE_CAPTURE_CONTENT=0`).
140
+ - System metrics per step (psutil via extra `metrics`, NVML via extra `gpu`): summary attributes and
141
+ `metrics.sample` events; `Workflow(metrics=False, metrics_interval=...)`.
142
+ - GPU leases: batches of neighbouring `gpu:` steps hold one lease; `FileLockGpuLease`, `NullGpuLease`,
143
+ `Workflow(gpu="<entry point>")` through `hone.gpu_leases`; contract checkers `check_record_sink`.
144
+ - `FsspecAssetStore(url, cache_dir=..., storage_options=...)` (extra `s3`): S3 / any fsspec filesystem
145
+ with a hash-verified local read cache.
146
+ - `wf.gc(dry_run=...)`, `wf.pin` / `wf.unpin`; `on_asset_deleted` hooks fire on gc.
147
+ - `hone-flow` CLI (extra `cli`): `plan`, `run`, `status`, `show`, `approve`, `edit` ($EDITOR),
148
+ `reject`, `export`, `gc`, `runs`, `pin`, with `--json` and exit codes.
149
+ - `GateBlocked` for `only` selections below an unapproved gate; `refresh` gives seeded steps a new seed.
150
+ - Docs (README, guides, CLI and metadata-schema reference) and `examples/video_pipeline.py`, all executed
151
+ by tests; real-model tests for Ollama (AC-19), ComfyUI (AC-20, optional) and GPU metrics.
152
+
153
+ ### Fixed (first build)
154
+ - Skipped gates (rerun, `from_` / `only`) no longer bypass reviews; edits survive a gate rerunning;
155
+ strict mode keeps unchanged cache entries; `plan` shows `blocked_by_gate` behind a gate that will run.
156
+
157
+ [Unreleased]: https://github.com/honeworks/hone-flow/compare/v0.1.0...HEAD
158
+ [0.1.0]: https://github.com/honeworks/hone-flow/releases/tag/v0.1.0
@@ -0,0 +1,156 @@
1
+ # Contributing to hone-flow
2
+
3
+ Thank you for helping. This page covers how to set up, the rules the code follows, how it is tested and
4
+ how the design changes. The design itself is in [`design/`](design/README.md); start with
5
+ [`design/current.md`](design/current.md).
6
+
7
+ ## Setup and the quality gates
8
+
9
+ ```bash
10
+ uv sync --all-extras # install the package with every extra and the dev tools
11
+ scripts/check.sh # every quality gate; "green" means this exits 0
12
+ ```
13
+
14
+ `scripts/check.sh` runs ruff (lint and format), pyright (strict for `src/`), the default test suite with
15
+ branch coverage of at least 90% on `src/`, `uv build`, and a smoke test that installs the built wheel
16
+ alone in a fresh virtual environment and runs the README quickstart. Pull requests must keep it green.
17
+ Never weaken a test to make it pass.
18
+
19
+ Other useful commands:
20
+
21
+ ```bash
22
+ uv run pytest # default suite: fast, offline, deterministic
23
+ uv run pytest tests/e2e # the acceptance cases only
24
+ uv run ruff check . && uv run ruff format .
25
+ uv run pyright
26
+ scripts/gpu-lock.sh uv run pytest -m gpu # real-model tests (see below)
27
+ ```
28
+
29
+ ## Keep it simple
30
+
31
+ The first rule: **simple, easy to understand, maintainable and expandable.** When simplicity conflicts
32
+ with anything except correctness and the guarantees in [`design/current.md`](design/current.md#7-guarantees-acceptance-cases),
33
+ simplicity wins. A newcomer should be able to open any module, understand what it does in a few minutes
34
+ and change it safely.
35
+
36
+ 1. Build the simplest thing that passes the acceptance cases, not the most general thing.
37
+ 2. No speculative generality. Add an abstraction only when there are two real uses today, or the design
38
+ names it as an extension point (a port, a registry, an entry point).
39
+ 3. Extend through a few clear seams: the ports (`GpuLease`, `RecordSink`, `RunStorage`), the
40
+ `hone.gpu_leases` entry points, `fk.register_serializer`, and plain functions users pass in. Everything
41
+ else is ordinary concrete code.
42
+ 4. Plain Python first: functions and small dataclasses before classes, composition before inheritance,
43
+ the standard library before dependencies.
44
+ 5. Flat and explicit: short call chains, no metaclasses, import hooks, monkey-patching or deep decorator
45
+ stacks.
46
+ 6. One obvious way to configure and call each thing (for hone-flow: `Workflow(...)` arguments).
47
+ 7. Names over comments; comments say *why*.
48
+ 8. Delete freely: dead code, unused parameters and single-caller helper layers go.
49
+
50
+ Limits, checked in review (ruff enforces complexity):
51
+
52
+ | Thing | Limit |
53
+ |---|---|
54
+ | Cyclomatic complexity per function | 10 (`C901`) |
55
+ | Function length | about 40 lines |
56
+ | Module length | about 300 lines |
57
+ | Parameters per function | 6; group more into a small dataclass (the `Workflow` constructor is the one configuration point and the exception) |
58
+ | Inheritance depth of own classes | 1 |
59
+ | Variants | a dict of functions or a `match`, not a class hierarchy |
60
+ | Core dependencies | stdlib + pydantic; anything else is an optional extra, and a new one needs a written reason in `design/decisions.md` |
61
+
62
+ Avoid "manager / handler / processor" layers, base classes with one subclass, plugin systems beyond the
63
+ entry points, event buses and dependency-injection containers.
64
+
65
+ ## Code conventions
66
+
67
+ - Python 3.11 or newer; ruff with line length 110; pyright strict for `src/`; the public API is fully
68
+ typed and `py.typed` is shipped.
69
+ - The public API is exported from `src/hone_flow/__init__.py` with an explicit `__all__`; public functions
70
+ and classes have docstrings.
71
+ - **The core is useful alone.** It never imports another honeworks package or an optional extra at import
72
+ time; adapters live in `src/hone_flow/adapters/` and are imported lazily.
73
+ `tests/unit/test_import_boundaries.py` checks this.
74
+ - **Ports and adapters.** A port is a small `typing.Protocol` owned by hone-flow (`ports.py`); adapters
75
+ are injected as constructor arguments or found through entry points; every port has a fake in
76
+ `hone_flow.testing` and a contract checker in `hone_flow.testing.contracts`.
77
+ - **Explicit failure.** Never swallow errors silently. Errors crossing the public API are typed
78
+ (`HoneFlowError` and its subclasses in `errors.py`), and messages say what happened and what to do.
79
+ - **Run folders.** Every run folder is self-contained (copies, not references); `metadata.json` is written
80
+ last; manifest writes are conditional and happen under the run lease; the format is versioned
81
+ (`format_version`) and documented in [`docs/run-format.md`](docs/run-format.md). Adding optional keys
82
+ keeps the version; removing a key or changing its meaning needs a new version and a design change.
83
+ - **Records.** Spans follow [`docs/records.md`](docs/records.md) and go to each run's `spans.jsonl`.
84
+ Secrets (and webhook URLs) are never recorded in spans, manifests, metadata, reports or logs.
85
+ - **Determinism.** Seeds are explicit; use `hashlib`, never the built-in `hash()`, for ids.
86
+ - Time is `datetime.now(UTC)`, stored as ISO-8601 UTC; paths are `pathlib.Path`; logging goes to
87
+ `logging.getLogger("hone_flow")`, never `print` in library code.
88
+ - Secrets come only from environment variables.
89
+
90
+ ## Tests
91
+
92
+ | Suite | Folder | Runs by default | Purpose |
93
+ |---|---|---|---|
94
+ | Unit | `tests/unit/` | yes | each module's behaviour, edge cases and errors, with fakes |
95
+ | Contract | `tests/contract/` | yes | the ports' implementations and fakes pass the contract checkers |
96
+ | Integration | `tests/integration/` | yes | modules together with real local resources: the filesystem, subprocesses, a local S3 server (moto) |
97
+ | Acceptance | `tests/e2e/` | yes | the numbered guarantees of [`design/current.md`](design/current.md#7-guarantees-acceptance-cases), through the public API and CLI only |
98
+ | Real model | `tests/gpu/` | no | the same cases against real models on a local GPU |
99
+
100
+ - The default suite must stay fast, deterministic and offline.
101
+ - Every acceptance case has a test in `tests/e2e/` named `test_ac<N>_<slug>`, using only the public API or
102
+ CLI. An acceptance test must fail if its feature is removed.
103
+ - The README quickstart, every Python block in `docs/` and every file in `examples/` are run by the tests.
104
+ Each example opens with a What / How / Why docstring and is listed in `examples/README.md`.
105
+ - Test crash safety with a subprocess that is killed mid-write, and concurrency with two processes on one
106
+ run folder.
107
+ - Check records: span names and attributes, trace links across nested calls, the content-capture switch,
108
+ and that a planted fake secret appears nowhere.
109
+
110
+ ### Real-model tests and `scripts/gpu-lock.sh`
111
+
112
+ Real-model tests (`-m gpu`, plus `ollama` / `comfyui`) run only through `scripts/gpu-lock.sh`, which holds
113
+ one machine-wide lock (`$HONE_GPU_LOCK`, default `/tmp/honeworks-gpu.lock`) so that test runs from several
114
+ projects never share a small GPU at once. A session fixture in `tests/conftest.py` takes the same lock if
115
+ you run pytest directly. The tests check that Ollama or ComfyUI is up and skip with a reason when it is
116
+ not, and unload the models they loaded. Models are chosen with `HONE_TEST_OLLAMA_URL` and
117
+ `HONE_TEST_TEXT_MODEL`.
118
+
119
+ ## Changing the design
120
+
121
+ Design changes are written down before they are built:
122
+
123
+ 1. Write `design/changes/NNNN-<short-name>.md` with status `proposed` and the sections Status, Context,
124
+ Problem, Options, Decision, Consequences, and Migration and compatibility.
125
+ 2. The maintainer reviews it; the status becomes `accepted` (or `rejected`).
126
+ 3. Implement it from [`design/current.md`](design/current.md) and the accepted change records, tests
127
+ first.
128
+ 4. Update `design/current.md`, set the record to `implemented in <version>`, and add a `CHANGELOG.md`
129
+ entry that links to it.
130
+
131
+ Smaller implementation choices that need no change record go into
132
+ [`design/decisions.md`](design/decisions.md).
133
+
134
+ ## Pull requests
135
+
136
+ - One branch per change, named `<type>/<short-name>` after the Conventional Commit types (`feat/ftp-storage`).
137
+ - Fill in [`.github/pull_request_template.md`](.github/pull_request_template.md): what, why (issue and
138
+ change record), how it was tested, which docs changed, and the end of the `scripts/check.sh` output.
139
+ - claude[bot] reviews every pull request, with inline comments and suggested changes
140
+ ([`.github/workflows/claude-review.yml`](.github/workflows/claude-review.yml)); on a pull request from a
141
+ fork, the maintainer starts it with a `@claude review` comment. Answer each thread: agree and fix,
142
+ disagree with a reason, or ask. A thread is resolved when it is fixed or decided.
143
+ - `main` accepts changes only through pull requests, with CI green and every review thread resolved.
144
+ - The code owners in [`.github/CODEOWNERS`](.github/CODEOWNERS) are asked to review automatically.
145
+ - The maintainer merges.
146
+
147
+ ## Commits
148
+
149
+ - Conventional Commits (`feat:`, `fix:`, `test:`, `docs:`, `refactor:`, `chore:`, `build:`, `ci:`), a
150
+ subject of at most 72 characters, a body that explains why; one logical change per commit.
151
+ - Commits written with an AI tool end with a `Co-Authored-By:` line naming it.
152
+ - Never commit secrets, `.hone/`, model weights or large binaries.
153
+ - `CHANGELOG.md` follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
154
+
155
+ Contributors using AI coding tools will find a short brief for them in [`AGENTS.md`](AGENTS.md); Claude
156
+ Code users also get the whole workflow as skills, reviewer agents and hooks in [`.claude/`](.claude/).
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.