021-python-clients 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 (40) hide show
  1. 021_python_clients-0.1.0/.gitignore +8 -0
  2. 021_python_clients-0.1.0/CHANGELOG.md +41 -0
  3. 021_python_clients-0.1.0/CONTRACT.md +163 -0
  4. 021_python_clients-0.1.0/CONTRIBUTING.md +101 -0
  5. 021_python_clients-0.1.0/LICENSE +202 -0
  6. 021_python_clients-0.1.0/PKG-INFO +327 -0
  7. 021_python_clients-0.1.0/README.md +294 -0
  8. 021_python_clients-0.1.0/pyproject.toml +80 -0
  9. 021_python_clients-0.1.0/src/clients_021/__init__.py +22 -0
  10. 021_python_clients-0.1.0/src/clients_021/_aws.py +55 -0
  11. 021_python_clients-0.1.0/src/clients_021/_observe.py +106 -0
  12. 021_python_clients-0.1.0/src/clients_021/email/__init__.py +16 -0
  13. 021_python_clients-0.1.0/src/clients_021/email/_message.py +77 -0
  14. 021_python_clients-0.1.0/src/clients_021/email/resend.py +143 -0
  15. 021_python_clients-0.1.0/src/clients_021/email/ses.py +119 -0
  16. 021_python_clients-0.1.0/src/clients_021/errors.py +20 -0
  17. 021_python_clients-0.1.0/src/clients_021/http.py +131 -0
  18. 021_python_clients-0.1.0/src/clients_021/httpx2.py +93 -0
  19. 021_python_clients-0.1.0/src/clients_021/kms.py +178 -0
  20. 021_python_clients-0.1.0/src/clients_021/py.typed +0 -0
  21. 021_python_clients-0.1.0/src/clients_021/queue/__init__.py +6 -0
  22. 021_python_clients-0.1.0/src/clients_021/queue/qstash.py +219 -0
  23. 021_python_clients-0.1.0/src/clients_021/queue/sqs.py +177 -0
  24. 021_python_clients-0.1.0/src/clients_021/redis.py +124 -0
  25. 021_python_clients-0.1.0/src/clients_021/s3.py +164 -0
  26. 021_python_clients-0.1.0/tests/__init__.py +0 -0
  27. 021_python_clients-0.1.0/tests/conftest.py +76 -0
  28. 021_python_clients-0.1.0/tests/qstash_local.py +96 -0
  29. 021_python_clients-0.1.0/tests/test_contract.py +157 -0
  30. 021_python_clients-0.1.0/tests/test_email.py +262 -0
  31. 021_python_clients-0.1.0/tests/test_http.py +102 -0
  32. 021_python_clients-0.1.0/tests/test_httpx2.py +75 -0
  33. 021_python_clients-0.1.0/tests/test_kms.py +270 -0
  34. 021_python_clients-0.1.0/tests/test_qstash.py +381 -0
  35. 021_python_clients-0.1.0/tests/test_redis.py +118 -0
  36. 021_python_clients-0.1.0/tests/test_s3.py +90 -0
  37. 021_python_clients-0.1.0/tests/test_ses.py +204 -0
  38. 021_python_clients-0.1.0/tests/test_sqs.py +117 -0
  39. 021_python_clients-0.1.0/tests/wheel_minimal.py +52 -0
  40. 021_python_clients-0.1.0/tests/wheel_smoke.py +46 -0
