jev-align 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 (37) hide show
  1. jev_align-0.1.0/.github/workflows/publish.yml +60 -0
  2. jev_align-0.1.0/.gitignore +12 -0
  3. jev_align-0.1.0/AGENTS.md +358 -0
  4. jev_align-0.1.0/LICENSE +201 -0
  5. jev_align-0.1.0/Makefile +59 -0
  6. jev_align-0.1.0/PKG-INFO +169 -0
  7. jev_align-0.1.0/README.md +133 -0
  8. jev_align-0.1.0/jev-align +2 -0
  9. jev_align-0.1.0/pyproject.toml +58 -0
  10. jev_align-0.1.0/src/jev_align/__init__.py +13 -0
  11. jev_align-0.1.0/src/jev_align/acquisition.py +80 -0
  12. jev_align-0.1.0/src/jev_align/backends.py +101 -0
  13. jev_align-0.1.0/src/jev_align/capture.py +183 -0
  14. jev_align-0.1.0/src/jev_align/captured_inputs.py +127 -0
  15. jev_align-0.1.0/src/jev_align/cli.py +2561 -0
  16. jev_align-0.1.0/src/jev_align/data.py +197 -0
  17. jev_align-0.1.0/src/jev_align/jev.py +173 -0
  18. jev_align-0.1.0/src/jev_align/metrics.py +156 -0
  19. jev_align-0.1.0/src/jev_align/models.py +503 -0
  20. jev_align-0.1.0/src/jev_align/optimizer.py +482 -0
  21. jev_align-0.1.0/src/jev_align/persistence.py +147 -0
  22. jev_align-0.1.0/src/jev_align/runtime.py +132 -0
  23. jev_align-0.1.0/src/jev_align/sample_data/agent-traces.csv +501 -0
  24. jev_align-0.1.0/src/jev_align/sample_data/hn-stories.csv +8404 -0
  25. jev_align-0.1.0/src/jev_align/sample_data/support-tickets.csv +501 -0
  26. jev_align-0.1.0/src/jev_align/session.py +589 -0
  27. jev_align-0.1.0/tests/test_backends.py +53 -0
  28. jev_align-0.1.0/tests/test_capture_learning.py +520 -0
  29. jev_align-0.1.0/tests/test_cli.py +963 -0
  30. jev_align-0.1.0/tests/test_core.py +214 -0
  31. jev_align-0.1.0/tests/test_gepa_api.py +36 -0
  32. jev_align-0.1.0/tests/test_jev.py +55 -0
  33. jev_align-0.1.0/tests/test_optimizer.py +475 -0
  34. jev_align-0.1.0/tests/test_persistence.py +118 -0
  35. jev_align-0.1.0/tests/test_runtime.py +288 -0
  36. jev_align-0.1.0/tests/test_session.py +459 -0
  37. jev_align-0.1.0/uv.lock +4612 -0
