Skip to content

Commit aa70b49

Browse files
committed
chore(release): bump version to 0.1.2 and update README
- Update version in pyproject.toml and uv.lock to 0.1.2 - Remove status section from README to reflect current state - Enhance docstrings across various modules for better clarity and consistency
1 parent 8a3eda4 commit aa70b49

75 files changed

Lines changed: 6358 additions & 665 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -665,14 +665,6 @@ pytest tests/test_conformance.py
665665

666666
---
667667

668-
## Status
669-
670-
`v0.1.0` — alpha. API may still move; pin the version if you depend
671-
on behavioural stability. See [CHANGELOG.md](CHANGELOG.md) for the
672-
release log.
673-
674-
---
675-
676668
## License
677669

678670
This project is licensed under AGPL-3.0-or-later.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "uv_build"
44

55
[project]
66
name = "spectrax-lib"
7-
version = "0.1.1"
7+
version = "0.1.2"
88
authors = [{ name = "Erfan Zare Chavoshi", email = "Erfanzare810@gmail.com" }]
99
description = "SpectraX: a JAX-only neural-network library with a True MPMD pipeline parallelism for JAX — with an eager module API."
1010
readme = "README.md"

spectrax/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ def _patched_update(name, value):
7272
Returns ``None`` (without calling the underlying ``update``)
7373
when ``name`` is a known-removed flag; otherwise delegates to
7474
the original ``jax.config.update`` and returns its result.
75+
76+
Args:
77+
name: Name used for lookup, logging, or registration.
78+
value: Value consumed by the helper.
7579
"""
7680
if name in removed_flags:
7781
return None

spectrax/_internal/logging.py

Lines changed: 69 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,23 +206,53 @@ def _log_once(self, level: int, message: str, *args: object, **kwargs: object) -
206206
self._logger.log(level, message, *args, **kwargs)
207207

208208
def debug_once(self, message: str, *args: object, **kwargs: object) -> None:
209-
"""Log a ``DEBUG`` message once (deduplicated)."""
209+
"""Log a ``DEBUG`` message once (deduplicated).
210+
211+
Args:
212+
message: Message value consumed by this operation.
213+
*args: Additional positional arguments forwarded to the wrapped callable or backend.
214+
**kwargs: Additional keyword arguments forwarded to the wrapped callable or backend.
215+
"""
210216
self._log_once(logging.DEBUG, message, *args, **kwargs)
211217

212218
def info_once(self, message: str, *args: object, **kwargs: object) -> None:
213-
"""Log an ``INFO`` message once (deduplicated)."""
219+
"""Log an ``INFO`` message once (deduplicated).
220+
221+
Args:
222+
message: Message value consumed by this operation.
223+
*args: Additional positional arguments forwarded to the wrapped callable or backend.
224+
**kwargs: Additional keyword arguments forwarded to the wrapped callable or backend.
225+
"""
214226
self._log_once(logging.INFO, message, *args, **kwargs)
215227

216228
def warn_once(self, message: str, *args: object, **kwargs: object) -> None:
217-
"""Log a ``WARNING`` message once (deduplicated)."""
229+
"""Log a ``WARNING`` message once (deduplicated).
230+
231+
Args:
232+
message: Message value consumed by this operation.
233+
*args: Additional positional arguments forwarded to the wrapped callable or backend.
234+
**kwargs: Additional keyword arguments forwarded to the wrapped callable or backend.
235+
"""
218236
self._log_once(logging.WARNING, message, *args, **kwargs)
219237

220238
def warning_once(self, message: str, *args: object, **kwargs: object) -> None:
221-
"""Alias for :meth:`warn_once`."""
239+
"""Alias for :meth:`warn_once`.
240+
241+
Args:
242+
message: Message value consumed by this operation.
243+
*args: Additional positional arguments forwarded to the wrapped callable or backend.
244+
**kwargs: Additional keyword arguments forwarded to the wrapped callable or backend.
245+
"""
222246
self._log_once(logging.WARNING, message, *args, **kwargs)
223247

224248
def error_once(self, message: str, *args: object, **kwargs: object) -> None:
225-
"""Log an ``ERROR`` message once (deduplicated)."""
249+
"""Log an ``ERROR`` message once (deduplicated).
250+
251+
Args:
252+
message: Message value consumed by this operation.
253+
*args: Additional positional arguments forwarded to the wrapped callable or backend.
254+
**kwargs: Additional keyword arguments forwarded to the wrapped callable or backend.
255+
"""
226256
self._log_once(logging.ERROR, message, *args, **kwargs)
227257

228258
def clear_once_cache(self) -> None:
@@ -251,7 +281,15 @@ def __getattr__(self, name: str) -> Callable[..., object]:
251281

252282
@wraps(getattr(logging.Logger, method_name))
253283
def wrapped_log_method(*args: object, **kwargs: object) -> object:
254-
"""Delegate to the underlying logger method."""
284+
"""Delegate to the underlying logger method.
285+
286+
Args:
287+
*args: Additional positional arguments forwarded to the wrapped callable or backend.
288+
**kwargs: Additional keyword arguments forwarded to the wrapped callable or backend.
289+
290+
Returns:
291+
Result described by this helper.
292+
"""
255293
self._ensure_initialized()
256294
return getattr(self._logger, method_name)(*args, **kwargs)
257295

@@ -264,15 +302,31 @@ def wrapped_log_method(*args: object, **kwargs: object) -> object:
264302

265303
@wraps(getattr(logging.Logger, method_name))
266304
def wrapped_log_method(*args: object, **kwargs: object) -> object:
267-
"""Delegate to the named level method of the underlying logger."""
305+
"""Delegate to the named level method of the underlying logger.
306+
307+
Args:
308+
*args: Additional positional arguments forwarded to the wrapped callable or backend.
309+
**kwargs: Additional keyword arguments forwarded to the wrapped callable or backend.
310+
311+
Returns:
312+
Result described by this helper.
313+
"""
268314
self._ensure_initialized()
269315
return getattr(self._logger, method_name)(*args, **kwargs)
270316

271317
return wrapped_log_method
272318

273319
@wraps(logging.Logger.log)
274320
def wrapped_log_method(*args: object, **kwargs: object) -> object:
275-
"""Log at the dynamically-resolved level."""
321+
"""Log at the dynamically-resolved level.
322+
323+
Args:
324+
*args: Additional positional arguments forwarded to the wrapped callable or backend.
325+
**kwargs: Additional keyword arguments forwarded to the wrapped callable or backend.
326+
327+
Returns:
328+
Result described by this helper.
329+
"""
276330
self._ensure_initialized()
277331
return self._logger.log(level, *args, **kwargs)
278332

@@ -424,7 +478,13 @@ def __enter__(self):
424478
return self
425479

426480
def __exit__(self, exc_type, exc_val, exc_tb):
427-
"""Context-manager exit — auto-completes if no exception was raised."""
481+
"""Context-manager exit — auto-completes if no exception was raised.
482+
483+
Args:
484+
exc_type: Exc type value consumed by this operation.
485+
exc_val: Exc val value consumed by this operation.
486+
exc_tb: Exc tb value consumed by this operation.
487+
"""
428488
if exc_type is None:
429489
self.complete()
430490
return False

spectrax/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
``from ._version import __version__`` and by packaging tooling.
99
"""
1010

