tracdap-ext-openai 0.10.0b1__py3-none-any.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,16 @@
1
+ # Licensed to the Fintech Open Source Foundation (FINOS) under one or
2
+ # more contributor license agreements. See the NOTICE file distributed
3
+ # with this work for additional information regarding copyright ownership.
4
+ # FINOS licenses this file to you under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with the
6
+ # License. You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ __version__ = "0.10.0b1"
@@ -0,0 +1,261 @@
1
+ # Licensed to the Fintech Open Source Foundation (FINOS) under one or
2
+ # more contributor license agreements. See the NOTICE file distributed
3
+ # with this work for additional information regarding copyright ownership.
4
+ # FINOS licenses this file to you under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with the
6
+ # License. You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ import os
17
+ import threading
18
+ import concurrent.futures as fut
19
+ import queue
20
+ import logging
21
+
22
+
23
+ try:
24
+ import openai # noqa
25
+ except ModuleNotFoundError:
26
+ openai = None
27
+
28
+ import tracdap.rt.config as _cfg
29
+ import tracdap.rt.exceptions as _ex
30
+ import tracdap.rt.ext.external as _external
31
+ import tracdap.rt.ext.plugins as _plugins
32
+ import tracdap.rt.ext.util as _util
33
+
34
+
35
+ class OpenAIPlugin(_external.IExternalSystem):
36
+
37
+ API_KEY_KEY = "api_key"
38
+ ORGANIZATION_KEY = "organization"
39
+ PROJECT_KEY = "project"
40
+ BASE_URL_KEY = "base_url"
41
+ TIMEOUT_KEY = "timeout"
42
+ MAX_RETRIES_KEY = "max_retries"
43
+
44
+ AZURE_SUB_PROTOCOL = "azure"
45
+ API_VERSION_KEY = "api_version"
46
+ AZURE_ENDPOINT_KEY = "azure_endpoint"
47
+ AZURE_DEPLOYMENT_KEY = "azure_deployment"
48
+ AZURE_AD_TOKEN_KEY = "azure_ad_token"
49
+
50
+ OPENAI_API_KEY = "OPENAI_API_KEY"
51
+ AZURE_OPENAI_API_KEY = "AZURE_OPENAI_API_KEY"
52
+ AZURE_OPENAI_AD_TOKEN = "AZURE_OPENAI_AD_TOKEN"
53
+
54
+ def __init__(self, resource_name: str, config: _cfg.PluginConfig):
55
+
56
+ log_name = f"{OpenAIPlugin.__module__}.{OpenAIPlugin.__name__}"
57
+ self.__log = logging.getLogger(log_name)
58
+
59
+ self.__resource_name = resource_name
60
+ self.__protocol = config.protocol
61
+ self.__sub_protocol = config.subProtocol
62
+
63
+ self.__organization = _util.read_plugin_config(config, self.ORGANIZATION_KEY, optional=True)
64
+ self.__project = _util.read_plugin_config(config, self.PROJECT_KEY, optional=True)
65
+ self.__base_url = _util.read_plugin_config(config, self.BASE_URL_KEY, optional=True)
66
+ self.__timeout = _util.read_plugin_config(config, self.TIMEOUT_KEY, default=openai.DEFAULT_TIMEOUT.read, convert=float)
67
+ self.__max_retries = _util.read_plugin_config(config, self.MAX_RETRIES_KEY, default=openai.DEFAULT_MAX_RETRIES, convert=int)
68
+
69
+ self.__api_version = _util.read_plugin_config(config, self.API_VERSION_KEY, optional=True)
70
+ self.__azure_endpoint = _util.read_plugin_config(config, self.AZURE_ENDPOINT_KEY, optional=True)
71
+ self.__azure_deployment = _util.read_plugin_config(config, self.AZURE_DEPLOYMENT_KEY, optional=True)
72
+
73
+ if _util.has_plugin_config(config, self.API_KEY_KEY):
74
+ api_key = _util.read_plugin_config(config, self.API_KEY_KEY)
75
+ self.__api_key_func = lambda: api_key
76
+ else:
77
+ self.__api_key_func = None
78
+
79
+ if _util.has_plugin_config(config, self.AZURE_AD_TOKEN_KEY):
80
+ ad_token = _util.read_plugin_config(config, self.AZURE_AD_TOKEN_KEY)
81
+ self.__azure_ad_token_func = lambda: ad_token
82
+ else:
83
+ self.__azure_ad_token_func = None
84
+
85
+ self.__factory_queue = queue.Queue()
86
+ self.__factory_thread = threading.Thread(name="openai-factory", target=self.__factory_main, daemon=True)
87
+ self.__factory_thread.start()
88
+ self.__warmed_up = False
89
+
90
+ # Do not print info-level logs from the low-level frameworks
91
+ # HTTPX logs every request by default
92
+ logging.getLogger("httpx").setLevel(logging.WARNING)
93
+ logging.getLogger("httpcore").setLevel(logging.WARNING)
94
+ logging.getLogger("openai").setLevel(logging.WARNING)
95
+
96
+ def supported_types(self) -> list[type]:
97
+
98
+ supported_types = [openai.OpenAI]
99
+
100
+ if openai.AzureOpenAI is not None:
101
+ supported_types.append(openai.AzureOpenAI)
102
+
103
+ return supported_types
104
+
105
+ def supported_args(self) -> dict[str, type] | None:
106
+
107
+ return {
108
+ self.TIMEOUT_KEY: float,
109
+ self.MAX_RETRIES_KEY: int
110
+ }
111
+
112
+ def create_client(self, client_type: type, **client_args) -> object:
113
+
114
+ future = fut.Future()
115
+ msg = (lambda: self._create_client_internal(client_type, **client_args), future)
116
+
117
+ self.__factory_queue.put(msg)
118
+
119
+ return future.result()
120
+
121
+ def _create_client_internal(self, client_type: type, **client_args) -> object:
122
+
123
+ if client_type == openai.OpenAI:
124
+ if self.__sub_protocol:
125
+ detail = f"The resource [{self.__resource_name }] is configured with sub protocol = [{self.__sub_protocol}]"
126
+ raise _ex.ERuntimeValidation(f"Cannot create OpenAI client: {detail}")
127
+ else:
128
+ return self._create_client_std(**client_args)
129
+
130
+ if openai.AzureOpenAI and client_type == openai.AzureOpenAI:
131
+ if self.__sub_protocol != self.AZURE_SUB_PROTOCOL:
132
+ detail = f"The resource [{self.__resource_name }] is configured with sub protocol = [{self.__sub_protocol}]"
133
+ raise _ex.ERuntimeValidation(f"Cannot create Azure OpenAI client: {detail}")
134
+ else:
135
+ return self._create_client_azure(**client_args)
136
+
137
+ raise _ex.EPluginNotAvailable(f"Client type [{client_type.__qualname__}] is not available in {self.__class__.__name__}")
138
+
139
+ def _create_client_std(self, **client_args):
140
+
141
+ std_args = self._build_std_args(**client_args)
142
+ return openai.OpenAI(**std_args)
143
+
144
+ def _create_client_azure(self, **client_args):
145
+
146
+ azure_args = self._build_azure_args(**client_args)
147
+ return openai.AzureOpenAI(**azure_args)
148
+
149
+ def _build_std_args(self, **client_args):
150
+
151
+ args = self._build_common_args(**client_args)
152
+
153
+ if self.__api_key_func:
154
+ api_key = self.__api_key_func()
155
+ else:
156
+ api_key = os.getenv(self.OPENAI_API_KEY)
157
+
158
+ if api_key:
159
+ args[self.API_KEY_KEY] = lambda: api_key
160
+
161
+ return args
162
+
163
+ def _build_azure_args(self, **client_args):
164
+
165
+ args = self._build_common_args(**client_args)
166
+
167
+ self._optional_arg(args, self.API_VERSION_KEY, self.__api_version)
168
+ self._optional_arg(args, self.AZURE_ENDPOINT_KEY, self.__azure_endpoint)
169
+ self._optional_arg(args, self.AZURE_DEPLOYMENT_KEY, self.__azure_deployment)
170
+
171
+ if self.__api_key_func:
172
+ api_key = self.__api_key_func()
173
+ else:
174
+ api_key = os.getenv(self.AZURE_OPENAI_API_KEY)
175
+
176
+ if api_key:
177
+ args[self.API_KEY_KEY] = api_key
178
+
179
+ if self.__azure_ad_token_func:
180
+ azure_ad_token = self.__azure_ad_token_func()
181
+ else:
182
+ azure_ad_token = os.getenv(self.AZURE_OPENAI_AD_TOKEN)
183
+
184
+ if azure_ad_token is not None:
185
+ args[self.AZURE_AD_TOKEN_KEY] = azure_ad_token
186
+
187
+ return args
188
+
189
+ def _build_common_args(self, **client_args):
190
+
191
+ args = dict()
192
+
193
+ self._optional_arg(args, self.ORGANIZATION_KEY, self.__organization)
194
+ self._optional_arg(args, self.PROJECT_KEY, self.__project)
195
+ self._optional_arg(args, self.BASE_URL_KEY, self.__base_url)
196
+
197
+ if self.TIMEOUT_KEY in client_args:
198
+ args[self.TIMEOUT_KEY] = min(client_args[self.TIMEOUT_KEY], self.__timeout)
199
+ else:
200
+ args[self.TIMEOUT_KEY] = self.__timeout
201
+
202
+ if self.MAX_RETRIES_KEY in client_args:
203
+ args[self.MAX_RETRIES_KEY] = min(client_args[self.MAX_RETRIES_KEY], self.__max_retries)
204
+ else:
205
+ args[self.MAX_RETRIES_KEY] = self.__max_retries
206
+
207
+ return args
208
+
209
+ @staticmethod
210
+ def _optional_arg(args, key, value):
211
+
212
+ if value is not None:
213
+ args[key] = value
214
+
215
+ def close_client(self, client: object):
216
+
217
+ client.close() # noqa
218
+
219
+ def __factory_main(self):
220
+
221
+ # OpenAI uses asyncio under the hood, even for synchronous clients
222
+ # TRAC Actor threads have their own synchronization logic that interferes with AIO
223
+ # These issues can be avoided by creating OpenAI clients on a dedicated factory thread
224
+ # Initialization also happens on first use, so there has to be a warmup call as well
225
+
226
+ while True:
227
+
228
+ create_func, future = self.__factory_queue.get()
229
+ client = None
230
+
231
+ try:
232
+
233
+ client = create_func()
234
+
235
+ if not self.__warmed_up:
236
+ self.__warmup_client(client)
237
+ self.__warmed_up = True
238
+
239
+ future.set_result(client)
240
+
241
+ except Exception as e:
242
+
243
+ if client is not None:
244
+ client.close()
245
+
246
+ future.set_exception(e)
247
+
248
+ def __warmup_client(self, client):
249
+
250
+ self.__log.info("Warming up the OpenAI client...")
251
+
252
+ model_list = client.models.list()
253
+ model_count = len(model_list.data)
254
+
255
+ self.__log.info(f"Warmup complete: Found {model_count} models (there may be more)")
256
+
257
+
258
+ if openai:
259
+ _plugins.PluginManager.register_plugin(
260
+ _external.IExternalSystem, OpenAIPlugin,
261
+ protocols=["openai"])
@@ -0,0 +1,214 @@
1
+ Metadata-Version: 2.4
2
+ Name: tracdap-ext-openai
3
+ Version: 0.10.0b1
4
+ Summary: An extension for TRAC D.A.P. that lets models connect to OpenAI endpoints
5
+ Author-email: Martin Traverse <martin@fintrac.co.uk>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://tracdap.finos.org/
8
+ Project-URL: Documentation, https://tracdap.readthedocs.io/
9
+ Project-URL: Source Code, https://github.com/finos/tracdap
10
+ Project-URL: Issue Tracker, https://github.com/finos/tracdap/issues
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Intended Audience :: End Users/Desktop
19
+ Classifier: Intended Audience :: Financial and Insurance Industry
20
+ Classifier: Topic :: Office/Business
21
+ Classifier: Topic :: Office/Business :: Financial
22
+ Classifier: Topic :: Software Development
23
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: tracdap-runtime>=0.10.0-beta.1
29
+ Requires-Dist: openai~=1.0
30
+ Dynamic: license-file
31
+
32
+ <h1 align="center">
33
+
34
+ ![tracdap](https://github.com/finos/tracdap/raw/main/doc/_images/tracmmp_horizontal_400.png)
35
+
36
+ </h1>
37
+
38
+ <p align="center">
39
+ <a href="https://pypi.org/project/tracdap-ext-openai"><img alt="PyPI Version" src="https://img.shields.io/pypi/v/tracdap-ext-openai.svg?maxAge=3600" /></a>
40
+ <a href="https://pypi.org/project/tracdap-ext-openai"><img alt="Python Versions" src="https://img.shields.io/pypi/pyversions/tracdap-ext-openai.svg?maxAge=3600" /></a>
41
+ <a href="https://github.com/finos/tracdap/actions/workflows/packaging.yaml?query=branch%3Amain"><img alt="Packaging status" src="https://github.com/finos/tracdap/actions/workflows/packaging.yaml/badge.svg?branch:main&workflow:CI" /></a>
42
+ <a href="https://github.com/finos/tracdap/actions/workflows/compliance.yaml?query=branch%3Amain"><img alt="Compliance status" src="https://github.com/finos/tracdap/actions/workflows/compliance.yaml/badge.svg?branch:main&workflow:CI" /></a>
43
+ <a href="https://community.finos.org/docs/governance/software-projects/stages/incubating/"><img alt="FINOS - Incubating" src="https://cdn.jsdelivr.net/gh/finos/contrib-toolbox@master/images/badge-incubating.svg" /></a>
44
+ </p>
45
+
46
+
47
+ # OpenAI Extension for the TRAC Model Runtime
48
+
49
+ This extension makes the OpenAI Python SDK available to use from inside a TRAC model.
50
+
51
+ - Use the native OpenAI client classes directly in TRAC model code
52
+ - Connection settings managed by TRAC for both local and deployed models
53
+ - Supports both OpenAI and AzureOpenAI clients
54
+
55
+ Models that make external calls are not considered repeatable,
56
+ and will be flagged as not repeatable when they run on the TRAC platform.
57
+
58
+ This extension is a pre-release and will be finalized inTRAC 0.10.
59
+
60
+
61
+ ## Installing
62
+
63
+ The OpenAI extension can be installed with [pip](https://pip.pypa.io):
64
+
65
+ ```shell
66
+ $ pip install tracdap-ext-openai
67
+ ```
68
+
69
+ The package has the following dependencies:
70
+
71
+ - tracdap-runtime (version 0.10.0-beta1 or later)
72
+ - openai (version 1.x)
73
+
74
+
75
+ ## Using the OpenAI client
76
+
77
+ Here is a minimum working example of a TRAC model using the OpenAI client:
78
+
79
+ ```python
80
+ import tracdap.rt.api as trac
81
+ import openai
82
+
83
+ class OpenAIModel(trac.TracModel):
84
+
85
+ # ... define parameters, inputs and outputs
86
+
87
+ def define_resources(self):
88
+
89
+ return {
90
+ "openai": trac.define_external_system("openai", openai.OpenAI),
91
+ }
92
+
93
+ def run_model(self, ctx: trac.TracContext):
94
+
95
+ with ctx.get_external_system("openai", openai.OpenAI) as client:
96
+
97
+ response = client.responses.create(
98
+ model="gpt-4o",
99
+ instructions="You are a coding assistant that talks like a pirate.",
100
+ input="How do I check if a Python object is an instance of a class?",
101
+ )
102
+
103
+ ctx.log.info(response.output_text)
104
+
105
+ if __name__ == '__main__':
106
+ import tracdap.rt.launch as launch
107
+ launch.launch_model(OpenAIModel, "config/job_config.yaml", "config/sys_config.yaml")
108
+ ```
109
+
110
+ To make this example work, you will need to add ``openai`` as a resource in the system config file:
111
+
112
+ ```yaml
113
+ resources:
114
+
115
+ openai:
116
+ resourceType: EXTERNAL_SYSTEM
117
+ protocol: openai
118
+ ```
119
+
120
+ The client can be customized by setting additional properties on the resource,
121
+ which are passed through to the OpenAI client.
122
+
123
+ ```yaml
124
+ resources:
125
+
126
+ openai:
127
+ resourceType: EXTERNAL_SYSTEM
128
+ protocol: openai
129
+ properties:
130
+ project: proj_xxxxxxxxxxxxx
131
+ ```
132
+
133
+ The following configuration properties are supported:
134
+
135
+ - api_key, string, required
136
+ - organization, string, optional
137
+ - project, string, optional
138
+ - base_url, string, default = https://api.openai.com/v1/
139
+ - timeout, float, defeault = openai.DEFAULT_TIMEOUT.read (currently 600 seconds)
140
+ - max_retries, int, default = openai.DEFAULT_MAX_RETRIES (currently 2)
141
+
142
+ The ``api_key`` should not be put into a config file in plain text,
143
+ for local development it is recommended to set the OPENAI_API_KEY environment variable instead.
144
+ If both the config property and the environment variable are set, the config property takes precedence.
145
+
146
+
147
+ ## Using the AzureOpenAI client
148
+
149
+ Here is a minimum working example of a TRAC model using the AzureOpenAI client.
150
+ This assumes the required resources and deployments have been set up in Azure.
151
+
152
+ ```python
153
+ import tracdap.rt.api as trac
154
+ import openai
155
+
156
+ class TestModel(trac.TracModel):
157
+
158
+ # ... define parameters, inputs and outputs
159
+
160
+ def define_resources(self):
161
+
162
+ return {
163
+ "openai_azure": trac.define_external_system("openai", openai.AzureOpenAI)
164
+ }
165
+
166
+ def run_model(self, ctx: trac.TracContext):
167
+
168
+ with ctx.get_external_system("openai_azure", openai.AzureOpenAI) as client:
169
+
170
+ completion = client.chat.completions.create(
171
+ model="gpt-4.1-mini",
172
+ messages=[
173
+ { "role": "system", "content": "You are a coding assistant that talks like a pirate."},
174
+ { "role": "user", "content": "How do I check if a Python object is an instance of a class?" },
175
+ ]
176
+ )
177
+
178
+ ctx.log.info(completion.choices[0].message.content)
179
+
180
+ if __name__ == '__main__':
181
+ import tracdap.rt.launch as launch
182
+ launch.launch_model(TestModel, "config/job_config.yaml", "config/sys_config.yaml")
183
+ ```
184
+
185
+ To make this example work, you will need to add ``openai_azure`` as a resource in the system config file:
186
+
187
+ ```yaml
188
+ resources:
189
+
190
+ openai_azure:
191
+ resourceType: EXTERNAL_SYSTEM
192
+ protocol: openai
193
+ subProtocol: azure
194
+ properties:
195
+ api_version: 2025-04-01-preview
196
+ azure_endpoint: https://my-azure-endpoint.cognitiveservices.azure.com/
197
+ ```
198
+
199
+ Setting ``supProtcol: azure`` is required for to create an Azure client.
200
+ The ``api_version`` and ``azure_endpoint`` properties must be specified,
201
+ and ``model`` parameter in the client call must refer to live model deployment on that endpoint.
202
+
203
+ All the configuration properties supported by the regular client are also supported by the Azure client.
204
+ Additionally, the Azure client supports these extra properties:
205
+
206
+ - api_version, string, required
207
+ - azure_endpoint, string, required
208
+ - azure_deployment, string, optional
209
+ - azure_ad_token, string, optional
210
+
211
+ For he Azure client, if ``api_key`` is not specified in the config file
212
+ it is read from the environment variable ``AZURE_OPENAI_API_KEY``.
213
+ Similarly, ``azure_ad_token`` can be read from the environment variable ``AZURE_OPENAI_AD_TOKEN``.
214
+ If both the config property and the environment variable are set, the config property takes precedence.
@@ -0,0 +1,7 @@
1
+ tracdap/ext/openai/__init__.py,sha256=xtG8Z84ElFkWncawbntWtWg6CeVtLz55sjJMLs4l2e4,821
2
+ tracdap/ext/openai/openai_plugin.py,sha256=1TjV_XNT6FxayNy_I5vGyqlPCByQkEKkPqqrGG90Y3U,9364
3
+ tracdap_ext_openai-0.10.0b1.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
4
+ tracdap_ext_openai-0.10.0b1.dist-info/METADATA,sha256=ik9cluIaUSb_-vixOAem5u66r_39ANBlSdlpEb_-NsU,7881
5
+ tracdap_ext_openai-0.10.0b1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ tracdap_ext_openai-0.10.0b1.dist-info/top_level.txt,sha256=Uv0JfaE1Lp4JnCzqW8lqXNJAEcsAFpAUGOghJolVNdM,8
7
+ tracdap_ext_openai-0.10.0b1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -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.
@@ -0,0 +1 @@
1
+ tracdap