@@ -0,0 +1,60 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ concurrency:
8
+ group: publish-pypi
9
+ cancel-in-progress: false
10
+
11
+ jobs:
12
+ publish:
13
+ name: Build and publish
14
+ runs-on: ubuntu-latest
15
+ environment:
16
+ name: pypi
17
+ url: https://pypi.org/p/jev-align
18
+ permissions:
19
+ contents: read
20
+ id-token: write
21
+
22
+ steps:
23
+ - name: Check out the release tag
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Install uv
27
+ uses: astral-sh/setup-uv@v7
28
+ with:
29
+ enable-cache: true
30
+
31
+ - name: Install Python
32
+ run: uv python install 3.11
33
+
34
+ - name: Verify tag matches package version
35
+ shell: bash
36
+ run: |
37
+ package_version="$(uv version --short)"
38
+ tag_version="${GITHUB_REF_NAME#v}"
39
+ if [[ "${GITHUB_REF_NAME}" != v* || "${tag_version}" != "${package_version}" ]]; then
40
+ echo "Release tag ${GITHUB_REF_NAME} does not match package version ${package_version}."
41
+ exit 1
42
+ fi
43
+
44
+ - name: Install development dependencies
45
+ run: uv sync --locked --extra dev --python 3.11
46
+
47
+ - name: Run tests
48
+ run: uv run --no-active --quiet pytest
49
+
50
+ - name: Run lint
51
+ run: uv run --no-active --quiet ruff check src tests
52
+
53
+ - name: Build distributions
54
+ run: uv build
55
+
56
+ - name: Check distribution metadata
57
+ run: uvx twine check dist/*
58
+
59
+ - name: Publish distributions
60
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,12 @@
1
+ .DS_Store
2
+ .coverage
3
+ .env
4
+ .env.*
5
+ !.env.example
6
+ .envrc
7
+ .jev-align/
8
+ .pytest_cache/
9
+ .venv/
10
+ __pycache__/
11
+ *.py[cod]
12
+ dist/
@@ -0,0 +1,358 @@
1
+ # AGENTS.md
2
+
3
+ This repository contains `jev-align`, an interactive active-learning CLI for
4
+ building AI Functions from a user's judgments. Coding agents may help configure
5
+ and operate the workflow, but must preserve the human labeling loop.
6
+
7
+ ## Installation reference
8
+
9
+ Requires Python 3.11 or newer. For a released build, prefer an isolated CLI
10
+ installation:
11
+
12
+ ```shell
13
+ uv tool install jev-align
14
+ # Without uv:
15
+ pip install jev-align
16
+ ```
17
+
18
+ From a local checkout, use `uv tool install .`; after pulling or changing the
19
+ source, refresh it with `uv tool install --force .`. To install straight from
20
+ GitHub, use `uv tool install "git+https://github.com/sutro-sh/jev-align.git"`.
21
+ For editable development, run `uv sync --extra dev` and launch with
22
+ `uv run jeva`.
23
+
24
+ Both `jeva` and `jev-align` invoke the same CLI. Interactive, non-editable
25
+ installs check PyPI for newer releases at startup. In virtual environments the
26
+ updater prefers `uv pip` when available and falls back to that environment's
27
+ Python and pip. Set `JEVA_DISABLE_UPDATE_CHECK=1` to disable the check.
28
+
29
+ ## Operating the CLI for a user
30
+
31
+ ### Core rule
32
+
33
+ The user supplies every label. Do not skip examples, silently infer labels, or
34
+ accept an optimized definition on the user's behalf. A rationale is optional,
35
+ but encourage one when it explains an important boundary or corrects the
36
+ model's reasoning.
37
+
38
+ ### Before starting
39
+
40
+ 1. Confirm that `TYPESAFE_API_KEY` is available.
41
+ 2. Confirm a reflection provider is configured: `OPENAI_API_KEY`,
42
+ `ANTHROPIC_API_KEY`/`CLAUDE_API_KEY`, `GEMINI_API_KEY`, or the endpoint and
43
+ credentials required by a custom LiteLLM provider.
44
+ 3. Identify the intended CSV, Parquet, or JSONL file without modifying it.
45
+ 4. Establish the question, task type, input columns, and labels or score levels.
46
+ 5. If any choice would materially change the task semantics, ask the user.
47
+
48
+ Never display secret values. It is enough to report whether a required key is
49
+ configured.
50
+
51
+ ### Starting a run
52
+
53
+ Use the guided home screen when the user wants to choose interactively:
54
+
55
+ ```shell
56
+ jeva
57
+ ```
58
+
59
+ Use flags when the setup is already known:
60
+
61
+ ```shell
62
+ jeva optimize DATA \
63
+ --question "QUESTION" \
64
+ --column COLUMN
65
+ ```
66
+
67
+ Relevant task shapes:
68
+
69
+ - Binary: provide `--question`; optionally add concrete `--true-criteria` and
70
+ `--false-criteria`.
71
+ - Multiclass: repeat `--class "NAME=DESCRIPTION"` for mutually exclusive
72
+ labels.
73
+ - Multilabel: repeat `--class "NAME=DESCRIPTION"` and add `--multilabel`.
74
+ - Score: repeat `--score-level "DESCRIPTION"` in lowest-to-highest order.
75
+
76
+ The installed package includes preconfigured Hacker News, support-ticket, and
77
+ agent-trace examples. The guided dataset picker lists those first, followed by
78
+ CSV, Parquet, and JSONL files discovered below the current directory.
79
+
80
+ Use `--batch-size` to choose the number of training annotations per round. The
81
+ guided Advanced menu offers 5, 10, 15, or 20. Add `--holdout` only when the user
82
+ wants a 20% reserved evaluation split; this adds 20% extra held-out annotations
83
+ per round. Advanced also configures maximum GEPA metric calls, which defaults to
84
+ 300. For scripted runs, use `--max-metric-calls`; `--metric-budget` remains an
85
+ alias.
86
+
87
+ Use `--all-columns-concatenated` only when every field is useful. Prefer
88
+ explicit `--column` values when IDs, timestamps, or metadata could distract the
89
+ evaluator. The normal default is the first 1,000 rows or all rows for a smaller
90
+ dataset; only set `--pool-size` when the user wants a different limit.
91
+
92
+ Run the CLI in a real PTY when possible so arrow-key menus, progress displays,
93
+ and prompts work correctly.
94
+
95
+ ### Reflection providers
96
+
97
+ GEPA's reflection model is separate from the TypeSafe JEV evaluation model.
98
+ Reflection uses LiteLLM model identifiers. OpenAI, Anthropic, and Gemini are
99
+ listed automatically when their standard keys are present. For another
100
+ provider, pass `--reflection-model provider/model`; in the wizard select
101
+ **Choose a different model** and then **Enter a custom LiteLLM model**.
102
+
103
+ Fireworks example:
104
+
105
+ ```shell
106
+ export FIREWORKS_API_KEY="..."
107
+ jeva optimize DATA \
108
+ --question "QUESTION" \
109
+ --column COLUMN \
110
+ --reflection-model \
111
+ "fireworks_ai/accounts/fireworks/models/llama-v3p1-8b-instruct"
112
+ ```
113
+
114
+ For a local or hosted vLLM server exposing an OpenAI-compatible `/v1` API:
115
+
116
+ ```shell
117
+ export HOSTED_VLLM_API_BASE="http://localhost:8000/v1"
118
+ export HOSTED_VLLM_API_KEY="..." # Omit when the endpoint has no authentication.
119
+ jeva optimize DATA \
120
+ --question "QUESTION" \
121
+ --column COLUMN \
122
+ --reflection-model "hosted_vllm/Qwen/Qwen3-8B"
123
+ ```
124
+
125
+ For a generic OpenAI-compatible endpoint:
126
+
127
+ ```shell
128
+ export OPENAI_API_BASE="http://localhost:8000/v1"
129
+ export OPENAI_API_KEY="local" # Replace when the endpoint requires a real key.
130
+ jeva optimize DATA \
131
+ --question "QUESTION" \
132
+ --column COLUMN \
133
+ --reflection-model "openai/Qwen/Qwen3-8B"
134
+ ```
135
+
136
+ The provider/model identifier and environment variables must follow the
137
+ [LiteLLM provider configuration](https://docs.litellm.ai/docs/providers).
138
+ `TYPESAFE_API_KEY` remains required for JEV evaluation.
139
+
140
+ ### Labeling rounds
141
+
142
+ For each displayed item:
143
+
144
+ 1. Relay the content and choices clearly if the user cannot see the terminal.
145
+ 2. Mention its uncertainty and whether it is a random audit sample.
146
+ 3. Ask the user for the label.
147
+ 4. Ask for an optional rationale, especially on ambiguous or surprising cases.
148
+ 5. Enter exactly what the user chose.
149
+
150
+ Held-out cards are explicitly marked. Collect their labels normally, but never
151
+ reuse their labels or rationales to guide task wording. The CLI keeps them out
152
+ of GEPA and reports their score separately.
153
+
154
+ There is no skip action. At the label picker, `b` removes the previous answer
155
+ and moves backward. At the rationale prompt, `/back` returns to the current
156
+ label picker; a literal `b` is valid rationale text. At the first item of a
157
+ later round, `b` can rewind the prior optimization round after confirmation.
158
+
159
+ For multilabel tasks, use Up/Down to navigate, Space to toggle, and Enter to
160
+ confirm. An empty selection is a valid judgment.
161
+
162
+ ### Reviewing a GEPA proposal
163
+
164
+ After optimization, summarize for the user:
165
+
166
+ - The task metric before and after.
167
+ - The fixed-pool certainty before and after.
168
+ - Any regression, even when the task metric improved.
169
+ - The material changes in the proposed definition.
170
+
171
+ Then ask the user whether to accept, reject, or quit and resume later. Do not
172
+ treat a higher training score as automatic approval. The score uses accumulated
173
+ labels and is not a held-out generalization estimate.
174
+
175
+ ### Existing runs
176
+
177
+ Browse saved AI Functions with:
178
+
179
+ ```shell
180
+ jeva functions
181
+ ```
182
+
183
+ Resume a known run directly with:
184
+
185
+ ```shell
186
+ jeva optimize --resume .jev-align/runs/RUN_ID
187
+ ```
188
+
189
+ Saved state, labels, prediction caches, GEPA artifacts, and rewind archives live
190
+ inside the run directory. Treat them as application state: do not hand-edit,
191
+ delete, or replace them. If a run is pending at the proposal screen, resume that
192
+ decision rather than starting another optimization.
193
+
194
+ Running an accepted function on another dataset writes JSONL results to
195
+ `.jev-align/outputs/` without changing the saved function.
196
+
197
+ ### Continual learning from live calls
198
+
199
+ Applications can call an accepted AI Function and record uncertain or randomly
200
+ audited predictions for later human labeling. Install `jev-align` in the
201
+ application environment and load the saved run with capture enabled:
202
+
203
+ ```python
204
+ from jev_align import AIFunction
205
+
206
+ is_aviation = AIFunction.load(
207
+ ".jev-align/runs/RUN_ID",
208
+ capture=True,
209
+ )
210
+
211
+ prediction = is_aviation(
212
+ title="Airport expansion",
213
+ text="A new runway opens next year.",
214
+ )
215
+ ```
216
+
217
+ Calls must use the input columns configured for the saved run and return a
218
+ normalized `Prediction`, not a human label. Capture adds no model call and writes
219
+ selected observations to `.jev-align/captures/` in the background. A recorder
220
+ created by `capture=True` is flushed automatically at process shutdown. Call the
221
+ AI Function's `close()` method or use it as a context manager when deterministic
222
+ shutdown is required. This integration is currently synchronous.
223
+
224
+ To continue learning, run `jeva functions`, open the matching AI Function, and
225
+ select **Resume learning**, or run:
226
+
227
+ ```shell
228
+ jeva optimize --resume .jev-align/runs/RUN_ID
229
+ ```
230
+
231
+ When the CLI offers newly captured calls, let the user decide whether to import
232
+ them. Every unique eligible call is imported; there is no capture-pool row cap.
233
+ The model's recorded prediction is never treated as truth. The user must label
234
+ every selected example, with an optional rationale, before GEPA can learn from
235
+ it. Previously labeled captures remain in the evaluation pool, while only
236
+ unlabeled inputs are eligible for another annotation batch.
237
+
238
+ The accepted definition is loaded when `AIFunction.load(...)` runs. Restart the
239
+ process or reload the AI Function to use a newly accepted version.
240
+ Use `JEVA_CAPTURE_DIR` when the application and CLI need to share a capture
241
+ directory outside the workspace.
242
+
243
+ `AIFunction` applies the saved run's column selection, normalization, and
244
+ concatenation. Its return value is a provider-neutral `Prediction`: binary tasks
245
+ expose `probability`, multiclass tasks `choice` and `confidence`, multilabel
246
+ tasks `label_probabilities`, and score tasks `score` and `confidence`. Runtime
247
+ calls require `TYPESAFE_API_KEY`, but not a reflection-model key. Pending
248
+ proposals are never loaded. A run with no accepted proposal uses its seed
249
+ definition.
250
+
251
+ Capture makes no additional JEV request and does not retry evaluations. By
252
+ default it records predictions with ambiguity of at least 0.8 and a random 5%
253
+ audit of the remainder. For binary tasks, 0.8 ambiguity corresponds to
254
+ probabilities from 0.4 through 0.6. Each record includes the evaluated input,
255
+ prediction, definition, model provenance, and selection reason, but none of
256
+ those values constitute a human label.
257
+
258
+ Capture uses JSONL files under `.jev-align/captures/`; it requires no database or
259
+ server. Records enter a bounded queue and a background thread writes batches of
260
+ up to 64, flushing about every 250 ms. Defaults are 256 queued records, 64 KiB
261
+ per record, and 64 MiB per capture file. Full queues, oversized records, and
262
+ exhausted file budgets increment `dropped`. Disk errors disable that writer, log
263
+ one warning, and populate `error` without failing successful predictions. Limits
264
+ and files are per `Capture` instance, so create one inside each worker after
265
+ forking. For custom thresholds or storage settings, pass a configured
266
+ `Capture(...)` instance instead of `capture=True`; the caller then owns and must
267
+ close it. Existing files are not rotated or deleted automatically. Closing drains
268
+ the queue for up to five seconds; abrupt shutdown can lose buffered records.
269
+
270
+ On resume, the CLI searches `.jev-align/captures/` in the current workspace and
271
+ the run workspace, plus `JEVA_CAPTURE_DIR` when configured. It imports complete,
272
+ matching records already on disk, deduplicates repeated inputs, excludes the
273
+ original and holdout datasets, and ignores malformed, partial, or over-1-MiB
274
+ lines. Discovery itself makes no API call. Approved captured inputs are also
275
+ stored in the run's `captured-inputs.json`, so removing the raw logs does not
276
+ remove them from that run.
277
+
278
+ Captured inputs use the normal full-pool evaluation, prediction cache, and batch
279
+ selection. Human labels from captures join training, while the original pool and
280
+ holdout remain fixed. Reports show captured-pool uncertainty separately so the
281
+ original fixed-pool history remains comparable. Pending GEPA proposals must be
282
+ resolved before importing new captures, and every new proposal still requires
283
+ explicit human acceptance.
284
+
285
+ ## Helping develop the repository
286
+
287
+ The main modules are:
288
+
289
+ - `src/jev_align/cli.py`: interactive flows, rendering, and commands.
290
+ - `src/jev_align/session.py`: round lifecycle, caching, rewind, and decisions.
291
+ - `src/jev_align/optimizer.py`: GEPA integration and task metrics.
292
+ - `src/jev_align/backends.py`: provider-neutral backend contract and factory.
293
+ - `src/jev_align/jev.py`: TypeSafe JEV adapter.
294
+ - `src/jev_align/models.py`: persisted schemas and normalized predictions.
295
+ - `src/jev_align/persistence.py`: run and label storage.
296
+ - `src/jev_align/runtime.py`: synchronous callable interface for saved functions.
297
+ - `src/jev_align/capture.py`: bounded, best-effort JSONL capture of live predictions.
298
+ - `src/jev_align/captured_inputs.py`: discovery and deduplication of captured inputs.
299
+
300
+ Capture files are unlabeled observations, not run state. Never treat their model
301
+ predictions as human labels. Resuming a saved function offers to import matching
302
+ captured calls from the current or run workspace's `.jev-align/captures/` and
303
+ optional `JEVA_CAPTURE_DIR`. Resolve pending proposals first. Approved inputs
304
+ are persisted in `captured-inputs.json` inside the run; treat this as application
305
+ state. Human labels from captures join training, while the original fixed pool
306
+ and holdout remain unchanged. Keep capture writes off the evaluation path and
307
+ preserve bounded queues, file-size limits, and nonblocking overflow behavior.
308
+ Original and captured pools share evaluation, prediction caching, and batch
309
+ selection. Every unique eligible captured input remains in the active evaluation
310
+ pool, including every labeled input. Filter labeled inputs only when selecting
311
+ the next annotation batch. Report captured-pool uncertainty separately so
312
+ original fixed-pool history stays comparable.
313
+
314
+ TypeSafe JEV is currently the only included evaluation backend. Runs persist a
315
+ provider-neutral backend configuration so additional adapters can be added;
316
+ `--jev-model` remains a compatibility alias for `--backend-model`.
317
+
318
+ Preserve these product invariants when making changes:
319
+
320
+ - The human explicitly confirms every label.
321
+ - Proposed prompts are shown as a diff before acceptance.
322
+ - The accepted candidate seeds the next optimization round.
323
+ - Full-pool uncertainty remains comparable across rounds.
324
+ - Old run state remains loadable through explicit migrations.
325
+ - Backends must declare supported task types and usable uncertainty signals.
326
+ - Provider-specific SDK objects do not cross the backend boundary.
327
+
328
+ Before handing off a code change, run:
329
+
330
+ ```shell
331
+ uv run --no-active --quiet pytest
332
+ uv run --no-active --quiet ruff check src tests
333
+ ```
334
+
335
+ Do not perform live API evaluations unless the user explicitly asks; the normal
336
+ test suite is designed to run without them.
337
+
338
+ ## Publishing a release
339
+
340
+ `pyproject.toml` is the authoritative version source. Prepare a release with:
341
+
342
+ ```shell
343
+ uv version 0.1.0
344
+ git add pyproject.toml uv.lock
345
+ git commit -m "release 0.1.0"
346
+ make release VERSION=0.1.0
347
+ ```
348
+
349
+ The Make target requires a clean worktree, verifies the configured version,
350
+ runs tests and lint, builds both distributions, and runs `twine check`. It then
351
+ pushes an annotated `v<VERSION>` tag and creates a GitHub Release with generated
352
+ notes. Publishing is not performed from the developer machine.
353
+
354
+ Publishing the GitHub Release triggers `.github/workflows/publish.yml`. The
355
+ workflow repeats validation from the tagged commit and publishes through PyPI
356
+ Trusted Publishing. Its PyPI publisher must be configured for the
357
+ `sutro-sh/jev-align` repository, `publish.yml` workflow, and `pypi` environment.
358
+ No PyPI token should be added to the repository or GitHub secrets.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.