11-
__version__ = "0.1.1"
11+
__version__ = "0.1.2"

spectrax/api.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,11 @@ def _fwd(state, *a, **kw):
210210
211211
Cached per-``GraphDef`` so the same compiled program is
212212
reused across calls.
213+
214+
Args:
215+
state: SpectraX state tree or transform state passed into the operation.
216+
*a: Additional positional arguments forwarded to the wrapped callable or backend.
217+
**kw: Additional keyword arguments forwarded to the wrapped callable or backend.
213218
"""
214219
return bind(gdef, state)(*a, **kw)
215220

@@ -233,6 +238,13 @@ def _step(state, args, kwargs, l_args, l_kwargs):
233238
Differentiates with respect to the full :class:`State`
234239
tree; partition out trainable subsets at the call site if
235240
you want narrower gradients.
241+
242+
Args:
243+
state: SpectraX state tree or transform state passed into the operation.
244+
args: Positional arguments forwarded to the wrapped callable.
245+
kwargs: Keyword arguments forwarded to the wrapped callable.
246+
l_args: L args value consumed by this operation.
247+
l_kwargs: L kwargs value consumed by this operation.
236248
"""
237249

238250
def loss(state):
@@ -241,6 +253,9 @@ def loss(state):
241253
Captures ``gdef``, the model call args, and the
242254
supplied ``loss_fn`` from the enclosing scope so the
243255
resulting function depends only on ``state``.
256+
257+
Args:
258+
state: SpectraX state tree or transform state passed into the operation.
244259
"""
245260
out = bind(gdef, state)(*args, **kwargs)
246261
return loss_fn(out, *l_args, **l_kwargs)
@@ -337,6 +352,13 @@ def _wrapped_loss(out: object, *vals: object) -> object:
337352
the captured ``target_keys`` and calls the original
338353
``loss_fn`` with keyword targets, preserving its kwargs
339354
interface even though the pipeline batch is positional.
355+
356+
Args:
357+
out: Output value from an earlier call or transform.
358+
*vals: Additional positional arguments forwarded to the wrapped callable or backend.
359+
360+
Returns:
361+
Result described by this helper.
340362
"""
341363
return original_loss(out, **dict(zip(target_keys, vals, strict=True)))
342364

