chore(git): add /.worktrees/ to .gitignore - #71
Conversation
…0) (#38) Rewrites test_anova test file: - Add AAA marker comments (# Arrange / # Act / # Assert) to every test function, in order, separated. - Split multi-assert tests (TQ007) into single-assert tests with descriptive names that read as one-line specifications. - Result: 22 STX-TQ002+TQ007 violations -> 0. - All 22 tests pass.
#39) * refactor(deps): migrate optional imports to try_import_optional (src/) Per the three-tier dependency policy (general/05_development/11_dependency-tiers.md), raw `try/except ImportError` for optional [all]-tier deps is forbidden ecosystem-wide; the sanctioned helper is `scitex_dev.try_import_optional` (centralizes install hints in `_HINTS` and gives readers a grep target for "this dep is optional"). Migrate every optional-dep import gate in src/ (src-only — no demos/tests/workflows): - torch (descriptive/_describe,_nan,_real,_circular): `HAS_TORCH = torch is not None` - figrecipe (_figrecipe_integration._AVAILABLE; _plot_helpers.get_palette) - scitex umbrella (_plot_helpers.compose_panels/ensure_figure) — no `extra=` because the scitex umbrella can't be a scitex-stats dependency (circular); keeps the hard-require ImportError raise Behavior preserved. Hard-dep gates (pandas/statsmodels/matplotlib/scitex-dev/ scitex-logging/mcp), the user-supplied dynamic import in introspect.py, and the fastmcp availability check in mcp.py are intentionally left as-is — they are not optional-dep violations. Re-does the valid kernel of closed #26 within the narrow scope the maintainer specified (src/ only); #26 itself was closed for overreaching into demos+workflows (broke 22+ demo tests). Demos already moved to examples/ via #35. Verified: 62 passed, 5 skipped (descriptive + plot_helpers + figrecipe + integration tests); all edited modules import cleanly; ruff clean. * test(integration): regenerate cross-package gate for try_import_optional migration The optional-imports migration changed src's static cross-package import set, so the PS-140 §2 gate in test_cross_package_imports.py went stale: - add `scitex_dev` — now imported (`from scitex_dev import try_import_optional`) - drop `scitex` — the umbrella import is now dynamic (`try_import_optional("scitex")`), no longer a static import Matches the delta scitex-dev 0.12.3 reports in CI (audit-project PS-140).
Add AAA markers (# Arrange/# Act/# Assert) to every test and split multi-assertion tests into single-assertion tests (faithful split, no coverage loss), per the PA-307 §3 STX-TQ002/TQ007 rules and the merged anova-test template. 69 tests -> 145 single-assert tests; all pass.
Add AAA markers, split multi-assertion tests into single-assertion tests (faithful split), and rename short test names to >=3 descriptive tokens (STX-TQ002/TQ003/TQ007). Class structure preserved; shared construction factored into small helper methods where it reduced duplication. 57 methods -> 97 single-assert tests; all pass; scitex-linter clean.
- sphinx CLI docs: `mcp installation` -> `mcp install` (deprecated command was renamed; old name prints a deprecation error) - skill CLI reference: same `mcp show-installation` -> `mcp install` - skill env-vars: add `SCITEX_STATS_CONFIG` to the table; drop the stale note claiming no SCITEX_STATS_* vars exist since the CLI precedence chain documents this variable
docs: refresh stale command names and env-var references
Each scitex ecosystem package owns its domain dataclasses. The Stats schemas (Stats, EffectSize, StatResult, GUI positioning/styling, etc.) have lived in the umbrella at scitex.io.bundle.kinds._stats._dataclasses since the schema reorg; that location is the umbrella's bundle dispatcher concern, not stats' domain concern. Move them here so scitex_stats is the single source of truth (umbrella, scitex_io optional provider, and any future GUI / editor tool all import from the same place). The umbrella ships a re-export shim at the same kinds/_stats path to keep its bundle loader/saver/Bundle classes working unchanged.
Mirrors figrecipe's .plt.zip / .fig.zip pattern: a single-file zipped form is the portable target, while the legacy directory bundle stays supported for iteration. save_stats_bundle / load_stats_bundle now branch on the suffix: *.stats.zip → zipped bundle (recommended) anything else → directory bundle (legacy) Both write the same canonical layout: <bundle>/stats.json # spec <bundle>/data.csv # supplementary data (optional) <bundle>/report.md # human summary (optional) This is what scitex_io's optional provider will register so that 'scitex_io.save(stats_dict, "results.stats.zip")' round-trips through the same .stats.zip API.
…202) PS-202 was firing because src/scitex_stats/_dataclasses/ (the new location of the Stats schema after the umbrella move) had no matching tests/scitex_stats/_dataclasses/ mirror. Adds test__Stats.py with: - Parametrized presence test covering every name in __all__ (STATS_VERSION, type aliases, GUI classes, core dataclasses). - STATS_VERSION shape check (semver-ish 3-part dotted string). - Stats is exposed as a real dataclass (not a stub/alias). - DataRef dict round-trip preserves path and columns. Also fixes PS-140: scitex umbrella was missing from the cross-package import gate. The umbrella imports scitex_stats.io via its scitex.io.bundle._core dispatcher, so it's a legitimate cross-package dependency. Plus pre-existing STX-TQ001/TQ002 lint debt on the parametrized test_cross_package_import function — added the required AAA markers and a real assertion on the importorskip return value.
CI (scitex-dev v0.14.0) reports 'scitex' as stale in the gate — the gate must reflect actual src/ imports, and scitex_stats does not import the scitex umbrella anywhere (correct — scitex is downstream). My earlier addition was based on local v0.12.4 reporting 'scitex' as missing; v0.14 fixed that auto-gen bug. CI is authoritative.
…SOC R4)
scitex_stats was hard-importing private figrecipe modules
(figrecipe._wrappers, figrecipe.styles._internal,
figrecipe._diagram), which made figrecipe a de-facto required
dep instead of optional. Per SOC.md R4 ("scitex-stats knows
figrecipe but as optional"), route these through
scitex_dev.try_import_optional with extra='figrecipe' so
scitex-stats installs and runs cleanly without figrecipe.
- _plot_helpers.violin_swarm: gate 3 figrecipe imports
- auto/_decision_tree: hoist GraphDiagram resolution into
_require_graph_diagram() helper, used by both
render_flowchart_mermaid and render_flowchart_svg
If figrecipe is absent, the functions raise a clear
ImportError pointing at `pip install scitex-stats[figrecipe]`
instead of an opaque ModuleNotFoundError at import time.
Add per-edge tests for the OPTIONAL figrecipe edge in scitex_stats._figrecipe_integration, mirroring the canonical scitex-io <-> figrecipe template. - INTEGRATION (figrecipe PRESENT, importorskip-guarded): to_figrecipe / annotate work and AxisWrapper unwrapping resolves. - DEGRADATION (figrecipe ABSENT, reversible sys.modules stub-shim): _AVAILABLE flips False and to_figrecipe/annotate/load_and_annotate each raise the documented ImportError carrying the pip-install hint, instead of leaking an opaque AttributeError. One-assert-per-test + explicit AAA markers; no monkeypatch/mocker.
test: figrecipe integration + degradation edge tests
refactor(stats): gate figrecipe imports through try_import_optional (SOC R4)
The _dataclasses.Stats schema has lived on develop unreleased (PyPI 0.2.21 lacks it), forcing scitex-io to git-pin scitex-stats. Publishing it unblocks scitex-io to depend on scitex-stats>=0.2.22 and exercises the .stats.zip bundle integration on PyPI.
release: v0.2.22 (publish _dataclasses Stats schema)
…load_stats)
Port the scitex-stats↔bundle integration from the scitex-python umbrella
into the standalone so the umbrella can drop its stats/ dir and pure-alias
to scitex_stats.
New module src/scitex_stats/_bundle_io.py exposes three public functions:
- test_result_to_stats(result) -> Stats: convert a run_test-shaped result
dict (flat or nested) to the canonical scitex_stats._dataclasses.Stats
schema.
- save_stats(comparisons, path, metadata=None, as_zip=False): persist as a
SciTeX bundle (kind="stats") via scitex_io.bundle.Bundle.
- load_stats(path): load a stats bundle into a flat, plot-friendly dict.
scitex-io is an OPTIONAL dependency (new extra [bundle] = scitex-io>=0.2.16):
the module imports cleanly without it and each function raises a clear
ImportError("scitex-io is required for stats bundle I/O; install
scitex-stats[bundle]") when called. The Stats dataclasses live in
scitex_stats (single source of truth; scitex-io imports them back), so the
extra stays optional with no hard/circular dependency and no direct refs.
Functions are exposed lazily on the package root (PEP 562) and listed in
__all__. Tests cover integration round-trips (importorskip scitex_io.bundle)
and graceful degradation via a reversible sys.modules shim (no monkeypatch).
All 28 new tests pass. Pre-existing test__server.py / MCP-CLI failures are
unrelated (FastMCP API drift in the env) and reproduce on clean develop.
feat(bundle): host stats↔bundle I/O (test_result_to_stats/save_stats/load_stats)
…le) into scitex_stats (#48) * feat: move scitex stats integration (Stats/annotate/to_figrecipe/bundle) into scitex_stats Add public _integration.py aggregator re-exporting the eight scitex-specific stats integration names so they import directly from scitex_stats: Stats, BUNDLE_AVAILABLE, test_result_to_stats, save_stats, load_stats, to_figrecipe, annotate, load_and_annotate - Stats schema sourced from scitex_stats._dataclasses (single source of truth). - Bundle I/O (test_result_to_stats/save_stats/load_stats/BUNDLE_AVAILABLE) re-exported from _bundle_io; scitex-io imported OPTIONALLY (extra [bundle]). - figrecipe annotations (to_figrecipe/annotate/load_and_annotate) re-exported from _figrecipe_integration; figrecipe imported OPTIONALLY (extra [figrecipe]). - Wire all eight names into the PEP 562 lazy dispatch table + __all__. - Add tests/scitex_stats/test__integration.py (AAA, importorskip-gated). Also migrate FastMCP 2.12 API: FastMCP.list_tools() was removed. - CLI mcp list-tools/doctor now use mcp.get_tools() (in-process accessor). - test__server.py: enumerate via in-memory fastmcp.Client; invoke decorated tools through FunctionTool.fn; read schemas via Tool.inputSchema. * fix: make FastMCP tool enumeration version-robust (2.x + 3.x) and close audit gaps CI runs FastMCP 3.3.1 where get_tools()/FunctionTool.fn do not exist; local dev had 2.12.4. Make all tool access version-robust: - _cli/mcp.py _list_tool_objects(): prefer in-process get_tools() (2.x, keeps return-type annotations), else fall back to the in-memory fastmcp.Client transport (stable across 2.x/3.x; MCP wire Tool has name/description/inputSchema). - _format_tool_signature(): accept .parameters (2.x) or .inputSchema schema attr. - test__server.py: _tool_fn() resolves the tool coroutine via .fn (2.x FunctionTool) or the plain function (3.x). Close audit gaps flagged by CI's scitex-dev 0.14.1: - PS-210: add scitex-io + figrecipe to [dev] so a fresh install runs the full suite (the [bundle]/[all] integration tests). - PS-140: add scitex_io.bundle to the cross-package import gate.
|
Please sign the SciTeX CLA before your contribution can be merged. I have read and agree to the SciTeX CLA. You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
|
Closing as stale — fleet PR/Issue backlog sweep, 2026-08-11. What this PR attempted: chore(git): add /.worktrees/ to .gitignore Why it is being closed: newest generation for this repo but mergeState=DIRTY; a one-line .gitignore change is faster to redo than to rescue. Nothing is deleted. Branch |
Housekeeping: live git worktrees under .worktrees/ show up as untracked noise in git status. Adds /.worktrees/ to .gitignore so this cannot recur. No code changes.