fluxqueue-cli 0.1.0__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 @@
1
+ __version__ = "0.1.0"
fluxqueue_cli/cli.py ADDED
@@ -0,0 +1,121 @@
1
+ import re
2
+ from typing import Annotated
3
+
4
+ import typer
5
+
6
+ from fluxqueue_cli.exceptions import InvalidVersionError
7
+ from fluxqueue_cli.worker import (
8
+ download_and_install,
9
+ start_worker,
10
+ update_worker,
11
+ )
12
+
13
+ app = typer.Typer()
14
+ worker_app = typer.Typer()
15
+
16
+ app.add_typer(worker_app, name="worker", help="Worker related commands.")
17
+
18
+
19
+ @app.command()
20
+ def start(
21
+ *,
22
+ concurrency: Annotated[
23
+ int,
24
+ typer.Option(
25
+ "--concurrency",
26
+ "-c",
27
+ envvar="FLUXQUEUE_CONCURRENCY",
28
+ help="Number of tasks to run in parallel.",
29
+ ),
30
+ ] = 4,
31
+ redis_url: Annotated[
32
+ str,
33
+ typer.Option(
34
+ "--redis-url",
35
+ "-r",
36
+ envvar="FLUXQUEUE_REDIS_URL",
37
+ help="Redis connection URL for the worker.",
38
+ ),
39
+ ] = "redis://127.0.0.1:6379",
40
+ tasks_module_path: Annotated[
41
+ str,
42
+ typer.Option(
43
+ "--tasks-module-path",
44
+ "-t",
45
+ envvar="FLUXQUEUE_TASKS_MODULE_PATH",
46
+ help="Python module path where task functions are defined (e.g. src.tasks).",
47
+ ),
48
+ ],
49
+ queue: Annotated[
50
+ str,
51
+ typer.Option(
52
+ "--queue",
53
+ "-q",
54
+ envvar="FLUXQUEUE_QUEUE",
55
+ help="Queue name the worker reads jobs from.",
56
+ ),
57
+ ] = "default",
58
+ save_dead_tasks: Annotated[
59
+ bool,
60
+ typer.Option(
61
+ is_flag=True,
62
+ help="Keep failed tasks that reached the retry limit so you can inspect them later.",
63
+ ),
64
+ ] = False,
65
+ ):
66
+ """
67
+ Start a [bold]fluxqueue[/bold] worker.
68
+ """
69
+ start_worker(
70
+ concurrency=concurrency,
71
+ redis_url=redis_url,
72
+ tasks_module_path=tasks_module_path,
73
+ queue=queue,
74
+ save_dead_tasks=save_dead_tasks,
75
+ )
76
+
77
+
78
+ @worker_app.command(name="install")
79
+ def worker_install(
80
+ version: Annotated[
81
+ str | None,
82
+ typer.Option(help="Version to install. If omitted, installs the latest."),
83
+ ] = None,
84
+ ):
85
+ """
86
+ Download and install [bold]fluxqueue-worker[/bold].
87
+ """
88
+ if version:
89
+ pattern = r"^\d+\.\d+\.\d+$"
90
+
91
+ if not re.match(pattern, version):
92
+ raise InvalidVersionError(
93
+ "Invalid version. Please use versions like: 0.1.0, 0.2.3"
94
+ )
95
+
96
+ download_and_install(version)
97
+
98
+
99
+ @worker_app.command(name="update")
100
+ def worker_update(
101
+ version: Annotated[
102
+ str | None,
103
+ typer.Option(help="Version to update to. If omitted, updates to the latest."),
104
+ ] = None,
105
+ no_backup: Annotated[
106
+ bool,
107
+ typer.Option(
108
+ is_flag=True,
109
+ flag_value=False,
110
+ help="Skip keeping a backup of the old binary when updating.",
111
+ ),
112
+ ] = False,
113
+ ):
114
+ """
115
+ Update [bold]fluxqueue-worker[/bold].
116
+ """
117
+ update_worker(version=version, no_backup=no_backup)
118
+
119
+
120
+ if __name__ == "__main__":
121
+ app()
@@ -0,0 +1,18 @@
1
+ class ReleaseNotFoundError(Exception):
2
+ pass
3
+
4
+
5
+ class InvalidVersionError(Exception):
6
+ pass
7
+
8
+
9
+ class AlreadyInstalledError(Exception):
10
+ pass
11
+
12
+
13
+ class BinaryNotFoundError(Exception):
14
+ pass
15
+
16
+
17
+ class NotInstalledError(Exception):
18
+ pass
@@ -0,0 +1,283 @@
1
+ import os
2
+ import platform
3
+ import shutil
4
+ import subprocess
5
+ import sys
6
+ import tarfile
7
+ import tempfile
8
+ import zipfile
9
+ from pathlib import Path
10
+
11
+ import requests
12
+
13
+ from fluxqueue_cli.exceptions import (
14
+ AlreadyInstalledError,
15
+ BinaryNotFoundError,
16
+ InvalidVersionError,
17
+ NotInstalledError,
18
+ ReleaseNotFoundError,
19
+ )
20
+
21
+ REPO = "CCXLV/fluxqueue"
22
+ BINARY_NAME = "fluxqueue-worker"
23
+ if platform.system() == "Windows":
24
+ user_profile = os.environ.get("USERPROFILE", os.path.expanduser("~"))
25
+ install_dir = os.path.join(user_profile, ".fluxqueue", "bin")
26
+ INSTALL_DIR = install_dir
27
+ else:
28
+ INSTALL_DIR = "/usr/local/bin"
29
+
30
+
31
+ def start_worker(
32
+ *,
33
+ concurrency: int,
34
+ redis_url: str,
35
+ tasks_module_path: str,
36
+ queue: str,
37
+ save_dead_tasks=False,
38
+ ):
39
+ # fmt: off
40
+ arguments = [
41
+ "--concurrency", str(concurrency),
42
+ "--redis-url", redis_url,
43
+ "--tasks-module-path", tasks_module_path,
44
+ "--queue", queue,
45
+ ]
46
+ # fmt: on
47
+
48
+ if save_dead_tasks:
49
+ arguments.append("--save-dead-tasks")
50
+
51
+ subprocess.run(
52
+ ["fluxqueue-worker", *arguments],
53
+ stdin=sys.stdin,
54
+ stdout=sys.stdout,
55
+ stderr=sys.stderr,
56
+ )
57
+
58
+
59
+ def get_worker_version() -> str | None:
60
+ try:
61
+ result = subprocess.run(
62
+ ["fluxqueue-worker", "--version"],
63
+ check=True,
64
+ capture_output=True,
65
+ text=True,
66
+ )
67
+ return result.stdout.replace("fluxqueue-worker", "").strip()
68
+ except (FileNotFoundError, subprocess.CalledProcessError):
69
+ return None
70
+
71
+
72
+ def get_worker_release(version: str | None = None):
73
+ headers = {
74
+ "Accept": "application/vnd.github.v3+json",
75
+ }
76
+ api_url = f"https://api.github.com/repos/{REPO}/releases"
77
+ response = requests.get(api_url, headers=headers)
78
+ response.raise_for_status()
79
+
80
+ worker_releases = []
81
+ for r in response.json():
82
+ tag = r["tag_name"]
83
+ if tag.startswith("worker-v"):
84
+ version_str = tag[len("worker-v") :]
85
+ r["extracted_version"] = version_str
86
+ worker_releases.append(r)
87
+
88
+ if not worker_releases:
89
+ raise ReleaseNotFoundError("No worker releases found.")
90
+
91
+ if version:
92
+ for r in worker_releases:
93
+ if r["extracted_version"] == version:
94
+ return r
95
+ available = [r["extracted_version"] for r in worker_releases]
96
+ raise InvalidVersionError(
97
+ f"Worker version {version} not found.\n"
98
+ f"Available versions: {', '.join(available)}"
99
+ )
100
+ return worker_releases[0]
101
+
102
+
103
+ def download_worker_binary(version: str | None = None):
104
+ release = get_worker_release(version)
105
+ version = release["extracted_version"]
106
+
107
+ py_version = f"{sys.version_info.major}.{sys.version_info.minor}"
108
+ system = platform.system().lower()
109
+
110
+ print(f"Detected: Python {py_version} on {system}")
111
+ print(f"Fetching latest worker: {version}")
112
+ asset_api_url = None
113
+ target_name: str | None = None
114
+ for asset in release["assets"]:
115
+ name = asset["name"]
116
+ if f"py{py_version}" in name and system in name:
117
+ asset_api_url = asset["url"]
118
+ target_name = str(name)
119
+ break
120
+
121
+ if not asset_api_url or not target_name:
122
+ raise BinaryNotFoundError(
123
+ f"No binary found for Python {py_version} on {system}."
124
+ )
125
+
126
+ print(f"Downloading {target_name} via API...")
127
+
128
+ headers = {
129
+ "Accept": "application/octet-stream",
130
+ }
131
+
132
+ try:
133
+ r = requests.get(asset_api_url, headers=headers, stream=True)
134
+ r.raise_for_status()
135
+ except:
136
+ delete_installed_files(target_name)
137
+ raise
138
+
139
+ with tempfile.NamedTemporaryFile(prefix=target_name, delete=False) as f:
140
+ temp_path = Path(f.name)
141
+ shutil.copyfileobj(r.raw, f)
142
+
143
+ return str(temp_path), target_name
144
+
145
+
146
+ def install_worker(*, actual_file_name: str, temp_file_path: str, overwrite=False):
147
+ if platform.system() == "Windows":
148
+ dest_path = Path(INSTALL_DIR) / f"{BINARY_NAME}.exe"
149
+ else:
150
+ dest_path = Path(INSTALL_DIR) / BINARY_NAME
151
+ if dest_path.exists() and not overwrite:
152
+ raise FileExistsError(f"fluxqueue-worker is already installed at {dest_path}")
153
+
154
+ # Linux
155
+ if actual_file_name.endswith(".tar.gz"):
156
+ with tarfile.open(temp_file_path, "r:gz") as tar:
157
+ try:
158
+ tar.extractall(path=".", filter="data")
159
+
160
+ os.chmod(BINARY_NAME, 0o755)
161
+
162
+ shutil.copy2(BINARY_NAME, dest_path)
163
+ delete_installed_files(temp_file_path)
164
+ except:
165
+ delete_installed_files(temp_file_path)
166
+ raise
167
+ # macOS + Windows
168
+ elif actual_file_name.endswith(".zip"):
169
+ with tempfile.TemporaryDirectory() as extract_temp_dir:
170
+ with zipfile.ZipFile(temp_file_path, "r") as zip_file:
171
+ zip_file.extractall(extract_temp_dir)
172
+
173
+ exe_name = (
174
+ f"{BINARY_NAME}.exe" if platform.system() == "Windows" else BINARY_NAME
175
+ )
176
+ found_binary = None
177
+
178
+ for root, _dirs, files in os.walk(extract_temp_dir):
179
+ if exe_name in files:
180
+ found_binary = Path(root) / exe_name
181
+ break
182
+
183
+ if not found_binary:
184
+ for root, _dirs, files in os.walk(extract_temp_dir):
185
+ for file in files:
186
+ if BINARY_NAME in file and (
187
+ platform.system() != "Windows" or file.endswith(".exe")
188
+ ):
189
+ found_binary = Path(root) / file
190
+ break
191
+ if found_binary:
192
+ break
193
+
194
+ if not found_binary:
195
+ try:
196
+ os.remove(temp_file_path)
197
+ except PermissionError:
198
+ raise PermissionError(
199
+ f"Permission denied: Could not remove temporary file {temp_file_path}. "
200
+ "Please remove it manually."
201
+ ) from None
202
+ except OSError as e:
203
+ if e.errno == 13: # Permission denied (EACCES)
204
+ raise PermissionError(
205
+ f"Permission denied: Could not remove temporary file {temp_file_path}. "
206
+ "Please remove it manually."
207
+ ) from e
208
+ raise BinaryNotFoundError(
209
+ f"Could not find {exe_name} in the downloaded archive."
210
+ )
211
+
212
+ dest_path.parent.mkdir(parents=True, exist_ok=True)
213
+ shutil.copy2(found_binary, dest_path)
214
+
215
+ if platform.system() != "Windows":
216
+ os.chmod(dest_path, 0o755)
217
+ try:
218
+ os.remove(temp_file_path)
219
+ except PermissionError:
220
+ raise PermissionError(
221
+ f"Permission denied: Could not remove temporary file {temp_file_path}. "
222
+ "Please remove it manually."
223
+ ) from None
224
+ except OSError as e:
225
+ if e.errno == 13: # Permission denied (EACCES)
226
+ raise PermissionError(
227
+ f"Permission denied: Could not remove temporary file {temp_file_path}. "
228
+ "Please remove it manually."
229
+ ) from e
230
+ raise
231
+ else:
232
+ delete_installed_files(temp_file_path)
233
+ raise NotImplementedError("Only .tar.gz installation is implemented yet.")
234
+
235
+ print(f"Successfully installed {BINARY_NAME} to {INSTALL_DIR}")
236
+
237
+
238
+ def download_and_install(version: str | None = None):
239
+ if shutil.which("fluxqueue-worker"):
240
+ raise AlreadyInstalledError(
241
+ "fluxqueue-worker is already installed, use `fluxqueue worker update` command to update it."
242
+ )
243
+
244
+ temp_path, target_name = download_worker_binary(version)
245
+ install_worker(actual_file_name=target_name, temp_file_path=temp_path)
246
+
247
+
248
+ def update_worker(*, version: str | None = None, no_backup: bool = False):
249
+ current_version = get_worker_version()
250
+
251
+ if not current_version:
252
+ raise NotInstalledError(
253
+ "fluxqueue-worker is not installed. Use `fluxqueue worker install` to install it."
254
+ )
255
+
256
+ print(f"Current Version: {current_version}")
257
+ if version:
258
+ print(f"Desired Version: {version}")
259
+
260
+ if platform.system() == "Windows":
261
+ dest_path = os.path.join(INSTALL_DIR, f"{BINARY_NAME}.exe")
262
+ backup_suffix = ".exe.backup"
263
+ else:
264
+ dest_path = os.path.join(INSTALL_DIR, BINARY_NAME)
265
+ backup_suffix = ".backup"
266
+
267
+ if not no_backup:
268
+ new_name = os.path.join(
269
+ INSTALL_DIR, f"{BINARY_NAME}-{current_version}{backup_suffix}"
270
+ )
271
+ os.rename(dest_path, new_name)
272
+
273
+ temp_path, target_name = download_worker_binary(version)
274
+ install_worker(
275
+ actual_file_name=target_name,
276
+ temp_file_path=temp_path,
277
+ overwrite=no_backup,
278
+ )
279
+
280
+
281
+ def delete_installed_files(temp_path: str):
282
+ os.remove(BINARY_NAME)
283
+ os.remove(temp_path)
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.4
2
+ Name: fluxqueue-cli
3
+ Version: 0.1.0
4
+ Summary: A command-line tool for installing and running FluxQueue workers
5
+ Author-Email: Giorgi Merebashvili <mereba2627@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ Requires-Python: <3.15,>=3.11
9
+ Requires-Dist: typer>=0.17.0
10
+ Requires-Dist: requests>=2.29.0
11
+ Provides-Extra: dev
12
+ Requires-Dist: ruff; extra == "dev"
13
+ Requires-Dist: pdm; extra == "dev"
14
+ Description-Content-Type: text/markdown
15
+
16
+ ## FluxQueue CLI
17
+
18
+ A command-line tool for installing and running [FluxQueue](https://github.com/CCXLV/fluxqueue) workers.
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ pip install fluxqueue-cli
24
+ ```
25
+
26
+ ## Installing the Worker
27
+
28
+ Use the CLI to install the worker on your system:
29
+
30
+ ```bash
31
+ fluxqueue worker install
32
+ ```
33
+
34
+ ## Starting a Worker
35
+
36
+ To start a worker, provide the path to the module where your tasks are defined and exported:
37
+
38
+ ```bash
39
+ fluxqueue start --tasks-module-path src/tasks
40
+ ```
41
+
42
+ ## Documentation
43
+
44
+ For more information and documenation about the usage please visit [FluxQueue Documentation](https://fluxqueue.ccxlv.dev).
45
+
46
+ ## License
47
+
48
+ FluxQueue is licensed under the Apache-2.0 license. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,9 @@
1
+ fluxqueue_cli-0.1.0.dist-info/METADATA,sha256=rjPqWOjqtRUN1xrqNFnpb5uXVNav_9a1sGWDyTDIFII,1175
2
+ fluxqueue_cli-0.1.0.dist-info/WHEEL,sha256=Wb0ASbVj8JvWHpOiIpPi7ucfIgJeCi__PzivviEAQFc,90
3
+ fluxqueue_cli-0.1.0.dist-info/entry_points.txt,sha256=JN_hvRiIt9uWTy_80IhpsF7ZzEs6SQQAJfJTPEgBsRI,68
4
+ fluxqueue_cli-0.1.0.dist-info/licenses/LICENSE,sha256=QPVewe_5g9Ef98z-7_5345dT15DAvECrgyH82Rp3IKI,10209
5
+ fluxqueue_cli/__init__.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
6
+ fluxqueue_cli/cli.py,sha256=tSPqEFpz8ZQolMHUxOZl2R3Nmka0mIVLlj8DV6JtMjQ,2938
7
+ fluxqueue_cli/exceptions.py,sha256=6U5xHlYLGOGwZ_9FWEiJhVomIhOU8hKIcvsAI_gxj1k,244
8
+ fluxqueue_cli/worker.py,sha256=I0ufla0tACPnQcSNX-LUt2duCzkl4u0HU-aqyyjoS1g,9100
9
+ fluxqueue_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: pdm-backend (2.4.7)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ fluxqueue = fluxqueue_cli.cli:app
3
+
4
+ [gui_scripts]
5
+
@@ -0,0 +1,178 @@
1
+ Copyright 2026 Giorgi Merebashvili
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS