adk-ledger 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.

Potentially problematic release.


This version of adk-ledger might be problematic. Click here for more details.

Files changed (103) hide show
  1. adk_ledger-0.1.0/.gitignore +17 -0
  2. adk_ledger-0.1.0/CHANGELOG.md +55 -0
  3. adk_ledger-0.1.0/CONTRIBUTING.md +126 -0
  4. adk_ledger-0.1.0/LICENSE +202 -0
  5. adk_ledger-0.1.0/PKG-INFO +686 -0
  6. adk_ledger-0.1.0/README.md +660 -0
  7. adk_ledger-0.1.0/benchmarks/__init__.py +0 -0
  8. adk_ledger-0.1.0/benchmarks/bench_overhead.py +237 -0
  9. adk_ledger-0.1.0/docs/api.md +170 -0
  10. adk_ledger-0.1.0/docs/configuration.md +361 -0
  11. adk_ledger-0.1.0/docs/events.md +260 -0
  12. adk_ledger-0.1.0/docs/performance.md +103 -0
  13. adk_ledger-0.1.0/docs/telemetry.md +808 -0
  14. adk_ledger-0.1.0/examples/README.md +128 -0
  15. adk_ledger-0.1.0/examples/__init__.py +1 -0
  16. adk_ledger-0.1.0/examples/_common.py +171 -0
  17. adk_ledger-0.1.0/examples/adk_ledger.toml +58 -0
  18. adk_ledger-0.1.0/examples/all_features.py +228 -0
  19. adk_ledger-0.1.0/examples/budgets.py +125 -0
  20. adk_ledger-0.1.0/examples/cache_and_context.py +110 -0
  21. adk_ledger-0.1.0/examples/concierge/__init__.py +12 -0
  22. adk_ledger-0.1.0/examples/concierge/__main__.py +221 -0
  23. adk_ledger-0.1.0/examples/concierge/adk_ledger.toml +68 -0
  24. adk_ledger-0.1.0/examples/concierge/agent.py +164 -0
  25. adk_ledger-0.1.0/examples/concierge/knowledge.py +565 -0
  26. adk_ledger-0.1.0/examples/concierge/tools.py +306 -0
  27. adk_ledger-0.1.0/examples/cost_attribution.py +99 -0
  28. adk_ledger-0.1.0/examples/pyproject_config/__init__.py +1 -0
  29. adk_ledger-0.1.0/examples/pyproject_config/__main__.py +63 -0
  30. adk_ledger-0.1.0/examples/pyproject_config/agent.py +50 -0
  31. adk_ledger-0.1.0/examples/pyproject_config/pyproject.toml +47 -0
  32. adk_ledger-0.1.0/examples/quickstart.py +76 -0
  33. adk_ledger-0.1.0/examples/sdk_instrumentation.py +162 -0
  34. adk_ledger-0.1.0/examples/sinks_and_tags.py +101 -0
  35. adk_ledger-0.1.0/examples/tool_metering.py +78 -0
  36. adk_ledger-0.1.0/examples/zero_code.py +87 -0
  37. adk_ledger-0.1.0/mise.toml +104 -0
  38. adk_ledger-0.1.0/pyproject.toml +118 -0
  39. adk_ledger-0.1.0/src/adk_ledger/__init__.py +134 -0
  40. adk_ledger-0.1.0/src/adk_ledger/budgets/__init__.py +35 -0
  41. adk_ledger-0.1.0/src/adk_ledger/budgets/model.py +391 -0
  42. adk_ledger-0.1.0/src/adk_ledger/budgets/plugin.py +840 -0
  43. adk_ledger-0.1.0/src/adk_ledger/budgets/store.py +137 -0
  44. adk_ledger-0.1.0/src/adk_ledger/budgets/tracker.py +275 -0
  45. adk_ledger-0.1.0/src/adk_ledger/config.py +725 -0
  46. adk_ledger-0.1.0/src/adk_ledger/core/__init__.py +56 -0
  47. adk_ledger-0.1.0/src/adk_ledger/core/context.py +230 -0
  48. adk_ledger-0.1.0/src/adk_ledger/core/cost.py +79 -0
  49. adk_ledger-0.1.0/src/adk_ledger/core/events.py +274 -0
  50. adk_ledger-0.1.0/src/adk_ledger/core/extractors.py +55 -0
  51. adk_ledger-0.1.0/src/adk_ledger/core/meter.py +444 -0
  52. adk_ledger-0.1.0/src/adk_ledger/core/sinks.py +437 -0
  53. adk_ledger-0.1.0/src/adk_ledger/core/usage.py +131 -0
  54. adk_ledger-0.1.0/src/adk_ledger/cost/__init__.py +40 -0
  55. adk_ledger-0.1.0/src/adk_ledger/cost/_cache.py +36 -0
  56. adk_ledger-0.1.0/src/adk_ledger/cost/gcp.py +566 -0
  57. adk_ledger-0.1.0/src/adk_ledger/cost/litellm.py +266 -0
  58. adk_ledger-0.1.0/src/adk_ledger/cost/pricing.py +627 -0
  59. adk_ledger-0.1.0/src/adk_ledger/limits.py +497 -0
  60. adk_ledger-0.1.0/src/adk_ledger/py.typed +1 -0
  61. adk_ledger-0.1.0/src/adk_ledger/sinks/__init__.py +9 -0
  62. adk_ledger-0.1.0/src/adk_ledger/sinks/jsonl.py +153 -0
  63. adk_ledger-0.1.0/src/adk_ledger/sinks/otel.py +392 -0
  64. adk_ledger-0.1.0/src/adk_ledger/tokens/__init__.py +40 -0
  65. adk_ledger-0.1.0/src/adk_ledger/tokens/estimator.py +90 -0
  66. adk_ledger-0.1.0/src/adk_ledger/tokens/explicit.py +382 -0
  67. adk_ledger-0.1.0/src/adk_ledger/tokens/instrument.py +580 -0
  68. adk_ledger-0.1.0/src/adk_ledger/tokens/plugin.py +470 -0
  69. adk_ledger-0.1.0/src/adk_ledger/tokens/providers.py +185 -0
  70. adk_ledger-0.1.0/src/adk_ledger/tokens/usage.py +85 -0
  71. adk_ledger-0.1.0/src/adk_ledger/tools/__init__.py +7 -0
  72. adk_ledger-0.1.0/src/adk_ledger/tools/plugin.py +311 -0
  73. adk_ledger-0.1.0/tests/README.md +27 -0
  74. adk_ledger-0.1.0/tests/__init__.py +1 -0
  75. adk_ledger-0.1.0/tests/conftest.py +27 -0
  76. adk_ledger-0.1.0/tests/fixtures/cloud_billing_skus.json +2805 -0
  77. adk_ledger-0.1.0/tests/helpers.py +244 -0
  78. adk_ledger-0.1.0/tests/integration/__init__.py +0 -0
  79. adk_ledger-0.1.0/tests/integration/test_attribution.py +263 -0
  80. adk_ledger-0.1.0/tests/integration/test_budget_notify.py +453 -0
  81. adk_ledger-0.1.0/tests/integration/test_budget_plugin.py +624 -0
  82. adk_ledger-0.1.0/tests/integration/test_cache_context.py +547 -0
  83. adk_ledger-0.1.0/tests/integration/test_instrument_sdks.py +478 -0
  84. adk_ledger-0.1.0/tests/integration/test_lifecycle_edges.py +328 -0
  85. adk_ledger-0.1.0/tests/integration/test_plugin.py +290 -0
  86. adk_ledger-0.1.0/tests/integration/test_tools.py +160 -0
  87. adk_ledger-0.1.0/tests/smoke/__init__.py +0 -0
  88. adk_ledger-0.1.0/tests/smoke/test_concierge_agent.py +83 -0
  89. adk_ledger-0.1.0/tests/smoke/test_examples.py +70 -0
  90. adk_ledger-0.1.0/tests/unit/__init__.py +0 -0
  91. adk_ledger-0.1.0/tests/unit/test_budgets.py +388 -0
  92. adk_ledger-0.1.0/tests/unit/test_cloud_billing.py +581 -0
  93. adk_ledger-0.1.0/tests/unit/test_config.py +508 -0
  94. adk_ledger-0.1.0/tests/unit/test_core.py +268 -0
  95. adk_ledger-0.1.0/tests/unit/test_cost.py +447 -0
  96. adk_ledger-0.1.0/tests/unit/test_explicit.py +291 -0
  97. adk_ledger-0.1.0/tests/unit/test_instrument.py +320 -0
  98. adk_ledger-0.1.0/tests/unit/test_jsonl_sink.py +136 -0
  99. adk_ledger-0.1.0/tests/unit/test_litellm_prices.py +322 -0
  100. adk_ledger-0.1.0/tests/unit/test_otel_sink.py +313 -0
  101. adk_ledger-0.1.0/tests/unit/test_providers.py +321 -0
  102. adk_ledger-0.1.0/tests/unit/test_usage.py +83 -0
  103. adk_ledger-0.1.0/trivy.yaml +43 -0