spectrax/contrib/optimizer.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,15 @@ class _OptaxModule(Protocol):
5353
"""Subset of :mod:`optax` used by this wrapper."""
5454

5555
def apply_updates(self, params: State, updates: State) -> State:
56-
"""Apply optax updates to a :class:`State` tree."""
56+
"""Apply optax updates to a :class:`State` tree.
57+
58+
Args:
59+
params: Parameter mapping or primitive parameter dictionary.
60+
updates: Updates value consumed by this operation.
61+
62+
Returns:
63+
Result described by this helper.
64+
"""
5765
...
5866

5967

spectrax/core/_typing.py

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,16 @@ class Initializer(Protocol):
8484
"""
8585

8686
def __call__(self, key: PRNGKey, shape: Shape, dtype: DType = jnp.float32) -> Array:
87-
"""Return a freshly-initialized array of ``shape`` and ``dtype`` from ``key``."""
87+
"""Return a freshly-initialized array of ``shape`` and ``dtype`` from ``key``.
88+
89+
Args:
90+
key: Logical key, path segment, or PRNG key used by the operation.
91+
shape: Array shape requested by the initializer or helper.
92+
dtype: Array dtype requested for the produced value.
93+
94+
Returns:
95+
Result of invoking the wrapped callable or module.
96+
"""
8897
...
8998

9099

@@ -114,7 +123,16 @@ def __call__(
114123
args: tuple[object, ...],
115124
kwargs: dict[str, object],
116125
) -> tuple[tuple[object, ...], dict[str, object]] | None:
117-
"""Optionally rewrite ``(args, kwargs)`` before ``forward`` runs."""
126+
"""Optionally rewrite ``(args, kwargs)`` before ``forward`` runs.
127+
128+
Args:
129+
module: SpectraX module instance operated on by the helper.
130+
args: Positional arguments forwarded to the wrapped callable.
131+
kwargs: Keyword arguments forwarded to the wrapped callable.
132+
133+
Returns:
134+
Result of invoking the wrapped callable or module.
135+
"""
118136
...
119137

120138

@@ -133,7 +151,17 @@ def __call__(
133151
kwargs: dict[str, object],
134152
output: object,
135153
) -> object | None:
136-
"""Optionally rewrite the forward output. Return ``None`` to keep it unchanged."""
154+
"""Optionally rewrite the forward output. Return ``None`` to keep it unchanged.
155+
156+
Args:
157+
module: SpectraX module instance operated on by the helper.
158+
args: Positional arguments forwarded to the wrapped callable.
159+
kwargs: Keyword arguments forwarded to the wrapped callable.
160+
output: Output value consumed by this operation.
161+
162+
Returns:
163+
Result of invoking the wrapped callable or module.
164+
"""
137165
...
138166

139167

@@ -147,5 +175,11 @@ class VariableObserver(Protocol):
147175
"""
148176

149177
def __call__(self, var: object, old: object, new: object) -> None:
150-
"""React to ``var`` having its value changed from ``old`` to ``new``."""
178+
"""React to ``var`` having its value changed from ``old`` to ``new``.
179+
180+
Args:
181+
var: Var value consumed by this operation.
182+
old: Old value consumed by this operation.
183+
new: New value consumed by this operation.
184+
"""
151185
...

0 commit comments

Comments
 (0)