scitex-logging 0.2.0__tar.gz → 0.2.2__tar.gz
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.
- scitex_logging-0.2.2/.github/ci/build-in-sif.sh +85 -0
- scitex_logging-0.2.2/.github/ci/exec-in-sif.sh +150 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/.github/ci/publish-in-sif.sh +11 -31
- scitex_logging-0.2.2/.github/ci/run-in-sif.sh +42 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/.github/workflows/pypi-publish-and-github-release-on-tag.yml +16 -53
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/CHANGELOG.md +20 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/PKG-INFO +8 -4
- scitex_logging-0.2.2/codecov.yml +29 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/pyproject.toml +12 -2
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_Tee.py +10 -3
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/__init__.py +5 -2
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_console.py +51 -1
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_skills/scitex-logging/03_python-api.md +7 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_warnings.py +3 -1
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/llm/__main__.py +12 -10
- scitex_logging-0.2.2/tests/scitex_logging/llm/test___main___output_boundary.py +114 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/test__Tee.py +67 -0
- scitex_logging-0.2.2/tests/scitex_logging/test__console.py +378 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/test__handlers.py +3 -3
- scitex_logging-0.2.0/.github/ci/build-in-sif.sh +0 -69
- scitex_logging-0.2.0/.github/ci/exec-in-sif.sh +0 -51
- scitex_logging-0.2.0/.github/ci/run-in-sif.sh +0 -134
- scitex_logging-0.2.0/tests/scitex_logging/test__console.py +0 -188
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/.env.example +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/.gitattributes +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/.github/workflows/ci.yml +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/.github/workflows/cla.yml +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/.gitignore +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/.readthedocs.yaml +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/CLA.md +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/CONTRIBUTING.md +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/LICENSE +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/README.md +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/docs/scitex-icon-navy-inverted.png +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/docs/scitex-logo-blue-cropped.png +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/docs/sphinx/_static/.gitkeep +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/docs/sphinx/api/scitex_logging.rst +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/docs/sphinx/conf.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/docs/sphinx/index.rst +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/docs/sphinx/installation.rst +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/docs/sphinx/quickstart.rst +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/docs/sphinx/requirements.txt +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/examples/quickstart.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/README.md +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_config.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_context.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_errors.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_formatters.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_handlers.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_levels.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_logger.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_print_capture.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_skills/scitex-logging/01_installation.md +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_skills/scitex-logging/02_quick-start.md +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_skills/scitex-logging/10_quick-start.md +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_skills/scitex-logging/11_python-api.md +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_skills/scitex-logging/20_env-vars.md +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/_skills/scitex-logging/SKILL.md +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/llm/__init__.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/llm/_actions.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/llm/_dag.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/llm/_dashboard.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/llm/_parser.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/llm/_renderer.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/llm/_replay.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/llm/_spa.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/llm/_spa_css.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/src/scitex_logging/llm/_spa_js.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/__init__.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/conftest.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/develop/__init__.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/develop/test_audit.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/examples/__init__.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/examples/test_examples_smoke.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/examples/test_quickstart.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/integration/__init__.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/integration/test_cross_package_imports.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/__init__.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/llm/__init__.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/llm/conftest.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/llm/test___main__.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/llm/test__actions.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/llm/test__dag.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/llm/test__dashboard.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/llm/test__parser.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/llm/test__renderer.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/llm/test__replay.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/llm/test__spa.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/test___init__.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/test__config.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/test__context.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/test__errors.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/test__formatters.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/test__levels.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/test__logger.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/test__print_capture.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/scitex_logging/test__warnings.py +0 -0
- {scitex_logging-0.2.0 → scitex_logging-0.2.2}/tests/skills/test_skills_quality.py +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Runs INSIDE the reused scitex-ci SIF (apptainer exec — invoked via
|
|
3
|
+
# exec-in-sif.sh). Builds scitex-logging's wheel + sdist into ./dist/.
|
|
4
|
+
#
|
|
5
|
+
# Use the baked interpreter and install the PEP 517 frontend plus the genuinely
|
|
6
|
+
# published auditor into an owned target. The outer verified wrapper binds
|
|
7
|
+
# fresh RUNNER_TEMP scratch over container /tmp; HOME and the image stay intact.
|
|
8
|
+
# A missing interpreter, dependency or artifact is a hard failure.
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
V="${1:-3.12}"
|
|
12
|
+
VENV="/opt/venv-$V"
|
|
13
|
+
PY="$VENV/bin/python"
|
|
14
|
+
test -x "$PY" || {
|
|
15
|
+
echo "::error::baked python missing in $VENV — rebuild the SIF: scitex-container apptainer build ci-cpu"
|
|
16
|
+
exit 1
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export LC_ALL=C.UTF-8 LANG=C.UTF-8
|
|
20
|
+
|
|
21
|
+
# The outer wrapper makes container /tmp this job's fresh owned scratch.
|
|
22
|
+
TMPDIR="/tmp/build-scitex_logging-${GITHUB_RUN_ID:-0}-${GITHUB_RUN_ATTEMPT:-0}-$V"
|
|
23
|
+
export TMPDIR
|
|
24
|
+
rm -rf "${TMPDIR:?Logger build scratch is empty}"
|
|
25
|
+
mkdir -p "$TMPDIR/site" "$TMPDIR/uv-cache" "$TMPDIR/scitex" "$TMPDIR/pycache"
|
|
26
|
+
export SCITEX_DIR="$TMPDIR/scitex"
|
|
27
|
+
export PYTHONPYCACHEPREFIX="$TMPDIR/pycache"
|
|
28
|
+
|
|
29
|
+
# The compute-node $HOME is RO inside the container — point every cache the
|
|
30
|
+
# installer might touch at the writable scratch (else uv/pip die creating
|
|
31
|
+
# ~/.cache).
|
|
32
|
+
export UV_CACHE_DIR="$TMPDIR/uv-cache"
|
|
33
|
+
export XDG_CACHE_HOME="$TMPDIR"
|
|
34
|
+
export PIP_CACHE_DIR="$TMPDIR/pip-cache"
|
|
35
|
+
|
|
36
|
+
# A VIRTUAL_ENV leaked from the runner profile (~/.env-3.11) is a broken
|
|
37
|
+
# symlink in here; unset it so no tool follows it.
|
|
38
|
+
unset VIRTUAL_ENV || true
|
|
39
|
+
|
|
40
|
+
export PATH="$VENV/bin:$PATH"
|
|
41
|
+
echo "build: py=$("$PY" -V) target=$TMPDIR/site"
|
|
42
|
+
|
|
43
|
+
# Install the complete PEP 517 frontend and auditor, then build with them.
|
|
44
|
+
# Clean dist/ first so only the freshly
|
|
45
|
+
# built artifacts are uploaded.
|
|
46
|
+
uv pip install --python "$PY" --target="$TMPDIR/site" build "scitex-dev>=0.62.1"
|
|
47
|
+
|
|
48
|
+
export PYTHONPATH="$TMPDIR/site${PYTHONPATH:+:$PYTHONPATH}"
|
|
49
|
+
|
|
50
|
+
rm -rf dist
|
|
51
|
+
"$PY" -m build --outdir dist
|
|
52
|
+
|
|
53
|
+
echo "=== built artifacts ==="
|
|
54
|
+
ls -l dist
|
|
55
|
+
# fail-loud: refuse to continue the pipeline with an empty dist/.
|
|
56
|
+
test -n "$(ls -A dist 2>/dev/null)" || {
|
|
57
|
+
echo "::error::python -m build produced no artifacts in dist/"
|
|
58
|
+
exit 1
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
# Validate the actual built distribution and import its own declared entry points.
|
|
62
|
+
WHEEL="$(find dist -maxdepth 1 -name '*.whl' -print -quit)"
|
|
63
|
+
[ -n "$WHEEL" ] || { echo "::error::no Logger wheel was built"; exit 1; }
|
|
64
|
+
"$PY" - "$WHEEL" "${2:-}" <<'PYGATE'
|
|
65
|
+
from email.parser import BytesParser
|
|
66
|
+
from importlib.metadata import version
|
|
67
|
+
from packaging.version import Version
|
|
68
|
+
from pathlib import Path
|
|
69
|
+
import sys
|
|
70
|
+
import tomllib
|
|
71
|
+
import zipfile
|
|
72
|
+
from scitex_dev._release.entrypoint_imports import audit_wheel_entry_point_imports
|
|
73
|
+
assert Version(version("scitex-dev")) >= Version("0.62.1")
|
|
74
|
+
expected = tomllib.loads(Path("pyproject.toml").read_text())["project"]["version"]
|
|
75
|
+
with zipfile.ZipFile(sys.argv[1]) as archive:
|
|
76
|
+
name = next(name for name in archive.namelist() if name.endswith(".dist-info/METADATA"))
|
|
77
|
+
metadata = BytesParser().parsebytes(archive.read(name))
|
|
78
|
+
assert metadata["Name"] == "scitex-logging" and metadata["Version"] == expected
|
|
79
|
+
if sys.argv[2]:
|
|
80
|
+
assert sys.argv[2] == "v" + expected, "release tag/source version mismatch"
|
|
81
|
+
report = audit_wheel_entry_point_imports(Path(sys.argv[1]), "scitex-logging")
|
|
82
|
+
print(report.report())
|
|
83
|
+
if not report.is_clean:
|
|
84
|
+
raise SystemExit(1)
|
|
85
|
+
PYGATE
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Outer apptainer-exec wrapper for scitex-logging's self-hosted CI.
|
|
3
|
+
#
|
|
4
|
+
# Runs ON THE RUNNER (outside the SIF). Resolves apptainer + the SIF image, then
|
|
5
|
+
# `apptainer exec`s the SIF and hands off to an INNER script (run inside the
|
|
6
|
+
# container). Keeps every workflow job's YAML down to one line —
|
|
7
|
+
# `bash .github/ci/exec-in-sif.sh <inner-script> [args...]` — and concentrates
|
|
8
|
+
# all the SIF plumbing (apptainer resolution, ~-expansion, scratch, binds) in
|
|
9
|
+
# one version-controlled place.
|
|
10
|
+
#
|
|
11
|
+
# HOST-AGNOSTIC. This script is NOT Spartan-only: it auto-adapts to whichever
|
|
12
|
+
# self-hosted runner picks the job up, keyed off what actually exists on the box.
|
|
13
|
+
#
|
|
14
|
+
# * Spartan HPC — the GPFS project dir /data/gpfs/projects/punim0264 EXISTS:
|
|
15
|
+
# apptainer comes from the ~/.env-3.11 shim named by SCITEX_CI_APPTAINER,
|
|
16
|
+
# job scratch comes from RUNNER_TEMP, and punim0264 is bound into
|
|
17
|
+
# the container ($HOME/.scitex there is a symlink into it, so without the
|
|
18
|
+
# bind the symlink dangles inside the SIF).
|
|
19
|
+
#
|
|
20
|
+
# * Local compute nodes (scitex-compute-01..04) — NO /data/gpfs at all:
|
|
21
|
+
# apptainer is the distro package on PATH (/usr/bin/apptainer), scratch is
|
|
22
|
+
# job-owned under RUNNER_TEMP, and the GPFS bind is OMITTED
|
|
23
|
+
# (apptainer refuses a bind whose source does not exist, and `mkdir -p` on a
|
|
24
|
+
# GPFS scratch path would hard-fail here under `set -e`).
|
|
25
|
+
#
|
|
26
|
+
# Each of those three decisions (interpreter, scratch, bind) is made
|
|
27
|
+
# INDEPENDENTLY from a probe of this host, so a runner that matches neither
|
|
28
|
+
# profile exactly still gets a coherent command line.
|
|
29
|
+
#
|
|
30
|
+
# Env (set by the workflow from repo Actions Variables):
|
|
31
|
+
# SCITEX_CI_APPTAINER OPTIONAL path to an apptainer shim
|
|
32
|
+
# (e.g. ~/.env-3.11/bin/apptainer). Honoured when it
|
|
33
|
+
# points at an executable; otherwise apptainer is taken
|
|
34
|
+
# from PATH.
|
|
35
|
+
# RUNNER_TEMP REQUIRED existing spacious job scratch parent
|
|
36
|
+
# (configured by the runner, not a HOME fallback).
|
|
37
|
+
# SCITEX_CI_SIF REQUIRED path to the CI SIF image
|
|
38
|
+
# (e.g. ~/.scitex/dev/containers/ci-cpu.sif)
|
|
39
|
+
#
|
|
40
|
+
# Usage:
|
|
41
|
+
# bash .github/ci/exec-in-sif.sh run-in-sif.sh 3.12
|
|
42
|
+
#
|
|
43
|
+
# Fail-loud (operator directive): if NEITHER the shim nor PATH yields an
|
|
44
|
+
# apptainer, or the SIF is missing, that is a HARD error naming what was tried
|
|
45
|
+
# — never a silent fallback to a bare-runner install.
|
|
46
|
+
set -euo pipefail
|
|
47
|
+
|
|
48
|
+
INNER="${1:?inner script name required (relative to .github/ci/)}"
|
|
49
|
+
shift || true
|
|
50
|
+
|
|
51
|
+
# Spartan's job shell is --noprofile --norc (no Lmod), so its apptainer shim dir
|
|
52
|
+
# must be put on PATH explicitly; the shim execs the real Apptainer binary.
|
|
53
|
+
# Harmless where that directory is absent — a non-existent PATH entry is simply
|
|
54
|
+
# never matched — which is the case on the local compute nodes.
|
|
55
|
+
export PATH="$HOME/.env-3.11/bin:$PATH"
|
|
56
|
+
|
|
57
|
+
# ~-expand the Actions-Variable paths: a quoted "~/…" is NOT tilde-expanded by
|
|
58
|
+
# the shell, so substitute a leading ~ with $HOME ourselves.
|
|
59
|
+
APPTAINER_VAR="${SCITEX_CI_APPTAINER:-}"
|
|
60
|
+
APPTAINER_VAR="${APPTAINER_VAR/#\~/$HOME}"
|
|
61
|
+
SIF="${SCITEX_CI_SIF:?SCITEX_CI_SIF not set (repo Actions Variable)}"
|
|
62
|
+
SIF="${SIF/#\~/$HOME}"
|
|
63
|
+
SIF_SHA256="${SCITEX_CI_SIF_SHA256:?SCITEX_CI_SIF_SHA256 not set (repo Actions Variable)}"
|
|
64
|
+
|
|
65
|
+
# Apptainer resolution, in order:
|
|
66
|
+
# 1. SCITEX_CI_APPTAINER when it names an executable (Spartan's shim)
|
|
67
|
+
# 2. `apptainer` on PATH (local compute nodes)
|
|
68
|
+
# Only when NEITHER resolves is this an error — and the message names BOTH
|
|
69
|
+
# attempts, because "which one did you even try" is the whole diagnosis.
|
|
70
|
+
if [ -n "$APPTAINER_VAR" ] && [ -x "$APPTAINER_VAR" ]; then
|
|
71
|
+
APPTAINER="$APPTAINER_VAR"
|
|
72
|
+
APPTAINER_FROM="SCITEX_CI_APPTAINER"
|
|
73
|
+
elif APPTAINER="$(command -v apptainer 2>/dev/null)"; then
|
|
74
|
+
APPTAINER_FROM="PATH"
|
|
75
|
+
else
|
|
76
|
+
echo "::error::no apptainer on this runner. Tried (1) SCITEX_CI_APPTAINER=${SCITEX_CI_APPTAINER:-<unset>} (expanded to '${APPTAINER_VAR:-<empty>}') — not an executable; (2) 'apptainer' on PATH ($PATH) — not found. Install apptainer on this runner, or point SCITEX_CI_APPTAINER at a working shim. Running the job outside the SIF on a bare-runner install is NOT an acceptable fallback."
|
|
77
|
+
exit 1
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
[ -f "$SIF" ] || {
|
|
81
|
+
echo "::error::CI SIF missing at $SIF — rebuild it: scitex-container apptainer build ci-cpu"
|
|
82
|
+
exit 1
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
ACTUAL_SIF_SHA256="$(sha256sum "$SIF" | awk '{print $1}')"
|
|
86
|
+
if [ "$ACTUAL_SIF_SHA256" != "$SIF_SHA256" ]; then
|
|
87
|
+
echo "::error::CI SIF digest mismatch at $SIF: expected $SIF_SHA256, got $ACTUAL_SIF_SHA256. Synchronize the versioned image before accepting jobs; running an unverified image is forbidden."
|
|
88
|
+
exit 1
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# Use a new directory under the runner's spacious job area. Neither root /tmp
|
|
92
|
+
# nor HOME caches are acceptable implicit fallbacks. Refuse before execution if
|
|
93
|
+
# the configured job parent is missing or cannot stage the full declared tests.
|
|
94
|
+
CI_JOB_BASE="${RUNNER_TEMP:?RUNNER_TEMP must name spacious job scratch}"
|
|
95
|
+
case "$CI_JOB_BASE" in
|
|
96
|
+
/*) ;;
|
|
97
|
+
*) echo "::error::RUNNER_TEMP must be an absolute directory"; exit 1 ;;
|
|
98
|
+
esac
|
|
99
|
+
case "$CI_JOB_BASE:$PWD" in
|
|
100
|
+
*','*|*$'\n'*) echo "::error::CI bind paths contain unsupported separators"; exit 1 ;;
|
|
101
|
+
esac
|
|
102
|
+
case "$CI_JOB_BASE" in
|
|
103
|
+
*':'*) echo "::error::RUNNER_TEMP contains an unsupported bind separator"; exit 1 ;;
|
|
104
|
+
esac
|
|
105
|
+
case "$PWD" in
|
|
106
|
+
*':'*) echo "::error::checkout path contains an unsupported bind separator"; exit 1 ;;
|
|
107
|
+
esac
|
|
108
|
+
[ -d "$CI_JOB_BASE" ] && [ -w "$CI_JOB_BASE" ] || {
|
|
109
|
+
echo "::error::RUNNER_TEMP is not an existing writable job directory: $CI_JOB_BASE"
|
|
110
|
+
exit 1
|
|
111
|
+
}
|
|
112
|
+
CI_AVAILABLE_KB="$(df -Pk "$CI_JOB_BASE" | awk 'NR == 2 {print $4}')"
|
|
113
|
+
case "$CI_AVAILABLE_KB" in
|
|
114
|
+
''|*[!0-9]*) echo "::error::cannot establish free space for job scratch"; exit 1 ;;
|
|
115
|
+
esac
|
|
116
|
+
[ "$CI_AVAILABLE_KB" -ge 2097152 ] || {
|
|
117
|
+
echo "::error::job scratch needs at least 2 GiB available: $CI_JOB_BASE (${CI_AVAILABLE_KB} KiB free)"
|
|
118
|
+
exit 1
|
|
119
|
+
}
|
|
120
|
+
CI_JOB_ROOT="$(mktemp -d "$CI_JOB_BASE/scitex-logging-sif.XXXXXXXX")"
|
|
121
|
+
export APPTAINER_TMPDIR="$CI_JOB_ROOT/apptainer-tmp"
|
|
122
|
+
export APPTAINER_CACHEDIR="$CI_JOB_ROOT/apptainer-cache"
|
|
123
|
+
export APPTAINER_CONFIGDIR="$CI_JOB_ROOT/apptainer-config"
|
|
124
|
+
mkdir -p "$CI_JOB_ROOT/tmp" "$APPTAINER_TMPDIR" "$APPTAINER_CACHEDIR" "$APPTAINER_CONFIGDIR"
|
|
125
|
+
# The inner scripts keep their guarded /tmp lifecycle, now backed by this
|
|
126
|
+
# job-owned directory instead of the runner's full root filesystem.
|
|
127
|
+
export APPTAINERENV_TMPDIR=/tmp
|
|
128
|
+
|
|
129
|
+
# Explicit checkout and /tmp binds preserve source identity and scratch even
|
|
130
|
+
# when a host profile does not bind /scratch automatically. Arrays retain spaces.
|
|
131
|
+
GPFS_PROJECT="/data/gpfs/projects/punim0264"
|
|
132
|
+
APPTAINER_ARGV=(exec --pwd "$PWD" --bind "$PWD:$PWD" --bind "$CI_JOB_ROOT/tmp:/tmp")
|
|
133
|
+
if [ -d "$GPFS_PROJECT" ]; then
|
|
134
|
+
APPTAINER_ARGV+=(--bind "$GPFS_PROJECT")
|
|
135
|
+
GPFS_STATE="present (punim0264 bound)"
|
|
136
|
+
else
|
|
137
|
+
GPFS_STATE="absent (no GPFS bind)"
|
|
138
|
+
fi
|
|
139
|
+
|
|
140
|
+
# Echo the resolved plan: when a run fails on an unfamiliar node, the FIRST
|
|
141
|
+
# question is which of the two profiles it took.
|
|
142
|
+
echo "exec-in-sif: apptainer=$APPTAINER (via $APPTAINER_FROM)"
|
|
143
|
+
echo "exec-in-sif: sif=$SIF"
|
|
144
|
+
echo "exec-in-sif: sif_sha256=$ACTUAL_SIF_SHA256 (verified)"
|
|
145
|
+
echo "exec-in-sif: $GPFS_PROJECT $GPFS_STATE"
|
|
146
|
+
echo "exec-in-sif: job_scratch=$CI_JOB_ROOT (available=${CI_AVAILABLE_KB} KiB)"
|
|
147
|
+
echo "exec-in-sif: APPTAINER_TMPDIR=$APPTAINER_TMPDIR"
|
|
148
|
+
echo "exec-in-sif: + $APPTAINER ${APPTAINER_ARGV[*]} $SIF bash .github/ci/$INNER $*"
|
|
149
|
+
|
|
150
|
+
exec "$APPTAINER" "${APPTAINER_ARGV[@]}" "$SIF" bash ".github/ci/$INNER" "$@"
|
|
@@ -1,32 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
# action cannot run there. PyPI Trusted Publishing is just an OIDC token
|
|
9
|
-
# exchange over plain HTTPS, so we do it by hand:
|
|
10
|
-
#
|
|
11
|
-
# 1. Ask the GitHub Actions OIDC provider for a JWT with audience=pypi,
|
|
12
|
-
# using the per-job ACTIONS_ID_TOKEN_REQUEST_{TOKEN,URL} env vars (present
|
|
13
|
-
# because the publish job declares `permissions: id-token: write`).
|
|
14
|
-
# apptainer exec (no --cleanenv) passes those host env vars into the SIF.
|
|
15
|
-
# 2. Exchange that JWT at PyPI's mint-token endpoint for a short-lived,
|
|
16
|
-
# scope-limited PyPI API token.
|
|
17
|
-
# 3. twine upload dist/* with TWINE_USERNAME=__token__ and that minted token.
|
|
18
|
-
#
|
|
19
|
-
# This requires a Trusted Publisher to be configured on PyPI for
|
|
20
|
-
# (project=scitex-logging, owner=ywatanabe1989, repo=scitex-logging,
|
|
21
|
-
# workflow=pypi-publish-and-github-release-on-tag.yml). It already is — the
|
|
22
|
-
# previous releases published via the Docker action under the same trusted
|
|
23
|
-
# publisher; only the *client* changes here, not PyPI's trust config.
|
|
24
|
-
#
|
|
25
|
-
# curl, python and (after a --target install) twine all live in the SIF.
|
|
26
|
-
#
|
|
27
|
-
# Fail-loud (operator directive): every step asserts non-empty output and
|
|
28
|
-
# `set -euo pipefail`; any failure is a HARD error with the exact cause, never
|
|
29
|
-
# a silent skip.
|
|
2
|
+
# Publish the built artifacts inside the verified CI SIF using the job OIDC JWT.
|
|
3
|
+
# The PyPI Trusted Publisher must match GitHub owner scitex-ai, repository
|
|
4
|
+
# scitex-logging, workflow pypi-publish-and-github-release-on-tag.yml, and
|
|
5
|
+
# environment pypi. The actual mint-token exchange verifies current trust;
|
|
6
|
+
# historical successful publication does not prove that configuration today.
|
|
7
|
+
# No static API-token fallback is used. Authentication/upload failure is fatal.
|
|
30
8
|
set -euo pipefail
|
|
31
9
|
|
|
32
10
|
V="${1:-3.12}"
|
|
@@ -48,11 +26,13 @@ fi
|
|
|
48
26
|
echo "=== dist to publish ==="
|
|
49
27
|
ls -l dist
|
|
50
28
|
|
|
51
|
-
# ---
|
|
29
|
+
# --- fresh owned scratch bound over /tmp by the verified outer wrapper ---
|
|
52
30
|
TMPDIR="/tmp/publish-scitex_logging-${GITHUB_RUN_ID:-0}-${GITHUB_RUN_ATTEMPT:-0}-$V"
|
|
53
31
|
export TMPDIR
|
|
54
|
-
rm -rf "$TMPDIR"
|
|
55
|
-
mkdir -p "$TMPDIR/site" "$TMPDIR/uv-cache"
|
|
32
|
+
rm -rf "${TMPDIR:?Logger publish scratch is empty}"
|
|
33
|
+
mkdir -p "$TMPDIR/site" "$TMPDIR/uv-cache" "$TMPDIR/scitex" "$TMPDIR/pycache"
|
|
34
|
+
export SCITEX_DIR="$TMPDIR/scitex"
|
|
35
|
+
export PYTHONPYCACHEPREFIX="$TMPDIR/pycache"
|
|
56
36
|
export UV_CACHE_DIR="$TMPDIR/uv-cache"
|
|
57
37
|
export XDG_CACHE_HOME="$TMPDIR"
|
|
58
38
|
export PIP_CACHE_DIR="$TMPDIR/pip-cache"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Logger's owning tests run inside the digest-verified reused CI image.
|
|
3
|
+
# exec-in-sif.sh binds a new RUNNER_TEMP job directory over container /tmp.
|
|
4
|
+
# Install the full declared environment; a reduced dependency fallback cannot
|
|
5
|
+
# stand in for the same source, audit and real subprocess assertions.
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
V="${1:?python version arg required (3.11/3.12/3.13)}"
|
|
9
|
+
VENV="/opt/venv-$V"
|
|
10
|
+
PY="$VENV/bin/python"
|
|
11
|
+
[ -x "$PY" ] || { echo "::error::baked Python missing: $PY"; exit 1; }
|
|
12
|
+
export LC_ALL=C.UTF-8 LANG=C.UTF-8
|
|
13
|
+
export TMPDIR="/tmp/ci-scitex_logging-${GITHUB_RUN_ID:-0}-${GITHUB_RUN_ATTEMPT:-0}-$V"
|
|
14
|
+
rm -rf "${TMPDIR:?Logger test scratch is empty}"
|
|
15
|
+
mkdir -p "$TMPDIR/uv-cache" "$TMPDIR/pip-cache" \
|
|
16
|
+
"$TMPDIR/scitex" "$TMPDIR/pycache"
|
|
17
|
+
export SCITEX_DIR="$TMPDIR/scitex"
|
|
18
|
+
export PYTHONPYCACHEPREFIX="$TMPDIR/pycache"
|
|
19
|
+
export UV_CACHE_DIR="$TMPDIR/uv-cache" XDG_CACHE_HOME="$TMPDIR"
|
|
20
|
+
export PIP_CACHE_DIR="$TMPDIR/pip-cache"
|
|
21
|
+
export RUN_E2E=1
|
|
22
|
+
export COVERAGE_FILE="$TMPDIR/.coverage"
|
|
23
|
+
unset VIRTUAL_ENV || true
|
|
24
|
+
# Clean-environment subprocess fixtures deliberately drop PYTHONPATH. A target
|
|
25
|
+
# overlay would make them import the old baked Logger; install the candidate
|
|
26
|
+
# physically into this job's writable venv so sys.executable remains genuine.
|
|
27
|
+
"$PY" -m venv "$TMPDIR/venv"
|
|
28
|
+
PY="$TMPDIR/venv/bin/python"
|
|
29
|
+
export PATH="$TMPDIR/venv/bin:$VENV/bin:$PATH"
|
|
30
|
+
uv pip install --python "$PY" -e ".[all,dev]"
|
|
31
|
+
export PYTHONPATH="$PWD/src${PYTHONPATH:+:$PYTHONPATH}"
|
|
32
|
+
"$PY" - <<'PYENV'
|
|
33
|
+
from importlib.metadata import version
|
|
34
|
+
from packaging.version import Version
|
|
35
|
+
assert Version(version("scitex-dev")) >= Version("0.62.1")
|
|
36
|
+
print("Logger test auditor:", version("scitex-dev"))
|
|
37
|
+
PYENV
|
|
38
|
+
# Logger's console, stream, capture and CLI tests use real owning fixtures.
|
|
39
|
+
# They do not need a Matplotlib warm-up or a copied plotting worker policy.
|
|
40
|
+
exec nice -n 19 ionice -c 3 "$PY" -m pytest tests/ -q \
|
|
41
|
+
--cov=src/scitex_logging --cov-report="xml:$TMPDIR/coverage.xml" --cov-report=term \
|
|
42
|
+
-p no:cacheprovider
|
|
@@ -1,44 +1,11 @@
|
|
|
1
1
|
name: release
|
|
2
2
|
|
|
3
|
-
# Tag-driven release
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
# Everything else fires automatically:
|
|
10
|
-
#
|
|
11
|
-
# 1. test — matrix pytest INSIDE the SIF. Must pass or the pipeline
|
|
12
|
-
# halts; nothing is published until tests are green on the
|
|
13
|
-
# tagged commit.
|
|
14
|
-
# 2. build — wheel + sdist built INSIDE the SIF, uploaded as artifact.
|
|
15
|
-
# 3. publish — PyPI via MANUAL OIDC trusted publishing INSIDE the SIF.
|
|
16
|
-
# 4. release — GitHub Release with CHANGELOG notes + artifacts.
|
|
17
|
-
#
|
|
18
|
-
# develop→main promotion is a DELIBERATE, separate PR (operator policy);
|
|
19
|
-
# this pipeline never auto-syncs main.
|
|
20
|
-
#
|
|
21
|
-
# WHY the SIF (operator standardization 2026-06-18, fleet canary 2026-06-21):
|
|
22
|
-
# the Spartan compute runners have NO Python on the bare node, so the old
|
|
23
|
-
# `actions/setup-python@v5` step failed at init ("version 3.x not found for
|
|
24
|
-
# this OS"). The working pytest-matrix CI runs INSIDE the pre-built, reused
|
|
25
|
-
# scitex-ci SIF (`apptainer exec ci-cpu.sif`), which bakes python 3.11/3.12/
|
|
26
|
-
# 3.13 + pip + uv + fd at /opt/venv-<ver>. This release pipeline mirrors that:
|
|
27
|
-
# - test/build run `bash .github/ci/exec-in-sif.sh <inner>.sh <pyver>`.
|
|
28
|
-
# - publish CANNOT use pypa/gh-action-pypi-publish (a Docker action; the
|
|
29
|
-
# compute nodes have no Docker), so it does MANUAL OIDC trusted publishing
|
|
30
|
-
# inside the SIF (.github/ci/publish-in-sif.sh): GitHub OIDC JWT →
|
|
31
|
-
# PyPI mint-token → twine upload. Trust config on PyPI is unchanged.
|
|
32
|
-
# - actions/checkout, upload/download-artifact, codecov are JS actions and
|
|
33
|
-
# run fine on the self-hosted runner.
|
|
34
|
-
# fail-loud: a missing SIF/shim/interpreter is a HARD error, never a
|
|
35
|
-
# bare-runner fallback.
|
|
36
|
-
#
|
|
37
|
-
# runs-on driven by repo Actions Variable CI_RUNS_ON; SIF + apptainer paths
|
|
38
|
-
# come from SCITEX_CI_SIF / SCITEX_CI_APPTAINER (same as pytest-matrix).
|
|
39
|
-
#
|
|
40
|
-
# Manual re-run: the workflow also accepts a `version` input via
|
|
41
|
-
# workflow_dispatch so you can re-publish without re-tagging.
|
|
3
|
+
# Tag-driven release on the selected self-hosted runner and verified CI SIF.
|
|
4
|
+
# All three Python test legs must pass before building, PyPI OIDC publication,
|
|
5
|
+
# and the automatic GitHub Release. Main promotion remains a separate PR.
|
|
6
|
+
# Existing immutable tags may be retried through workflow_dispatch.
|
|
7
|
+
# CI_RUNS_ON selects the runner; SCITEX_CI_SIF/APPTAINER select the image/runtime,
|
|
8
|
+
# and SCITEX_CI_SIF_SHA256 verifies the image before executing any inner script.
|
|
42
9
|
|
|
43
10
|
on:
|
|
44
11
|
push:
|
|
@@ -53,6 +20,8 @@ on:
|
|
|
53
20
|
env:
|
|
54
21
|
SCITEX_CI_APPTAINER: ${{ vars.SCITEX_CI_APPTAINER }}
|
|
55
22
|
SCITEX_CI_SIF: ${{ vars.SCITEX_CI_SIF }}
|
|
23
|
+
SCITEX_CI_SIF_SHA256: ${{ vars.SCITEX_CI_SIF_SHA256 }}
|
|
24
|
+
RUN_E2E: "1"
|
|
56
25
|
|
|
57
26
|
jobs:
|
|
58
27
|
test:
|
|
@@ -75,13 +44,10 @@ jobs:
|
|
|
75
44
|
with:
|
|
76
45
|
ref: ${{ steps.ver.outputs.version }}
|
|
77
46
|
fetch-depth: 0
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
-
#
|
|
81
|
-
|
|
82
|
-
# run-in-sif.sh layers THIS (tagged) checkout + [all,dev] into a writable
|
|
83
|
-
# target, then runs pytest. fail-loud on a missing SIF/shim.
|
|
84
|
-
- name: Run tests in the reused CI SIF (apptainer exec — deps layered, not on the bare runner)
|
|
47
|
+
# The verified image supplies the interpreter. Install this tagged
|
|
48
|
+
# checkout and all declared test dependencies into an owned writable venv
|
|
49
|
+
# so clean subprocess fixtures use the candidate instead of baked Logger.
|
|
50
|
+
- name: Run Logger tests in the verified CI SIF
|
|
85
51
|
run: bash .github/ci/exec-in-sif.sh run-in-sif.sh ${{ matrix.python-version }}
|
|
86
52
|
|
|
87
53
|
build:
|
|
@@ -107,7 +73,7 @@ jobs:
|
|
|
107
73
|
# build-in-sif.sh installs the `build` frontend into a writable --target
|
|
108
74
|
# inside the SIF, then `python -m build` → dist/. fail-loud on empty dist.
|
|
109
75
|
- name: Build wheel + sdist in the CI SIF (apptainer exec)
|
|
110
|
-
run: bash .github/ci/exec-in-sif.sh build-in-sif.sh 3.12
|
|
76
|
+
run: bash .github/ci/exec-in-sif.sh build-in-sif.sh 3.12 "${{ steps.ver.outputs.version }}"
|
|
111
77
|
# upload-artifact is a JS action — runs fine on the self-hosted runner.
|
|
112
78
|
- uses: actions/upload-artifact@v4
|
|
113
79
|
with:
|
|
@@ -132,11 +98,8 @@ jobs:
|
|
|
132
98
|
with:
|
|
133
99
|
name: dist
|
|
134
100
|
path: dist
|
|
135
|
-
#
|
|
136
|
-
#
|
|
137
|
-
# publish-in-sif.sh: GitHub OIDC JWT (audience=pypi) → PyPI mint-token →
|
|
138
|
-
# twine upload dist/*. apptainer exec (no --cleanenv) passes the
|
|
139
|
-
# ACTIONS_ID_TOKEN_REQUEST_* env vars into the SIF. fail-loud at each step.
|
|
101
|
+
# The per-job OIDC JWT is exchanged for a scoped PyPI upload token inside
|
|
102
|
+
# the verified SIF. Failed trust, authentication, or upload stops release.
|
|
140
103
|
- name: Publish to PyPI via manual OIDC trusted publishing in the SIF
|
|
141
104
|
run: bash .github/ci/exec-in-sif.sh publish-in-sif.sh 3.12
|
|
142
105
|
|
|
@@ -158,7 +121,7 @@ jobs:
|
|
|
158
121
|
VERSION="${{ needs.build.outputs.version }}"
|
|
159
122
|
VERSION="${VERSION#v}"
|
|
160
123
|
awk -v v="$VERSION" '
|
|
161
|
-
$0
|
|
124
|
+
index($0, "## [" v "]") == 1 {p=1; next}
|
|
162
125
|
p && /^## \[/ {exit}
|
|
163
126
|
p
|
|
164
127
|
' CHANGELOG.md > release-notes.md || true
|
|
@@ -7,6 +7,26 @@ versions follow [Semantic Versioning](https://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.2] - 2026-10-02
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Keep PlainConsole results on the current stdout stream without routing
|
|
15
|
+
them through logger-owned PrintCapture wrappers. Preserve redirected and
|
|
16
|
+
foreign streams, nested capture and restoration, and ordinary diagnostics.
|
|
17
|
+
- Route requested LLM CLI JSON, diagrams and artifact acknowledgements
|
|
18
|
+
through PlainConsole independently of diagnostic thresholds.
|
|
19
|
+
- Acquire the canonical public logger lazily in Tee and warnings. Preserve
|
|
20
|
+
Tee's original stderr fallback when its file sink or logger fails.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Require the genuinely published Dev 0.62.1 auditor in contributor
|
|
25
|
+
environments so the canonical backend passes PS-220 without suppressions.
|
|
26
|
+
- Verify the CI image digest before release execution, give Logger tests,
|
|
27
|
+
builds and publishing owned scratch and caches, and require the complete
|
|
28
|
+
declared test environment with RUN_E2E enabled.
|
|
29
|
+
|
|
10
30
|
## [0.2.0]
|
|
11
31
|
|
|
12
32
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: scitex-logging
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Logging utilities for the SciTeX ecosystem
|
|
5
5
|
Project-URL: Homepage, https://github.com/ywatanabe1989/scitex-logging
|
|
6
6
|
Project-URL: Repository, https://github.com/ywatanabe1989/scitex-logging
|
|
@@ -25,7 +25,9 @@ Provides-Extra: all
|
|
|
25
25
|
Requires-Dist: myst-parser>=2.0; extra == 'all'
|
|
26
26
|
Requires-Dist: pytest; extra == 'all'
|
|
27
27
|
Requires-Dist: pytest-cov; extra == 'all'
|
|
28
|
-
Requires-Dist:
|
|
28
|
+
Requires-Dist: pytest-timeout>=2.1.0; extra == 'all'
|
|
29
|
+
Requires-Dist: scitex-dev>=0.62.1; extra == 'all'
|
|
30
|
+
Requires-Dist: scitex-io; extra == 'all'
|
|
29
31
|
Requires-Dist: sphinx-autodoc-typehints>=1.25; extra == 'all'
|
|
30
32
|
Requires-Dist: sphinx-copybutton>=0.5; extra == 'all'
|
|
31
33
|
Requires-Dist: sphinx-rtd-theme>=2.0; extra == 'all'
|
|
@@ -33,7 +35,9 @@ Requires-Dist: sphinx>=7.0; extra == 'all'
|
|
|
33
35
|
Provides-Extra: dev
|
|
34
36
|
Requires-Dist: pytest; extra == 'dev'
|
|
35
37
|
Requires-Dist: pytest-cov; extra == 'dev'
|
|
36
|
-
Requires-Dist:
|
|
38
|
+
Requires-Dist: pytest-timeout>=2.1.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: scitex-dev>=0.62.1; extra == 'dev'
|
|
40
|
+
Requires-Dist: scitex-io; extra == 'dev'
|
|
37
41
|
Provides-Extra: docs
|
|
38
42
|
Requires-Dist: myst-parser>=2.0; extra == 'docs'
|
|
39
43
|
Requires-Dist: sphinx-autodoc-typehints>=1.25; extra == 'docs'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
codecov:
|
|
2
|
+
require_ci_to_pass: false
|
|
3
|
+
# Treat develop as the de-facto default branch — main is a stable
|
|
4
|
+
# release mirror that only fast-forwards from develop, so develop
|
|
5
|
+
# is where coverage uploads land. This makes the unbranched badge
|
|
6
|
+
# endpoint (/graph/badge.svg) follow develop's value.
|
|
7
|
+
branch: develop
|
|
8
|
+
|
|
9
|
+
coverage:
|
|
10
|
+
status:
|
|
11
|
+
project:
|
|
12
|
+
default:
|
|
13
|
+
target: auto
|
|
14
|
+
threshold: 1%
|
|
15
|
+
patch:
|
|
16
|
+
default:
|
|
17
|
+
target: 80%
|
|
18
|
+
|
|
19
|
+
ignore:
|
|
20
|
+
- "src/scitex_logging/_sphinx_html/**"
|
|
21
|
+
- "src/scitex_logging/_skills/**"
|
|
22
|
+
- "src/scitex_logging/_completion.py"
|
|
23
|
+
- "src/scitex_logging/_cli/_completion.py"
|
|
24
|
+
- "tests/**"
|
|
25
|
+
- "examples/**"
|
|
26
|
+
|
|
27
|
+
comment:
|
|
28
|
+
layout: "diff, files"
|
|
29
|
+
require_changes: true
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scitex-logging"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.2"
|
|
8
8
|
description = "Logging utilities for the SciTeX ecosystem"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "AGPL-3.0-only"
|
|
@@ -36,7 +36,16 @@ dependencies = []
|
|
|
36
36
|
dev = [
|
|
37
37
|
"pytest",
|
|
38
38
|
"pytest-cov",
|
|
39
|
-
"
|
|
39
|
+
"pytest-timeout>=2.1.0",
|
|
40
|
+
"scitex-dev>=0.62.1",
|
|
41
|
+
# Registers scitex-dev's IO/PA rule categories. Without it the linter
|
|
42
|
+
# loads, reports success, and SILENTLY SKIPS STX-IO001-014 and
|
|
43
|
+
# STX-PA001-005 — every `open()`, `pickle.dump/load`, `np.load/save`,
|
|
44
|
+
# `pd.read_*` and `df.to_*` check. The CI audit said so on every run:
|
|
45
|
+
# "no IO/PA category rules registered ... are SILENTLY skipped".
|
|
46
|
+
# A green audit that never ran ~19 of its rules is a gate that cannot
|
|
47
|
+
# fail, so install the plugin rather than suppress or ignore the notice.
|
|
48
|
+
"scitex-io",
|
|
40
49
|
]
|
|
41
50
|
docs = [
|
|
42
51
|
"sphinx>=7.0",
|
|
@@ -68,6 +77,7 @@ packages = ["src/scitex_logging"]
|
|
|
68
77
|
testpaths = ["tests"]
|
|
69
78
|
python_files = ["test_*.py"]
|
|
70
79
|
addopts = "-v --tb=short"
|
|
80
|
+
markers = ["slow: longer Logger subprocess and formatting controls"]
|
|
71
81
|
|
|
72
82
|
[tool.ruff]
|
|
73
83
|
line-length = 88
|
|
@@ -48,9 +48,9 @@ def _clean_path(path_string):
|
|
|
48
48
|
|
|
49
49
|
def _get_logger():
|
|
50
50
|
"""Get logger lazily to avoid circular import during module initialization."""
|
|
51
|
-
import
|
|
51
|
+
from . import getLogger
|
|
52
52
|
|
|
53
|
-
return
|
|
53
|
+
return getLogger(__name__)
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
class Tee:
|
|
@@ -66,8 +66,15 @@ class Tee:
|
|
|
66
66
|
stream_name = "stderr" if stream is sys.stderr else "stdout"
|
|
67
67
|
logger.debug(f"Tee [{stream_name}]: {log_path}")
|
|
68
68
|
except Exception as e:
|
|
69
|
-
print(f"Failed to open log file {log_path}: {e}", file=sys.stderr)
|
|
70
69
|
self._log_file = None
|
|
70
|
+
message = f"Failed to open log file {log_path}: {e}"
|
|
71
|
+
try:
|
|
72
|
+
_get_logger().error(message)
|
|
73
|
+
except Exception:
|
|
74
|
+
# Optional Tee logging must survive a broken logger/handler.
|
|
75
|
+
# Preserve the original current-stderr fallback independently
|
|
76
|
+
# of the backend that just failed to report this error.
|
|
77
|
+
sys.stderr.write(f"{message}\n")
|
|
71
78
|
self._is_stderr = stream is sys.stderr
|
|
72
79
|
|
|
73
80
|
def write(self, data: Any) -> None:
|
|
@@ -134,8 +134,10 @@ from ._warnings import (
|
|
|
134
134
|
getLogger = _logging.getLogger
|
|
135
135
|
|
|
136
136
|
# `getLogger` writes to stderr; `getConsole` is its stdout counterpart,
|
|
137
|
-
# with identical formatting.
|
|
138
|
-
|
|
137
|
+
# with identical formatting. `getPlainConsole` is the third destination:
|
|
138
|
+
# prefix-free stdout for protocol frames (paths, verdicts) where a level
|
|
139
|
+
# prefix would corrupt the payload. See `._console`.
|
|
140
|
+
from ._console import getConsole, getPlainConsole # noqa: E402
|
|
139
141
|
_basicConfig = _logging.basicConfig
|
|
140
142
|
_disable = _logging.disable
|
|
141
143
|
|
|
@@ -168,6 +170,7 @@ __all__ = [
|
|
|
168
170
|
# Core logging functions
|
|
169
171
|
"getLogger",
|
|
170
172
|
"getConsole",
|
|
173
|
+
"getPlainConsole",
|
|
171
174
|
# Log levels
|
|
172
175
|
"DEBUG",
|
|
173
176
|
"INFO",
|