astrobasis 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.
astrobasis/__init__.py ADDED
@@ -0,0 +1,20 @@
1
+ """AstroBasis 天枢 — monorepo 纯机制层,零第三方依赖。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from astrobasis._atomic import atomic_write_json
6
+ from astrobasis._json_compat import json_dumps
7
+ from astrobasis._logging import JsonLogFormatter, LogfmtFormatter, LogfmtLogger, setup_root_logger
8
+ from astrobasis._types import AsyncCloseable
9
+ from astrobasis._version import __version__
10
+
11
+ __all__ = [
12
+ "AsyncCloseable",
13
+ "JsonLogFormatter",
14
+ "LogfmtFormatter",
15
+ "LogfmtLogger",
16
+ "json_dumps",
17
+ "__version__",
18
+ "atomic_write_json",
19
+ "setup_root_logger",
20
+ ]
astrobasis/_atomic.py ADDED
@@ -0,0 +1,64 @@
1
+ """POSIX atomic file replacement primitive — mkstemp → write → fsync → os.replace → chmod.
2
+
3
+ Equivalent to SQLite WAL / PostgreSQL WAL / systemd-journald / Git core.fsync.
4
+ All rules engine and preferences JSON write paths use this primitive.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import json
10
+ import os
11
+ import tempfile
12
+ from typing import TYPE_CHECKING, Any
13
+
14
+ from astrobasis._logging import LogfmtLogger
15
+
16
+ if TYPE_CHECKING:
17
+ from pathlib import Path
18
+
19
+ logger = LogfmtLogger("astrobasis.atomic")
20
+
21
+
22
+ def atomic_write_json(
23
+ path: Path,
24
+ data: Any,
25
+ *,
26
+ max_bytes: int | None = None,
27
+ chmod_mask: int | None = 0o600,
28
+ ) -> None:
29
+ """POSIX atomic file replacement protocol: mkstemp → write → fsync → os.replace → chmod.
30
+
31
+ Args:
32
+ path: Target file path.
33
+ data: json.dumps-compatible object.
34
+ max_bytes: Size check before writing, raises ValueError if exceeded. None to skip.
35
+ chmod_mask: File permission after write. None to skip chmod.
36
+ """
37
+ content = json.dumps(data, ensure_ascii=False, indent=2) + "\n"
38
+ content_bytes = content.encode("utf-8")
39
+
40
+ if max_bytes is not None and len(content_bytes) > max_bytes:
41
+ raise ValueError(f"Data size {len(content_bytes)} exceeds limit {max_bytes}")
42
+
43
+ parent = path.parent
44
+ parent.mkdir(parents=True, exist_ok=True)
45
+
46
+ fd, tmp_path = tempfile.mkstemp(suffix=".tmp", prefix=path.name + ".", dir=parent)
47
+ try:
48
+ with os.fdopen(fd, "wb") as f:
49
+ f.write(content_bytes)
50
+ f.flush()
51
+ os.fsync(f.fileno())
52
+ os.replace(tmp_path, path)
53
+ except Exception:
54
+ try:
55
+ os.unlink(tmp_path)
56
+ except OSError:
57
+ pass
58
+ raise
59
+
60
+ if chmod_mask is not None:
61
+ try:
62
+ os.chmod(path, chmod_mask)
63
+ except OSError:
64
+ logger.debug("atomic_write_chmod_failed", path=path)
@@ -0,0 +1,28 @@
1
+ """JSON serialization compatibility layer — prefer orjson for speed, fall back to stdlib json.
2
+
3
+ Strategy: json_dumps always returns bytes ending with \n (JSONL format).
4
+ Callers can write directly to io.BytesIO, no str→bytes decode needed.
5
+ Mechanism: orjson is an optional accelerated backend ([fast] extra); transparently
6
+ falls back to stdlib json when not installed.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import json
12
+ from typing import Any
13
+
14
+ from astrobasis._logging import LogfmtLogger
15
+
16
+ logger = LogfmtLogger("astrobasis.json_compat")
17
+
18
+ try:
19
+ import orjson as _json_mod
20
+
21
+ def json_dumps(obj: Any) -> bytes:
22
+ return _json_mod.dumps(obj, option=_json_mod.OPT_APPEND_NEWLINE) # type: ignore[no-any-return]
23
+
24
+ except ImportError:
25
+ logger.debug("orjson_unavailable", dumper="stdlib")
26
+
27
+ def json_dumps(obj: Any) -> bytes:
28
+ return (json.dumps(obj, ensure_ascii=False) + "\n").encode("utf-8")
astrobasis/_logging.py ADDED
@@ -0,0 +1,261 @@
1
+ """LogfmtLogger — 纯 logfmt 格式日志(event 强制位置参数 + **kwargs 键值对渲染)。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import logging
7
+ import re
8
+ import sys
9
+ from typing import Literal
10
+
11
+ _FILE_LOG_MAX_BYTES = 10 * 1024 * 1024
12
+ _FILE_LOG_BACKUP_COUNT = 3
13
+
14
+ _LOG_FORMAT = "%(asctime)s [%(levelname)s] %(name)s: %(message)s"
15
+ _LOG_DATE_FORMAT = "%H:%M:%S"
16
+ _ASTROBASIS_HANDLER = True # handler marker tag — used for setup_root_logger dedup
17
+
18
+ _LOGFRMT_NEEDS_QUOTE = re.compile(r'[\s"]')
19
+
20
+
21
+ def _logfmt_escape(value: object) -> str:
22
+ """Escape a value per Brandur Leach logfmt spec, single-line guaranteed.
23
+
24
+ Control characters (\n, \r, \t) are replaced with spaces.
25
+ Values containing spaces or double-quotes are quoted and internal special chars escaped.
26
+ """
27
+ if value is None:
28
+ return "null"
29
+ if isinstance(value, bool):
30
+ return "true" if value else "false"
31
+ if isinstance(value, (int, float)):
32
+ return str(value)
33
+ s = str(value).replace("\n", " ").replace("\r", " ").replace("\t", " ")
34
+ if not s:
35
+ return '""'
36
+ if _LOGFRMT_NEEDS_QUOTE.search(s):
37
+ escaped = s.replace("\\", "\\\\").replace('"', '\\"')
38
+ return f'"{escaped}"'
39
+ return s
40
+
41
+
42
+ def _format_exc_oneline(exc_info: tuple | None) -> str:
43
+ """Single-line exception summary: ``TypeError: msg at /path/file.py:42``.
44
+
45
+ For console logfmt output — full traceback is preserved in file logs.
46
+ """
47
+ if not exc_info or exc_info[0] is None:
48
+ return ""
49
+ exc_type, exc_value, exc_tb = exc_info
50
+ msg = str(exc_value) if exc_value else ""
51
+ if exc_tb:
52
+ while exc_tb.tb_next:
53
+ exc_tb = exc_tb.tb_next
54
+ return f"{exc_type.__name__}: {msg} at {exc_tb.tb_frame.f_code.co_filename}:{exc_tb.tb_lineno}"
55
+ return f"{exc_type.__name__}: {msg}"
56
+
57
+
58
+ def _format_logfmt_message(event: str, fields: dict[str, object]) -> str:
59
+ """Build logfmt message body fragment: ``event=xxx key=value ...``
60
+
61
+ Called by LogfmtLogger._log() to pre-build the msg string passed to stdlib logger.
62
+ The Formatter obtains this fragment via record.getMessage().
63
+ """
64
+ parts = [f"event={_logfmt_escape(event)}"]
65
+ for k, v in fields.items():
66
+ parts.append(f"{_logfmt_escape(k)}={_logfmt_escape(v)}")
67
+ return " ".join(parts)
68
+
69
+
70
+ class LogfmtFormatter(logging.Formatter):
71
+ """Console + GUI log panel use. One line of pure logfmt per record.
72
+
73
+ All records get their message body via record.getMessage() —
74
+ LogfmtLogger pre-builds "event=xxx key=value" as msg in _log();
75
+ legacy records have the original "event=xxx ..." format string after %-formatting.
76
+ The Formatter only wraps metadata (ts/level/logger/thread) and exception summary.
77
+ """
78
+
79
+ def format(self, record: logging.LogRecord) -> str:
80
+ record.asctime = self.formatTime(record, self.datefmt)
81
+ parts = [
82
+ f"ts={record.asctime}",
83
+ f"level={record.levelname.lower()}",
84
+ f"logger={record.name}",
85
+ ]
86
+ if record.threadName != "MainThread":
87
+ parts.append(f"thread={_logfmt_escape(record.threadName)}")
88
+
89
+ parts.append(record.getMessage())
90
+
91
+ if record.exc_info and record.exc_info[0] is not None:
92
+ parts.append(f"error={_logfmt_escape(_format_exc_oneline(record.exc_info))}")
93
+ return " ".join(parts)
94
+
95
+
96
+ class JsonLogFormatter(logging.Formatter):
97
+ """JSON Lines format (file output, for log aggregation systems).
98
+
99
+ Not enabled by default — explicitly enable via setup_root_logger(json_file=True).
100
+ Structured records read _logfmt_event / _logfmt_fields from extra.
101
+ Legacy records fall back to msg field.
102
+ Exceptions preserve full multi-line traceback (files are for post-mortem analysis).
103
+
104
+ Note: exception handling before field loop — ensures data["error"] is written first,
105
+ so subsequent user fields named "error" trigger collision detection → field_error.
106
+ """
107
+
108
+ def format(self, record: logging.LogRecord) -> str:
109
+ record.asctime = self.formatTime(record, self.datefmt)
110
+ data: dict[str, object] = {
111
+ "ts": record.asctime,
112
+ "level": record.levelname.lower(),
113
+ "logger": record.name,
114
+ }
115
+ if record.threadName != "MainThread":
116
+ data["thread"] = record.threadName
117
+
118
+ event = getattr(record, "_logfmt_event", None)
119
+ if event is not None:
120
+ data["event"] = event
121
+ else:
122
+ data["msg"] = record.getMessage()
123
+
124
+ if record.exc_info and record.exc_info[0] is not None:
125
+ data["error"] = self.formatException(record.exc_info)
126
+
127
+ if event is not None:
128
+ fields = getattr(record, "_logfmt_fields", None)
129
+ if fields:
130
+ for k, v in fields.items():
131
+ data[f"field_{k}" if k in data else k] = v
132
+
133
+ return json.dumps(data, ensure_ascii=False, default=str)
134
+
135
+
136
+ class LogfmtLogger:
137
+ """logfmt structured logging wrapper. event is a mandatory positional argument.
138
+
139
+ Usage:
140
+ log = LogfmtLogger("astrobasis.mymodule")
141
+ log.info("crawl_start", depth=3, concurrency=4)
142
+ log.warning("slot_exhausted", idx=5, attempts=3, exc_info=True)
143
+ log.exception("crawl_error", url=url) # auto-attach traceback
144
+
145
+ # Pre-bound context
146
+ ctx_log = log.bind(crawl_id="abc123")
147
+ ctx_log.info("worker_start", idx=0) # auto-carries crawl_id
148
+ """
149
+
150
+ __slots__ = ("_logger", "_bound_fields")
151
+
152
+ def __init__(self, name: str, /, **bound: object) -> None:
153
+ self._logger = logging.getLogger(name)
154
+ self._bound_fields = bound
155
+
156
+ @property
157
+ def name(self) -> str:
158
+ return self._logger.name
159
+
160
+ def bind(self, **kwargs: object) -> LogfmtLogger:
161
+ """Return a new instance with additional bound context. Original unchanged."""
162
+ merged = type(self).__new__(type(self))
163
+ merged._logger = self._logger
164
+ merged._bound_fields = {**self._bound_fields, **kwargs}
165
+ return merged
166
+
167
+ def isEnabledFor(self, level: int) -> bool:
168
+ return self._logger.isEnabledFor(level)
169
+
170
+ def setLevel(self, level: int) -> None:
171
+ self._logger.setLevel(level)
172
+
173
+ def getEffectiveLevel(self) -> int:
174
+ return self._logger.getEffectiveLevel()
175
+
176
+ def debug(self, event: str, /, *, exc_info: bool = False, **fields: object) -> None:
177
+ if self._logger.isEnabledFor(logging.DEBUG):
178
+ self._log(logging.DEBUG, event, exc_info, fields)
179
+
180
+ def info(self, event: str, /, *, exc_info: bool = False, **fields: object) -> None:
181
+ if self._logger.isEnabledFor(logging.INFO):
182
+ self._log(logging.INFO, event, exc_info, fields)
183
+
184
+ def warning(self, event: str, /, *, exc_info: bool = False, **fields: object) -> None:
185
+ if self._logger.isEnabledFor(logging.WARNING):
186
+ self._log(logging.WARNING, event, exc_info, fields)
187
+
188
+ def error(self, event: str, /, *, exc_info: bool = False, **fields: object) -> None:
189
+ if self._logger.isEnabledFor(logging.ERROR):
190
+ self._log(logging.ERROR, event, exc_info, fields)
191
+
192
+ def critical(self, event: str, /, *, exc_info: bool = False, **fields: object) -> None:
193
+ if self._logger.isEnabledFor(logging.CRITICAL):
194
+ self._log(logging.CRITICAL, event, exc_info, fields)
195
+
196
+ def exception(self, event: str, /, **fields: object) -> None:
197
+ """Log at ERROR level with exception traceback. Must be called inside an except block."""
198
+ if self._logger.isEnabledFor(logging.ERROR):
199
+ self._log(logging.ERROR, event, True, fields)
200
+
201
+ def _log(self, level: int, event: str, exc_info: bool, fields: dict[str, object]) -> None:
202
+ """SSOT for all formatting logic.
203
+
204
+ Pre-builds the logfmt message body as msg passed to stdlib logger —
205
+ Formatter obtains it via record.getMessage(), no need to distinguish
206
+ structured vs legacy records.
207
+ _logfmt_event and _logfmt_fields are only injected via extra=, for JsonLogFormatter use.
208
+ """
209
+ merged = {**self._bound_fields, **fields}
210
+ msg = _format_logfmt_message(event, merged)
211
+ extra: dict[str, object] = {
212
+ "_logfmt_event": event,
213
+ "_logfmt_fields": merged,
214
+ }
215
+ self._logger.log(level, msg, exc_info=exc_info, extra=extra, stacklevel=2)
216
+
217
+
218
+ def setup_root_logger(
219
+ level: int = logging.INFO,
220
+ log_file: str = "",
221
+ *,
222
+ format_style: Literal["logfmt", "classic"] = "logfmt",
223
+ json_file: bool = False,
224
+ ) -> None:
225
+ """Configure root logger. format_style="classic" for one-click legacy rollback.
226
+
227
+ Console always uses LogfmtFormatter (or classic fallback). json_file only affects the file handler.
228
+ """
229
+ root = logging.getLogger()
230
+ root.setLevel(level)
231
+ for h in root.handlers[:]:
232
+ if getattr(h, "_astrobasis_handler", False):
233
+ root.removeHandler(h)
234
+
235
+ # Console handler
236
+ ch = logging.StreamHandler(sys.stdout)
237
+ ch._astrobasis_handler = _ASTROBASIS_HANDLER # type: ignore[attr-defined]
238
+ if format_style == "classic":
239
+ ch.setFormatter(logging.Formatter(_LOG_FORMAT, datefmt=_LOG_DATE_FORMAT))
240
+ else:
241
+ ch.setFormatter(LogfmtFormatter(datefmt=_LOG_DATE_FORMAT))
242
+ root.addHandler(ch)
243
+
244
+ # File handler
245
+ if log_file:
246
+ try:
247
+ from logging.handlers import RotatingFileHandler
248
+
249
+ fh = RotatingFileHandler(
250
+ log_file, maxBytes=_FILE_LOG_MAX_BYTES, backupCount=_FILE_LOG_BACKUP_COUNT, encoding="utf-8"
251
+ )
252
+ fh._astrobasis_handler = _ASTROBASIS_HANDLER # type: ignore[attr-defined]
253
+ if json_file:
254
+ fh.setFormatter(JsonLogFormatter(datefmt=_LOG_DATE_FORMAT))
255
+ elif format_style == "classic":
256
+ fh.setFormatter(logging.Formatter(_LOG_FORMAT, datefmt=_LOG_DATE_FORMAT))
257
+ else:
258
+ fh.setFormatter(LogfmtFormatter(datefmt=_LOG_DATE_FORMAT))
259
+ root.addHandler(fh)
260
+ except Exception as e:
261
+ print(f"Failed to setup file logging: {e}")
astrobasis/_types.py ADDED
@@ -0,0 +1,14 @@
1
+ """AsyncCloseable Protocol — 异步资源生命周期接口(aclose / close)。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Protocol, runtime_checkable
6
+
7
+
8
+ @runtime_checkable
9
+ class AsyncCloseable(Protocol):
10
+ """Any component that creates background tasks must implement this protocol."""
11
+
12
+ async def aclose(self) -> None:
13
+ """Cancel all background tasks, wait for completion (idempotent)."""
14
+ ...
astrobasis/_version.py ADDED
@@ -0,0 +1,6 @@
1
+ """AstroBasis 版本号 SSOT。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ __version__ = "0.1.0"
6
+ __version_info__ = (0, 1, 0)
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.4
2
+ Name: astrobasis
3
+ Version: 0.1.0
4
+ Summary: Pure mechanism layer for the Astro ecosystem — zero hard dependencies
5
+ Author-email: Etoileint <etoileint@163.com>, Etoileint <littlestar@buaa.edu.cn>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/Etoileint/AstroProject
8
+ Project-URL: Repository, https://github.com/Etoileint/AstroProject
9
+ Project-URL: Issues, https://github.com/Etoileint/AstroProject/issues
10
+ Project-URL: Documentation, https://github.com/Etoileint/AstroProject#readme
11
+ Keywords: logging,logfmt,structured-logging,atomic-write,json,orjson,protocol,async,mechanism,python
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Classifier: Topic :: System :: Logging
20
+ Requires-Python: >=3.12
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Provides-Extra: fast
24
+ Requires-Dist: orjson>=3.8; extra == "fast"
25
+ Dynamic: license-file
26
+
27
+ # astrobasis <em>天枢</em>
28
+
29
+ Pure mechanism layer for the Astro ecosystem. Zero hard dependencies beyond Python 3.12 stdlib.
30
+
31
+ ## Install
32
+
33
+ ```bash
34
+ pip install astrobasis
35
+ ```
36
+
37
+ For JSON performance acceleration:
38
+
39
+ ```bash
40
+ pip install astrobasis[fast]
41
+ ```
42
+
43
+ Or from source:
44
+
45
+ ```bash
46
+ pip install -e .
47
+ ```
48
+
49
+ ## What's inside
50
+
51
+ | Module | Purpose |
52
+ |--------|---------|
53
+ | `_logging` | Structured logfmt logging — mandatory event field, key=value output |
54
+ | `_atomic` | POSIX atomic file writes — mkstemp → fsync → os.replace |
55
+ | `_json_compat` | orjson / stdlib json compatibility layer with graceful fallback |
56
+ | `_types` | Shared protocols — `AsyncCloseable` for async resource lifecycle |
57
+
58
+ ## Usage
59
+
60
+ ### Structured logging
61
+
62
+ ```python
63
+ from astrobasis import LogfmtLogger
64
+
65
+ logger = LogfmtLogger("my_module")
66
+ logger.info("request_complete", url="https://example.com", status=200)
67
+ # → ts=2026-07-17T... level=INFO logger=my_module event=request_complete url=https://example.com status=200
68
+ ```
69
+
70
+ ### Atomic file writes
71
+
72
+ ```python
73
+ from astrobasis import atomic_write_json
74
+
75
+ data = {"key": "value", "nested": [1, 2, 3]}
76
+ atomic_write_json("/path/to/config.json", data)
77
+ # POSIX atomic: write to temp → fsync → os.replace. Concurrent reads always see complete data.
78
+ ```
79
+
80
+ ### JSON compatibility
81
+
82
+ ```python
83
+ from astrobasis import _json_dumps
84
+
85
+ data = {"items": ["a", "b", "c"]}
86
+ result = _json_dumps(data)
87
+ # Uses orjson if installed (`pip install astrobasis[fast]`), stdlib json otherwise.
88
+ ```
89
+
90
+ ### Async resource protocol
91
+
92
+ ```python
93
+ from astrobasis import AsyncCloseable
94
+
95
+ class MyResource(AsyncCloseable):
96
+ async def aclose(self) -> None:
97
+ await self._client.close()
98
+ ```
99
+
100
+ ## License
101
+
102
+ Apache 2.0
@@ -0,0 +1,11 @@
1
+ astrobasis/__init__.py,sha256=6KJDgHY9mEBQBKQnBx1DfREPxqsorkCsbo4JfP6_NNU,586
2
+ astrobasis/_atomic.py,sha256=uIy0Gz7rab1xuAPSinX6wG-QtpqWnqTrjllhT6Ov45g,1898
3
+ astrobasis/_json_compat.py,sha256=-ZGp9VslIk2CyfpntYpVabAlXyza1BZG90iBCUsWEBc,937
4
+ astrobasis/_logging.py,sha256=RUOZfcB7k8rUVQ607cI9pqNb6kev_8d1RWHce9dG43o,10087
5
+ astrobasis/_types.py,sha256=KSa_UkTIzV0RWTthl8Dt8PF8UNPiiVk02HsX38GkpaU,435
6
+ astrobasis/_version.py,sha256=bYGxMkN7cNgBig45s2JXDeLlwEzVP61odhMK0T-tmNk,123
7
+ astrobasis-0.1.0.dist-info/licenses/LICENSE,sha256=6RW0BAlC8Bi04QhvI26e9KVhgc3-AsSE0nf0OJumYBg,11340
8
+ astrobasis-0.1.0.dist-info/METADATA,sha256=IIOgk9QAVS7Wi81aW08veC4A6MvyNYVISBWVwJ8d7uA,2895
9
+ astrobasis-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
10
+ astrobasis-0.1.0.dist-info/top_level.txt,sha256=GEJcP2peXhb4RrBcUJ9rziuypeXXuf04ssoEjwFhBMs,11
11
+ astrobasis-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.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 2026 Etoileint
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
+ astrobasis