@@ -0,0 +1,8 @@
1
+ .venv*/
2
+ __pycache__/
3
+ *.pyc
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ .env*
7
+ !.env.example
8
+ dist/
@@ -0,0 +1,41 @@
1
+ # Changelog
2
+
3
+ All notable changes are recorded here by release-please from Conventional Commits.
4
+
5
+ ## 0.1.0 (2026-10-21)
6
+
7
+
8
+ ### Features
9
+
10
+ * add email (Resend, SES) and KMS clients ([0195195](https://github.com/from021-io/python-clients/commit/019519548c75e6d4bbc50ca564f5eb7dbb2a0ce2))
11
+ * add observed clients for Redis, SQS, S3 and HTTP ([336e53b](https://github.com/from021-io/python-clients/commit/336e53b6a85ec1c84f76100bd5eef1c6cc1f0ba5))
12
+ * **qstash:** add observed JSON publishing and client guide ([9ea3b86](https://github.com/from021-io/python-clients/commit/9ea3b866777d87046a1777ebfc05757d08e3aee9))
13
+ * **qstash:** add observed publishing on top of email and KMS ([cea5d8a](https://github.com/from021-io/python-clients/commit/cea5d8a1a6923be86381a6ef13bd3498956fc909))
14
+ * **queue:** add QStash and group queue providers ([970fbe4](https://github.com/from021-io/python-clients/commit/970fbe474f75866017a5981a66029599bb73964a))
15
+
16
+
17
+ ### Bug fixes
18
+
19
+ * **clients:** enforce error and lifecycle contracts ([170d726](https://github.com/from021-io/python-clients/commit/170d72669d229a9802a1f1eebe41aca43425a4c7))
20
+
21
+
22
+ ### Refactors
23
+
24
+ * **queue:** group SQS and QStash provider modules ([b71f8ba](https://github.com/from021-io/python-clients/commit/b71f8ba2a8ec4c6aadf217cdad83c1a181509964))
25
+
26
+ ## [Unreleased]
27
+
28
+ ### Added
29
+
30
+ - **QStash**: observed JSON publishing with deduplication, delivery options, trace
31
+ propagation, bounded publication timeouts and sanitized provider errors.
32
+ - **Client conventions**: contributor guidance for API design, retries, lifecycle,
33
+ telemetry, privacy and verification of new clients.
34
+
35
+ ### Changed
36
+
37
+ - **Queue organization**: group SQS and QStash under `clients_021.queue.sqs` and
38
+ `clients_021.queue.qstash`, following the capability layout used by email. Provider APIs
39
+ and optional dependencies are unchanged; update imports from the initial draft paths.
40
+
41
+ - **HTTP**: accept raw byte content for JSON `null` and reject conflicting body formats.
@@ -0,0 +1,163 @@
1
+ # Contract
2
+
3
+ What dashboards, alerts and services may rely on. Changing a name, a label or the error
4
+ semantics below is a breaking change.
5
+
6
+ ## Imports and capability packages
7
+
8
+ Queue providers live in `clients_021.queue.sqs` (`SqsClient`, `ReceivedMessage`) and
9
+ `clients_021.queue.qstash` (`QStashClient`, `PublishedMessage`, `QStashResponseError`).
10
+ Use these imports in place of the initial draft's root-level `clients_021.sqs` and
11
+ `clients_021.qstash` paths. This organization is part of the first unreleased API.
12
+ Importing `clients_021.queue` or its QStash module does not require the `aws` extra.
13
+
14
+ The queue package groups providers by purpose. SQS owns polling, receipts and visibility;
15
+ QStash owns HTTP delivery. Their public methods and observability contracts remain distinct.
16
+ Shared email types and the interchangeable `EmailSender` protocol live in `clients_021.email`.
17
+
18
+ ## Metrics
19
+
20
+ All on the service's `Observability` meter, so they carry its resource (service name,
21
+ version, environment). Durations use 021-python-observability's buckets.
22
+
23
+ | Instrument | Type / unit | Labels | Clients |
24
+ | --- | --- | --- | --- |
25
+ | `db.client.operation.count` | Counter / `{operation}` | dependency, operation, status, error.type | Redis (shared with SQL from 021-python-observability, which has no `operation`) |
26
+ | `db.client.operation.duration` | Histogram / `s` | same | Redis |
27
+ | `messaging.client.operation.count` | Counter / `{operation}` | dependency, operation, status, error.type | SQS, QStash, email (Resend, SES) |
28
+ | `messaging.client.operation.duration` | Histogram / `s` | same | SQS, QStash, email (Resend, SES) |
29
+ | `storage.client.operation.count` | Counter / `{operation}` | dependency, operation, status, error.type | S3 |
30
+ | `storage.client.operation.duration` | Histogram / `s` | same | S3 |
31
+ | `crypto.client.operation.count` | Counter / `{operation}` | dependency, operation, status, error.type | KMS |
32
+ | `crypto.client.operation.duration` | Histogram / `s` | same | KMS |
33
+ | `http.client.request.count` | Counter / `{request}` | dependency, http.request.method, http.response.status_code, error.type | HTTP, httpx2, QStash transport, Resend (its HTTP request) |
34
+ | `http.client.request.duration` | Histogram / `s` | same | HTTP, httpx2, QStash transport, Resend (its HTTP request) |
35
+
36
+ - `status`: `ok` or `error`. `error.type` only on errors.
37
+ - `operation`: a fixed set per client. Redis: `get_json`, `set_json`, `take_json`,
38
+ `delete`, `incr_window`, `ping`. SQS: `send`, `receive`, `delete`, `change_visibility`.
39
+ S3: `put`, `get`, `head`, `delete`. QStash: `publish`. Email (Resend, SES): `send`. KMS:
40
+ `encrypt`, `decrypt`, `generate_data_key`; `seal` and `unseal` record the KMS call they make
41
+ (`generate_data_key`, `decrypt`), not the local AES work.
42
+ - Redis/SQS/S3/QStash/email/KMS `error.type`: `timeout`, `connection_error`, `throttled`,
43
+ `status_<5xx>`, `cancelled`, or the exception class name for errors that are not outages
44
+ (`EmailRejected` for every email rejection; botocore's class, such as `ClientError` or
45
+ `NotFoundException`, for KMS).
46
+ - Resend records two levels: the `send` operation (`messaging.client.operation.*`) and,
47
+ inside it, its HTTP request (`http.client.request.*`), both under the same `dependency`.
48
+ - HTTP transport metrics inherit 021-python-observability's labels (`timeout`, `cancelled`,
49
+ `connection_error` or `internal_error`). These describe the transport exception, while
50
+ `DependencyUnavailable.reason` describes the failure returned to the caller.
51
+ - httpx2 uses `timeout`, `connection_error`, `cancelled`, or the exception class name.
52
+ HTTP status errors set the span's ERROR status and status-code label, with no `error.type`.
53
+ - A missing S3 object or Redis key is `status=ok`.
54
+ - `dependency` is a static identifier, validated consistently with 021-python-observability.
55
+ User ids, tenant ids and request-derived values are forbidden even if they match its syntax.
56
+
57
+ ## Spans
58
+
59
+ CLIENT spans named `<dependency> <operation>` (`HTTP <dependency>` for HTTP), with the
60
+ metric labels plus `db.system.name=redis`, `messaging.system=aws_sqs`,
61
+ `messaging.system=upstash_qstash`, `messaging.system=resend`, `messaging.system=aws_ses`, or
62
+ `rpc.system=aws-api` + `rpc.service=S3` / `rpc.service=KMS`. Resend's `HTTP <dependency>`
63
+ span is a child of its `<dependency> send` span. Status ERROR on failure (and on HTTP
64
+ status ≥ 400).
65
+ Cancellation propagates unchanged and records ERROR with `error.type=cancelled`.
66
+ HTTP transports measure through response headers; they do not measure body consumption.
67
+
68
+ QStash adds one logical `publish` operation around the HTTP transport request. The
69
+ messaging duration includes reading and validating the acknowledgement; the nested HTTP
70
+ span measures through response headers. Both use the configured static dependency name.
71
+ Local input validation occurs before either operation is recorded.
72
+
73
+ ## Trace propagation
74
+
75
+ - HTTP (`HttpClient`): `traceparent`, `tracestate` and `x-request-id` are sent (by
76
+ 021-python-observability's transport).
77
+ - httpx2 (`ObservedTransport`): nothing is sent unless `propagate=True`.
78
+ When enabled, both caller-supplied trace headers are replaced with the current context.
79
+ - Resend: nothing is sent. The `traceparent`, `tracestate` and `x-request-id` headers that
80
+ 021-python-observability's transport adds are removed before the request leaves.
81
+ - SES and KMS: nothing is sent.
82
+ - SQS: `traceparent` and `tracestate` are message attributes; `ReceivedMessage.trace_context()`
83
+ returns the producer's context. Caller-supplied values for both trace attributes are
84
+ replaced with the current context.
85
+ - QStash: the `publish` span's context is sent as `Upstash-Forward-traceparent` and
86
+ `Upstash-Forward-tracestate` for delivery to the consumer. `propagate=False` removes
87
+ both forwarded trace headers. Caller values never override them. The request to QStash
88
+ itself still uses the HTTP transport's propagation policy.
89
+
90
+ ## Errors
91
+
92
+ `DependencyUnavailable(dependency, operation, reason)` with `reason` one of `timeout`,
93
+ `connection_error`, `throttled`, `status_<5xx>`. Raised only when retrying later may work.
94
+ HTTP: only after the last attempt; HTTP statuses are returned, never raised.
95
+ HTTP local protocol/unsupported protocol errors and Redis authentication
96
+ or authorization errors retain their native type and are not treated as outages. httpx2
97
+ transports always preserve the native exception for the owning SDK.
98
+
99
+ QStash maps HTTP 429 to `throttled`, 5xx to `status_<code>`, and transport outages to
100
+ `timeout` or `connection_error`, with operation `publish`. Other non-2xx responses raise
101
+ `QStashResponseError(status_code, reason="rejected")`. A 2xx response must contain a
102
+ non-empty `messageId` and, if present, a boolean `deduplicated`; otherwise it raises
103
+ `QStashResponseError` with `reason="invalid_response"`. A missing deduplication flag
104
+ is inferred from status 202. Neither error includes the provider response body.
105
+ `PublishedMessage(message_id, deduplicated)` represents acceptance, not completed delivery.
106
+
107
+ The exception's message and fields contain only the static dependency, operation and reason.
108
+ The chained provider exception is preserved for debugging and is not sanitized.
109
+
110
+ Email: `EmailRejected(dependency, status, code)` when the provider refused the message or
111
+ the credentials, for both senders. `status` is the HTTP status; `code` is Resend's error
112
+ `name` or the SES error code, reduced to `unknown` unless it is a short identifier. Its
113
+ message is `<dependency> send: rejected (<status> <code>)`; never the provider's message.
114
+ Resend: 429 is `throttled`, 5xx is `status_<5xx>`, transport timeouts and connection
115
+ failures are `timeout` / `connection_error`; every other non-2xx is `EmailRejected` (409
116
+ `concurrent_idempotent_requests` included: the first request is still running). SES: the
117
+ shared AWS classification, and every other `ClientError` becomes `EmailRejected` chained to
118
+ it. Resend's request is sent once; `idempotency_key` becomes its `Idempotency-Key` header
119
+ (1–256 characters, kept by Resend for 24 hours). SES has no idempotency key: the argument is
120
+ validated and ignored.
121
+
122
+ KMS: throttling, 5xx (`KMSInternalException`, `DependencyTimeoutException`,
123
+ `KeyUnavailableException`), timeouts and connection failures are `DependencyUnavailable`.
124
+ Access denied, disabled or missing keys, invalid key state, a wrong encryption context or a
125
+ tampered ciphertext (`InvalidCiphertextException`) and a ciphertext from another key
126
+ (`IncorrectKeyException`) keep their botocore type. `decrypt` always names the client's key.
127
+ Every call requires a non-empty encryption context. `unseal` raises `ValueError` for a
128
+ malformed envelope and `cryptography.exceptions.InvalidTag` when the payload was altered.
129
+
130
+ ## Sealed envelope format
131
+
132
+ `KmsClient.seal` output is stored data, so its layout is part of this contract: version
133
+ byte `0x01`, wrapped data key length (2 bytes, big endian), the wrapped key (KMS
134
+ `GenerateDataKey`, `AES_256`, same encryption context), a 12-byte random nonce, then the
135
+ AES-256-GCM ciphertext and 16-byte tag. The GCM additional data is the header (version,
136
+ length and wrapped key) followed by the encryption context as compact JSON with sorted keys.
137
+ A new data key is generated for every envelope.
138
+
139
+ ## Lifecycle and retry limits
140
+
141
+ HTTP, Redis, SQS, QStash, S3, Resend, SES and KMS expose `aclose()`. Close them after
142
+ in-flight calls complete; the wrapper owns the underlying client, including one supplied
143
+ through the constructor.
144
+ AWS factories configure three total attempts; injected clients retain their own policy.
145
+ Cancellation of an AWS await does not cancel its worker thread or undo a remote write.
146
+ A transient failure does not guarantee that replaying a non-idempotent operation is safe.
147
+
148
+ QStash publishes once, never automatically replays a POST, and preserves the required
149
+ deduplication key exactly. Keys containing `:` fail locally, matching the provider
150
+ restriction without lossy normalization. Delivery retries, delay and delivery timeout are separate
151
+ provider options. The publication timeout is mandatory and finite. Consumers remain
152
+ responsible for idempotency and signature verification. A closed QStash client cannot
153
+ publish again.
154
+
155
+ `HttpClient.request` accepts at most one of `json`, `form` or raw byte `content`. Passing
156
+ more than one non-None body format raises `ValueError` before sending a request.
157
+
158
+ ## Never recorded
159
+
160
+ Keys, URLs, query strings, bodies, message ids, receipts, object names, bucket or queue
161
+ names, provider error messages. Email: sender, recipient and reply-to addresses, subjects,
162
+ text and HTML bodies, tags, idempotency keys, API keys, configuration set names. KMS: key
163
+ ids, ARNs and aliases, encryption contexts, plaintext, ciphertext and data keys.
@@ -0,0 +1,101 @@
1
+ # Adding a client
2
+
3
+ Add a client when services repeat provider communication or need a shared operational
4
+ contract. Keep message envelopes, business validation, destination selection, tenant
5
+ routing and deduplication-key generation in service adapters. A provider's full SDK does
6
+ not need to be reimplemented here.
7
+
8
+ ## Layout and public API
9
+
10
+ Group providers by capability when more than one serves the same purpose, with a module
11
+ per provider inside that package. Keep standalone clients at the root until a second
12
+ provider makes grouping useful. Tests stay in `tests/test_<provider>.py`.
13
+
14
+ ```text
15
+ clients_021/
16
+ email/ # _message.py (shared protocol/types), resend.py, ses.py
17
+ queue/ # sqs.py, qstash.py
18
+ http.py
19
+ redis.py
20
+ s3.py
21
+ kms.py
22
+ ```
23
+
24
+ Public result and exception types live beside their provider unless they are truly shared.
25
+ A common protocol requires interchangeable operations and semantics: `EmailSender.send`
26
+ qualifies. SQS polling/receipts and QStash HTTP delivery do not share a consumer API, so
27
+ `queue/` groups them without inventing one. Provider imports are explicit, and importing
28
+ the capability package must not load optional SDKs.
29
+
30
+ Use private helpers for actual shared behavior: `_observe.py` owns instrumentation and
31
+ `_aws.py` owns AWS configuration and error classification. Avoid a universal base class:
32
+ a queue, cache and object store have different operations and failure semantics.
33
+
34
+ Keep `__init__.py` small. Provider SDK imports belong inside their provider module, and
35
+ new dependencies belong in an optional extra. An integration that uses the existing HTTP
36
+ client, such as QStash, requires no extra. Installing the base wheel must not import AWS,
37
+ Redis or an LLM SDK. Include `py.typed` and fully type the public interface.
38
+
39
+ Accept the service's `Observability`, a static dependency name and explicit configuration.
40
+ Do not read environment variables, initialize global clients, fetch credentials or start
41
+ background work at import time. Factories may construct an SDK; constructors should allow
42
+ an SDK or transport to be injected for tests and provider-specific configuration.
43
+
44
+ ## Operational contract
45
+
46
+ Each implementation must make these decisions explicit in README.md and CONTRACT.md:
47
+
48
+ | Concern | Required decision |
49
+ | --- | --- |
50
+ | Timeouts | Finite defaults or required finite configuration; distinguish connection, request and downstream delivery timeouts. |
51
+ | Retries | Identify who retries and the maximum attempts. Do not add a retry loop around an SDK's own loop. A timeout may follow a successful remote write. |
52
+ | Idempotency | Describe how callers safely retry writes. Preserve caller-supplied keys; do not normalize distinct keys into the same value. |
53
+ | Errors | Classify only recoverable dependency failures as `DependencyUnavailable`. Preserve validation/auth/not-found distinctions. Sanitize custom protocol errors. |
54
+ | Cancellation | Propagate cancellation and record it as failure. Document when cancelling an await cannot stop the underlying operation. |
55
+ | Ownership | Reuse pools, expose `aclose()` for owned resources, and specify ownership of injected clients. Close only after in-flight work completes. |
56
+ | Telemetry | Choose a metric family, fixed operations and system attribute. Never record URLs, credentials, bodies, object names or request-derived ids. |
57
+ | Propagation | State the default and opt-out. Replace `traceparent` and `tracestate` together, including removing stale state. |
58
+
59
+ Use `_observe.observed` for a logical cache, messaging, storage or crypto operation. HTTP-backed
60
+ clients may also emit the transport's HTTP span/metrics: one logical operation and one
61
+ network request are different measurements. Do not sum those counters as distinct
62
+ business operations. Disable exception recording when provider errors can contain data.
63
+ The safe wrapper message does not make a native chained exception safe to log.
64
+
65
+ Expose small, stable results when the caller needs them. Validate acknowledgements before
66
+ reporting success. Keep documented provider status codes accessible to callers without
67
+ copying the response body into an exception. Invalid local configuration should fail
68
+ before network I/O and should not be classified as an outage.
69
+
70
+ ## Verification and handoff
71
+
72
+ Cover meaningful behavior, including:
73
+
74
+ - A request/response round trip with non-default options and a useful result.
75
+ - Transient failure versus invalid request, authentication or missing resources.
76
+ - Actual attempt count, uncertain write outcomes and deduplication behavior.
77
+ - Span/metric names and bounded labels on success, failure and cancellation.
78
+ - Trace propagation, stale context removal and disabled propagation where supported.
79
+ - Sensitive values absent from spans, metric attributes and structured logs.
80
+ - Resource cleanup and installation of the built wheel with and without optional extras.
81
+
82
+ Use a real local service or a supported emulator when available, and deterministic
83
+ transports/stubs for failures. Keep live credentials and production writes out of tests.
84
+ `tests/qstash_local.py` is an opt-in check against Upstash's development server; regular
85
+ QStash tests use `httpx.MockTransport`.
86
+
87
+ Run the repository's gates:
88
+
89
+ ```bash
90
+ uv sync --all-extras
91
+ uv lock --check
92
+ make check
93
+ uv build
94
+ uvx twine check --strict dist/*
95
+ # CI also runs tests/wheel_minimal.py and tests/wheel_smoke.py in isolated environments.
96
+ ```
97
+
98
+ Update the README examples, public contract, minimal-wheel check and this guide when a new
99
+ client changes shared conventions. Public contract changes require an appropriate version
100
+ bump; release-please handles version and changelog updates after merge. Use Conventional
101
+ Commits. See [AGENTS.md](AGENTS.md) for the repository's enforcement rules.
@@ -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.