@@ -0,0 +1,17 @@
1
+ .venv/
2
+ dist/
3
+ build/
4
+ *.egg-info/
5
+ __pycache__/
6
+ *.py[cod]
7
+ .pytest_cache/
8
+ .mypy_cache/
9
+ .ruff_cache/
10
+ .env
11
+ .DS_Store
12
+ .semgrep/
13
+ semgrep.json
14
+ semgrep.sarif
15
+ .adk_ledger/
16
+ AUDIT_FINDINGS.md
17
+ examples/pyproject_config/logs/
@@ -0,0 +1,55 @@
1
+ # Changelog
2
+
3
+ All notable changes to `adk-ledger` are recorded here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-10-31
10
+
11
+ First release.
12
+
13
+ ### Added
14
+
15
+ - **Token metering** for every LLM call an ADK agent makes (`TokenMeterPlugin`) and for direct
16
+ `google.genai`, `openai` and `anthropic` SDK calls — by auto-instrumentation
17
+ (`instrument_genai` / `instrument_openai` / `instrument_anthropic`, streaming included) or
18
+ explicitly (`record_response`, `track_llm_call`, `@meter_llm_call`, `record_usage`).
19
+ Exact counts from the provider's `usage_metadata`: prompt, output, cached, cache writes,
20
+ thoughts, per-modality. ADK-issued and direct calls are never double counted; direct calls
21
+ made inside a tool are attributed to the agent, session and user that ran it.
22
+ - **Cost attribution**, opt-in, on every event: Google's Cloud Billing catalog, the LiteLLM
23
+ price list, or your own `PriceTable`, composable; long-context tiers, cache discounts,
24
+ cache-write and per-modality rates, `savings` from caching. Unknown models are reported as
25
+ unpriced, never estimated.
26
+ - **Tool-call metering** (`ToolMeterPlugin`): latency, errors, retries / loops (`attempt`),
27
+ argument and result sizes, long-running tools.
28
+ - **Budgets** (`BudgetPlugin`): caps on tokens, cost, LLM calls or tool calls per global /
29
+ app / user / session / invocation / tag scope, optionally per calendar window; `warn`,
30
+ `block` (refuse the run, model call or tool call before it is made) or `raise`; dry-run;
31
+ optional user notices via the model or appended to the reply; `BudgetEvent`s to every sink.
32
+ - **Cache effectiveness and context-window pressure**: cache hit ratio, "configured but never
33
+ hits" detection, dollars saved; prompt size against the model's input window
34
+ (`context_limit`, `context_utilization`) with limits from the Gemini API, LiteLLM or an
35
+ explicit table.
36
+ - **Sinks**: `InMemorySink` (with per-model / agent / session aggregates), `JsonlSink`,
37
+ `OpenTelemetrySink` (metrics in the `adk_ledger.*` namespace with GenAI semantic-convention
38
+ attributes, plus span attributes), `CallbackSink`; any object with `emit()` / `close()` works.
39
+ - **Configuration-first set-up**: `adk_ledger.setup()` reads `adk_ledger.toml` / YAML /
40
+ `[tool.adk_ledger]` in `pyproject.toml` and `ADK_LEDGER_*` environment variables; every key
41
+ maps 1:1 onto the imperative API (`configure()` and the plugin constructors). Invalid
42
+ configuration fails at start-up with a `ConfigError` naming the key.
43
+ - **Tags**: `default_tags` and per-request `bind_tags()` on every event.
44
+ - **Extension points**: custom sinks, custom provider extractors (`BaseUsageExtractor`,
45
+ also via the `adk_ledger.extractors` entry point), optional pre-call token estimators.
46
+
47
+ ### Notes
48
+
49
+ - Events carry counts and identifiers only; prompt, response and tool payloads are never
50
+ recorded.
51
+ - Requires Python ≥ 3.13 and `google-adk` ≥ 2.12.
52
+
53
+ [Unreleased]: https://github.com/ravi-dalal/adk-ledger/compare/v0.1.0...HEAD
54
+ [0.1.0]: https://github.com/ravi-dalal/adk-ledger/releases/tag/v0.1.0
55
+
@@ -0,0 +1,126 @@
1
+ # Contributing to adk-ledger
2
+
3
+ Development set-up, the test and lint tasks, security scanning, and how releases are made.
4
+ For *using* the library see the [README](README.md) and [docs/](docs/).
5
+
6
+ ## Development
7
+
8
+ This project uses [`mise`](https://mise.jdx.dev) + [`uv`](https://docs.astral.sh/uv/).
9
+
10
+ ```bash
11
+ mise install && mise run install # Python 3.13 + uv + .venv
12
+ mise run test # pytest, all suites (no network needed)
13
+ mise run test-unit # tests/unit — pure functions, sinks, config, pricing
14
+ mise run test-integration # tests/integration — real ADK Runner + fake models
15
+ mise run test-smoke # tests/smoke — every example offline, adk web agent loads
16
+ mise run lint # ruff + mypy --strict
17
+ mise run format # ruff format
18
+ mise run build # uv build → dist/
19
+ mise run examples # every example, offline (no keys)
20
+ mise run web # adk web with the concierge agent; needs GOOGLE_API_KEY or Agent Platform (GOOGLE_GENAI_USE_ENTERPRISE) env vars
21
+ mise run bench # overhead benchmark -> docs/performance.md
22
+ mise run scan # Trivy: CVEs in uv.lock, secrets, dependency licences (needs `trivy` on PATH)
23
+ mise run semgrep # Semgrep: Python / GitHub-workflow / secrets rules (needs `semgrep` on PATH)
24
+ mise run security # both
25
+ mise run check # lint + test + build: what a release runs
26
+ ```
27
+
28
+ Run anything else inside the environment with `uv run <cmd>`.
29
+
30
+ ### Test layout
31
+
32
+ | suite | what it covers | needs |
33
+ |---|---|---|
34
+ | `tests/unit` | pure functions, sinks, config parsing, pricing math, extractors | nothing |
35
+ | `tests/integration` | a real ADK `Runner` / `App` with fake models; the real `google-genai` / `openai` / `anthropic` SDKs with patched transports | nothing |
36
+ | `tests/smoke` | every example runs offline (`ADK_LEDGER_EXAMPLE_OFFLINE=1`); the `adk web` agent loads | nothing |
37
+ | `test_live_catalog` (skipped by default) | the real Cloud Billing catalog | `ADK_LEDGER_LIVE_GCP=1` + ADC or `GOOGLE_CLOUD_API_KEY` |
38
+
39
+ Behavioural fixes come with a regression test that fails on the previous code. Two
40
+ `UserWarning`s from ADK (`[EXPERIMENTAL] feature … is enabled`) are expected in the test
41
+ output: ADK flags JSON-schema tool declarations and `ContextCacheConfig` as experimental.
42
+
43
+ ### Security scanning
44
+
45
+ CI runs the same Trivy scan on every push / PR and weekly
46
+ ([`security.yml`](.github/workflows/security.yml); the SARIF report is attached to each run as an artifact),
47
+ and the release workflow refuses to publish on HIGH/CRITICAL findings. Configuration is in
48
+ [`trivy.yaml`](trivy.yaml).
49
+
50
+ ## Publishing
51
+
52
+ ### Use it locally from another project
53
+
54
+ ```bash
55
+ # Editable install — edits in src/ are picked up immediately (best while developing)
56
+ uv add --editable /path/to/adk_ledger # consumer uses uv/pyproject
57
+ uv pip install -e /path/to/adk_ledger # or into any plain venv
58
+
59
+ # Install the built wheel — exactly what PyPI users get
60
+ mise run install-local /path/to/other/.venv
61
+
62
+ # Local "index": drop wheels in a folder and resolve by name
63
+ mise run build && mkdir -p ~/local-pypi && cp dist/* ~/local-pypi/
64
+ uv pip install --find-links ~/local-pypi adk-ledger
65
+ ```
66
+
67
+ ### Release to PyPI (manual)
68
+
69
+ 1. Bump `version` in `pyproject.toml` and `src/adk_ledger/__init__.py` (PyPI never accepts the same version twice).
70
+ 2. Create an API token at <https://test.pypi.org/manage/account/token/> and
71
+ <https://pypi.org/manage/account/token/> (scope it to the project after the first upload).
72
+ 3. Dry-run on TestPyPI, then verify the install:
73
+
74
+ ```bash
75
+ UV_PUBLISH_TOKEN=pypi-… mise run publish-test # lint + test + clean build + upload
76
+ uv pip install --index-url https://test.pypi.org/simple/ \
77
+ --extra-index-url https://pypi.org/simple/ adk-ledger
78
+ ```
79
+
80
+ 4. Publish for real:
81
+
82
+ ```bash
83
+ UV_PUBLISH_TOKEN=pypi-… mise run publish
84
+ ```
85
+
86
+ 5. Tag and push: `git tag v0.1.0 && git push --tags`.
87
+
88
+ ### Release to PyPI (GitHub Actions, Trusted Publishing)
89
+
90
+ [`.github/workflows/release.yml`](.github/workflows/release.yml) lints, tests, builds and
91
+ uploads on every `v*` tag using OIDC — no token to store.
92
+
93
+ One-time setup:
94
+
95
+ 1. On PyPI → *Account settings → Publishing → Add a new pending publisher*:
96
+ project `adk-ledger`, your GitHub owner, repo `adk-ledger`, workflow `release.yml`, environment `pypi`.
97
+ 2. On GitHub → *Settings → Environments* → create `pypi` (add required reviewers for an approval gate).
98
+ 3. The workflow must live at the **repository root** `.github/workflows/`; if this folder sits
99
+ inside a monorepo, move it there and set `defaults.run.working-directory` (see the comment in the file).
100
+
101
+ Per release:
102
+
103
+ ```bash
104
+ # bump version in pyproject.toml, commit, then
105
+ git tag v0.1.0 && git push origin v0.1.0
106
+ ```
107
+
108
+ The workflow fails fast if the tag doesn't match `project.version`.
109
+
110
+ ### Pre-flight checklist
111
+
112
+ - Project name is free on PyPI (<https://pypi.org/project/adk-ledger/>).
113
+ - `examples/` and `tests/` ship in the sdist — no `.env` files or keys in there.
114
+ - `LICENSE` is present and listed in `license-files` (bundled into the wheel).
115
+ - `mise run check` is green.
116
+ - `CHANGELOG.md` has an entry for the version.
117
+
118
+ ## Roadmap ideas
119
+
120
+ - Budget stores for Redis / ADK session state
121
+ - Estimator-based budget reservation
122
+ - Cache lifecycle metrics from explicit-cache refreshes
123
+ - Claude-on-Agent-Platform SKUs in the Cloud Billing parser
124
+ - BigQuery / Prometheus sinks
125
+ - Invocation-level trajectory metrics
126
+
@@ -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.