xarray_sql 0.3.0__cp310-abi3-win_amd64.whl

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.
@@ -0,0 +1,354 @@
1
+ Metadata-Version: 2.4
2
+ Name: xarray_sql
3
+ Version: 0.3.0
4
+ Classifier: Development Status :: 4 - Beta
5
+ Classifier: Intended Audience :: Science/Research
6
+ Classifier: Intended Audience :: Developers
7
+ Classifier: Intended Audience :: Information Technology
8
+ Classifier: License :: OSI Approved :: Apache Software License
9
+ Classifier: Operating System :: MacOS :: MacOS X
10
+ Classifier: Operating System :: Microsoft :: Windows
11
+ Classifier: Operating System :: POSIX
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Rust
17
+ Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
18
+ Classifier: Topic :: Database :: Front-Ends
19
+ Requires-Dist: dask>=2024.8.0
20
+ Requires-Dist: datafusion==52.0.0
21
+ Requires-Dist: xarray>=2024.7.0
22
+ Requires-Dist: xarray-sql[docs] ; extra == 'dev'
23
+ Requires-Dist: pre-commit ; extra == 'dev'
24
+ Requires-Dist: pytest ; extra == 'dev'
25
+ Requires-Dist: watchfiles ; extra == 'dev'
26
+ Requires-Dist: zensical ; extra == 'docs'
27
+ Requires-Dist: mkdocstrings[python] ; extra == 'docs'
28
+ Requires-Dist: cftime ; extra == 'test'
29
+ Requires-Dist: pytest ; extra == 'test'
30
+ Requires-Dist: xarray[io] ; extra == 'test'
31
+ Requires-Dist: gcsfs ; extra == 'test'
32
+ Provides-Extra: dev
33
+ Provides-Extra: docs
34
+ Provides-Extra: test
35
+ License-File: LICENSE
36
+ Summary: Querry Xarray with SQL.
37
+ Author-email: Alexander Merose <al@merose.com>
38
+ License: Apache-2.0
39
+ Requires-Python: >=3.10
40
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
41
+ Project-URL: Homepage, https://github.com/alxmrs/xarray-sql
42
+ Project-URL: Issues, https://github.com/alxmrs/xarray-sql/issues
43
+
44
+ # xarray-sql
45
+
46
+ _Query [Xarray](https://xarray.dev/) with SQL_
47
+
48
+ [![ci](https://github.com/alxmrs/xarray-sql/actions/workflows/ci.yml/badge.svg)](https://github.com/alxmrs/xarray-sql/actions/workflows/ci.yml)
49
+ [![lint](https://github.com/alxmrs/xarray-sql/actions/workflows/lint.yml/badge.svg)](https://github.com/alxmrs/xarray-sql/actions/workflows/lint.yml)
50
+ [![ci-build](https://github.com/alxmrs/xarray-sql/actions/workflows/ci-build.yml/badge.svg)](https://github.com/alxmrs/xarray-sql/actions/workflows/ci-build.yml)
51
+ [![ci-rust](https://github.com/alxmrs/xarray-sql/actions/workflows/ci-rust.yml/badge.svg)](https://github.com/alxmrs/xarray-sql/actions/workflows/ci-rust.yml)
52
+
53
+ ```shell
54
+ pip install xarray-sql
55
+ ```
56
+
57
+ ## What is this?
58
+
59
+ This is an experiment to provide a SQL interface for array datasets.
60
+ Succinctly, we "pivot" Xarray Datasets to treat them like tables so we can run
61
+ SQL queries against them.
62
+
63
+ ## Quickstart
64
+
65
+ Open a Dataset, register it as a table with `from_dataset`, compute a
66
+ climatology in SQL, then write the result back to Xarray and plot it:
67
+
68
+ > **Note:** this example also needs `pooch` and a netCDF backend (for the
69
+ > tutorial download) and `matplotlib` (for the plot):
70
+ > `pip install pooch netCDF4 matplotlib`.
71
+
72
+ ```python
73
+ import xarray as xr
74
+ import xarray_sql as xql
75
+
76
+ # 4x-daily surface air temperature on a lat/lon grid, 2013-2014.
77
+ ds = xr.tutorial.open_dataset('air_temperature')
78
+
79
+ ctx = xql.XarrayContext()
80
+ ctx.from_dataset('air', ds, chunks=dict(time=100))
81
+
82
+ # A climatology — the mean annual cycle — computed in SQL: average air
83
+ # temperature for each month of the year, over all grid cells and years.
84
+ clim = ctx.sql('''
85
+ SELECT
86
+ CAST(date_part('month', "time") AS INTEGER) AS month,
87
+ AVG("air") AS air
88
+ FROM "air"
89
+ GROUP BY CAST(date_part('month', "time") AS INTEGER)
90
+ ORDER BY month
91
+ ''')
92
+
93
+ # Write the SQL result back to an Xarray Dataset. `month` is a derived
94
+ # column, so name it as the dimension; the variable's units are recovered
95
+ # from the registered table. The result is one value per month: air(month).
96
+ clim_ds = clim.to_dataset(dims=["month"])
97
+
98
+ # Plot the annual cycle as a time series.
99
+ clim_ds["air"].plot() # in a script, call matplotlib.pyplot.show() to display
100
+ ```
101
+
102
+ That's the round trip — Xarray in, SQL in the middle, Xarray (and a plot) back
103
+ out.
104
+
105
+ ## A bigger example: ARCO-ERA5
106
+
107
+ The same interface scales to cloud-native datasets with hundreds of variables,
108
+ like [ARCO-ERA5](https://github.com/google-research/arco-era5).
109
+
110
+ > **Note:** reading from `gs://` requires `gcsfs` (`pip install gcsfs`).
111
+
112
+ ```python
113
+ import xarray as xr
114
+ import xarray_sql as xql
115
+
116
+
117
+ # Open ARCO-ERA5 — a weather dataset with 273 variables since 1940.
118
+ # Turning off dask means we don't have to wait to construct a task graph.
119
+ ds = xr.open_zarr(
120
+ 'gs://gcp-public-data-arco-era5/ar/full_37-1h-0p25deg-chunk-1.zarr-v3',
121
+ chunks=None, # Turn dask off
122
+ storage_options={'token': 'anon'} # Anonymous read from the public GCS bucket — no auth required.
123
+ )
124
+
125
+ ctx = xql.XarrayContext()
126
+ # Make sure to pass `chunks`!
127
+ ctx.from_dataset('era5', ds, chunks=dict(time=6), table_names={
128
+ ('time', 'latitude', 'longitude'): 'surface',
129
+ ('time', 'level', 'latitude', 'longitude'): 'atmosphere',
130
+ })
131
+ # Registration takes ~10s on my machine.
132
+
133
+ # Heads up: ARCO-ERA5 has 262 surface + 11 atmospheric variables. The library
134
+ # pushes column projection down to Zarr, so SELECT only fetches what you ask
135
+ # for — but `SELECT * FROM era5.surface` would try to pull every variable
136
+ # across the year (terabytes from GCS).
137
+ # ---> Always SELECT specific columns. <---
138
+
139
+ # Average 2m-temperature over NYC on the morning of 2020-01-01. The library
140
+ # pushes WHERE clauses on dimension columns down to partition pruning.
141
+ ctx.sql('''
142
+ SELECT AVG("2m_temperature") - 273.15 AS avg_c
143
+ FROM era5.surface
144
+ WHERE time BETWEEN TIMESTAMP '2020-01-01'
145
+ AND TIMESTAMP '2020-01-01 05:00:00'
146
+ AND latitude BETWEEN 39 AND 40
147
+ AND longitude BETWEEN 286 AND 287 -- ERA5 uses 0-360 longitudes
148
+ ''').to_pandas()
149
+ # avg_c
150
+ # 0 8.640069
151
+
152
+ # Average temperature per pressure level, globally.
153
+ result = ctx.sql('''
154
+ SELECT level, AVG(temperature) - 273.15 AS avg_c
155
+ FROM era5.atmosphere
156
+ WHERE time BETWEEN TIMESTAMP '2020-01-01'
157
+ AND TIMESTAMP '2020-01-01 05:00:00'
158
+ GROUP BY level
159
+ ORDER BY level DESC
160
+ ''')
161
+ # DataFrame()
162
+ # +-------+----------------------+
163
+ # | level | avg_c |
164
+ # +-------+----------------------+
165
+ # | 1000 | 6.6210120796502565 |
166
+ # | 975 | 5.185637919348153 |
167
+ # | 950 | 4.028428657263021 |
168
+ # | 925 | 3.0828117974912743 |
169
+ # | 900 | 2.2109172992531967 |
170
+ # | 875 | 1.395017610194202 |
171
+ # | 850 | 0.6342670572626616 |
172
+ # | 825 | -0.21037158786759846 |
173
+ # | 800 | -1.1810754318269687 |
174
+ # | 775 | -2.3064649711534457 |
175
+ # +-------+----------------------+
176
+
177
+ ctx.sql('''
178
+ SELECT latitude, longitude, AVG("2m_temperature") - 273.15 AS avg_c
179
+ FROM era5.surface
180
+ WHERE time BETWEEN TIMESTAMP '2020-01-01'
181
+ AND TIMESTAMP '2020-01-01 05:00:00'
182
+ GROUP BY latitude, longitude
183
+ ORDER BY latitude DESC, longitude
184
+ ''').to_dataset(dims=['latitude', 'longitude'], template=ds)
185
+ # <xarray.Dataset> Size: 8MB
186
+ # Dimensions: (latitude: 721, longitude: 1440)
187
+ # Coordinates:
188
+ # * latitude (latitude) float32 3kB 90.0 89.75 89.5 ... -89.5 -89.75 -90.0
189
+ # * longitude (longitude) float32 6kB 0.0 0.25 0.5 0.75 ... 359.2 359.5 359.8
190
+ # Data variables:
191
+ # avg_c (latitude, longitude) float64 8MB -26.84 -26.84 ... -27.38 -27.38
192
+ # Attributes:
193
+ # last_updated: 2026-06-20 02:33:34.265980+00:00
194
+ # valid_time_start: 1940-01-01
195
+ # valid_time_stop: 2025-12-31
196
+ # valid_time_stop_era5t: 2026-06-14
197
+ ```
198
+
199
+ _(A runnable version of this example lives at
200
+ [`perf_tests/era5_temp_profile.py`](perf_tests/era5_temp_profile.py).)_
201
+
202
+ ## Why build this?
203
+
204
+ A few reasons:
205
+
206
+ * Even though SQL is the lingua franca of data, scientific datasets are often
207
+ inaccessible to non-scientists (SQL users).
208
+ * Joining tabular data with raster data is common yet difficult. It could be
209
+ easy.
210
+ * There are many cloud-native, Xarray-openable datasets,
211
+ from [Google Earth Engine](https://github.com/google/Xee)
212
+ to the [Source Cooperative](https://source.coop/products?tags=zarr). Wouldn’t it be great if these
213
+ were also SQL-accessible? How can the bridge be built with minimal effort?
214
+
215
+ This is a light-weight way to prove the value of the interface.
216
+
217
+ The larger goal is to explore the hypothesis that the [Pangeo
218
+ ecosystem is a scientific database](https://www.hytradboi.com/2025/c18b8cdc-fd17-4099-9c03-eb107217f627-pangeo-is-a-database). Here, xarray-sql can be thought of as a missing
219
+ DB front end.
220
+
221
+ ## How does it work?
222
+
223
+ All chunks in a Xarray Dataset are transformed into a Dask DataFrame via
224
+ `from_map()` and `to_dataframe()`. For SQL support, we just use `dask-sql`.
225
+ That's it!
226
+
227
+ _2025 update_: This library now implements a Dask-like `from_map` interface in
228
+ pure DataFusion and PyArrow, but works with the same principle!
229
+
230
+ _2026 update_: Instead of `from_map()`, we create a way to translate Xarray chunks
231
+ into Arrow RecordBatches. We pass a Python callback into a DataFusion `TableProvider`
232
+ that lets the DB engine translate the underlying Dataset arrays into DataFusion partitions.
233
+ Ultimately, the initial insight of the `pivot()` function -- that any ndarray can be
234
+ translated into a 2D table -- underlies this performant query mechanism.
235
+
236
+ ## Does it work?
237
+
238
+ Yes. The recurring worry is that the SQL interface is a toy — fine for `SELECT`s,
239
+ but not for the operations geoscience actually runs. So we wrote a suite that
240
+ takes the staples of geospatial and climate analysis — the ones we assume *need*
241
+ an array library — and expresses each one in SQL, then **checks the SQL answer
242
+ against an xarray/array reference** to floating-point tolerance:
243
+
244
+ * **Spectral indices** (NDVI) — column arithmetic over a real Sentinel-2 scene.
245
+ * **Climatology, anomalies, zonal means** — `GROUP BY` and self-`JOIN` against
246
+ the 0.25° **ARCO-ERA5** archive registered as a lazy table. Each query is
247
+ bounded to a small window (a few days over a region) and reads only that
248
+ slice — the point is that you can aim a query at a multi-decade archive and
249
+ pay only for the data it asks for, not that the query scans the whole record.
250
+ * **Forecast skill** — scoring the **Pangu-Weather** and **GraphCast** ML models
251
+ against ERA5 (WeatherBench 2) as a `JOIN` on `valid_time = init + lead`; it
252
+ reproduces the published result that GraphCast beats Pangu at every lead.
253
+ * **Raster × vector zonal stats** — a range `JOIN` of the ERA5 grid against a
254
+ table of regions.
255
+ * **Reprojection and regridding** — a scalar PROJ UDF (validated against Earth
256
+ Engine's own geodesy via [Xee](https://github.com/google/Xee)) and a
257
+ sparse-weight-table `JOIN` (regridding real SRTM terrain).
258
+
259
+ Every case matches its array reference. The headline finding: these operations
260
+ are not really "array" operations at all — they are `GROUP BY`, `JOIN`, window
261
+ functions, and `CASE` in disguise, and a query engine runs them at scale. See
262
+ [`benchmarks/geospatial/`](benchmarks/geospatial/) and the write-up,
263
+ [Geospatial operations are relational operations](docs/geospatial.md).
264
+
265
+ ## Why does this work?
266
+
267
+ Underneath Xarray, Dask, and Pandas, there are NumPy arrays. These are paged in
268
+ chunks and represented contiguously in memory. It is only a matter of metadata
269
+ that breaks them up into ndarrays. `pivot()`, which uses `to_dataframe()`,
270
+ just changes this metadata (via a `ravel()`/`reshape()`), back into a column
271
+ amenable to a DataFrame. We take advantage of this light weight metadata change to
272
+ make chunked information scannable by a DB engine (DataFusion).
273
+
274
+ ## What are the current limitations?
275
+
276
+ TBD, DataFusion provides a whole new world! Currently, we're looking for
277
+ early users – "tire kickers", if you will. We'd love your input to shape the direction of this
278
+ project! Please, give this a try and [file issues](https://github.com/alxmrs/xarray-sql/issues) as
279
+ you see fit. Check out our [contributing guide](CONTRIBUTING.md), too 😉.
280
+
281
+ ## What would a deeper integration look like?
282
+
283
+ I have a few ideas so far. One approach involves applying operations directly on
284
+ Xarray Datasets. This approach is being pursued
285
+ [here](https://github.com/google/weather-tools/tree/main/xql), as `xql`.
286
+
287
+ Deeper still: I was thinking we could make
288
+ a [virtual](https://fsspec.github.io/kerchunk/)
289
+ filesystem for parquet that would internally map to Zarr. Raster-backed virtual
290
+ parquet would open up integrations to numerous tools like dask, pyarrow, duckdb,
291
+ and BigQuery. More thoughts on this
292
+ in [#4](https://github.com/alxmrs/xarray-sql/issues/4).
293
+
294
+ _2025 update_: Something like this is being built across a few projects! The ones I know about are:
295
+
296
+ - [CartoDB's Raquet](https://github.com/CartoDB/raquet)
297
+ - The DataFusion community's [arrow-zarr](https://github.com/datafusion-contrib/arrow-zarr)
298
+
299
+ _2026 update_: A colleague and I are experimenting with native Zarr RDBMS engines. Check out:
300
+
301
+ - [Zarr-Datafusion](https://lib.rs/crates/zarr-datafusion)
302
+ - [DuckDB-Zarr](https://github.com/alxmrs/duckdb-zarr)
303
+
304
+ ## Roadmap
305
+
306
+ - [x] ~Lazy evaluation via the pyarrow Dataset interface [#93](https://github.com/alxmrs/xarray-sql/issues/93).~ _Implemented in [#100](https://github.com/alxmrs/xarray-sql/pull/100)_
307
+ - [x] Support proper parallelism via proper partition handling on the rust/datafusion side. [#106](https://github.com/alxmrs/xarray-sql/issues/106)
308
+ - [x] Support core datafusion optimizations to scan less data, like [104](https://github.com/alxmrs/xarray-sql/issues/104), ...
309
+ - [x] Translate a single Zarr to a collection of tables [#85](https://github.com/alxmrs/xarray-sql/issues/85).
310
+ - [ ] Distributed beyond a single node through the DataFusion integration with Ray Datasets [#68](https://github.com/alxmrs/xarray-sql/issues/68) or Apache Ballista [#98](https://github.com/alxmrs/xarray-sql/issues/98).
311
+ - [ ] Demo: calculate Sea Surface Temperature from 1940 - Present in SQL [#36](https://github.com/alxmrs/xarray-sql/issues/36).
312
+ - [ ] Provide an option to integrate DataFusion directly to Zarr via Rust [#4](https://github.com/alxmrs/xarray-sql/issues/4).
313
+ - [ ] (To be formally announced eventually): The 100 Trillion Row Challenge [#34](https://github.com/alxmrs/xarray-sql/issues/34).
314
+
315
+ ## Sponsors & Contributors
316
+
317
+ I want to give a special thanks to the following folks and institutions:
318
+
319
+ - Pramod Gupta and the Anthromet Team at Google Research for the problem
320
+ formation and design inspiration.
321
+ - Jake Wall and AI2/Ecoscope for compute resources and key use cases.
322
+ - Charles Stern, Stephan Hoyer, Alexander Kmoch, Wei Ji, and Qiusheng Wu
323
+ for the early review and discussion of this project.
324
+ - Tom Nichols, Kyle Barron, Tom White, and Maxime Dion for the [Array Working
325
+ Group](https://discourse.pangeo.io/t/new-working-group-for-distributed-array-computing/2734)
326
+ and DataFusion-specific collaboration.
327
+ - The gracious volunteer data science students at [UCSD's DS3](https://www.ds3atucsd.com/) org,
328
+ who are working to make this library better.
329
+ - Andrew Huang for the sense of taste he brings to the project and consummate code
330
+ changes.
331
+ - Aman Kumar for spending a considerable amount of his GSoC internship
332
+ contributing to this project.
333
+
334
+
335
+ ## License
336
+
337
+ ```
338
+ Copyright 2024 Alexander Merose
339
+
340
+ Licensed under the Apache License, Version 2.0 (the "License");
341
+ you may not use this file except in compliance with the License.
342
+ You may obtain a copy of the License at
343
+
344
+ https://www.apache.org/licenses/LICENSE-2.0
345
+
346
+ Unless required by applicable law or agreed to in writing, software
347
+ distributed under the License is distributed on an "AS IS" BASIS,
348
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
349
+ See the License for the specific language governing permissions and
350
+ limitations under the License.
351
+ ```
352
+
353
+ All vendored code has proper license attribution.
354
+
@@ -0,0 +1,12 @@
1
+ xarray_sql\__init__.py,sha256=CLlJIrFGmmTmiT89c71O6c52MGzTqLq2ihzF1i0FN44,264
2
+ xarray_sql\_native.pyd,sha256=Ebr3zYmyhsUMkfr_DCDofSFI5l7u4r7QrWGdy_5Njdw,50890240
3
+ xarray_sql\cftime.py,sha256=4sU6YKO9dESm3-XBIpp5iNUoC2eJ8wbuYBBaILsR01s,8867
4
+ xarray_sql\core.py,sha256=pkDtPPw2vrXcWCm8UngsqUWIW5M4IxMXSi1INr-nUpc,1353
5
+ xarray_sql\df.py,sha256=Xei6SQ2YwpfouyCavo5EV9Q_evnmi4uxnxeU_W73-yk,20216
6
+ xarray_sql\ds.py,sha256=cOs4fGApDBr1OYpBtBIquVf_X4PmYuFJn6KNe_OW4NM,39235
7
+ xarray_sql\reader.py,sha256=ZuQYf8IMkODBuCnRS-BaxrJ2W0iibTNychq8mF8sDkQ,13445
8
+ xarray_sql\sql.py,sha256=P1xwSsUp93f76KaJcABXMUqEmUE9I0OwR5NkZhjpDsw,8042
9
+ xarray_sql-0.3.0.dist-info\METADATA,sha256=WIRlR21hTjScN5qf0uY6NtmpZUdMZQBwZ_RkO9xk1uA,16042
10
+ xarray_sql-0.3.0.dist-info\WHEEL,sha256=ZMDDxh9OPoaLQ4P2dJmgI1XsENYSzjzq8fErKKVw5iE,96
11
+ xarray_sql-0.3.0.dist-info\licenses\LICENSE,sha256=Pd-b5cKP4n2tFDpdx27qJSIq0d1ok0oEcGTlbtL6QMU,11560
12
+ xarray_sql-0.3.0.dist-info\RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.11.5)
3
+ Root-Is-Purelib: false
4
+ Tag: cp310-abi3-win_amd64
@@ -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.