Skip to content

chore: update rhiza to v1.2.5 (and satisfy its stricter quality gates) - #80

Open
tschm wants to merge 4 commits into
alihaskar:masterfrom
tschm:rhiza_v1.2.5_20260730
Open

chore: update rhiza to v1.2.5 (and satisfy its stricter quality gates)#80
tschm wants to merge 4 commits into
alihaskar:masterfrom
tschm:rhiza_v1.2.5_20260730

Conversation

@tschm

@tschm tschm commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Syncs this repo to a new release of its template, and fixes the gate failures the new release surfaces.

  • Template: jebel-quant/rhiza
  • Ref: v0.18.8v1.2.5 (upstream commit e5d7005e2d9f)
  • Major bump (0.x → 1.x)

Branches from master at 372737f, so this applies cleanly.

1. The sync

43 template files changed. 7 conflicted and were resolved by taking the upstream (template) side — a rhiza-managed file is the template's to own, so local divergence is drift to undo:

.github/workflows/rhiza_{benchmark,book,ci,codeql,marimo,release,weekly}.yml

2. Orphaned files removed (31 paths)

The sync left 31 files on disk that v1.2.5 no longer ships. They are leftovers from v0.18.8 that the new template.lock does not own: .rhiza/tests/{api,integration,structure,sync,stress,shell,utils}/, .rhiza/tests/test_utils.py, .rhiza/requirements/, .rhiza/utils/, .rhiza/make.d/releasing.mk, .rhiza/.rhiza-version, and .github/workflows/rhiza_sync.yml.

Verified before deleting: none appear in the v1.2.5 lock, and no lock-owned file imports them. This is load-bearing rather than cosmetic — .rhiza/utils/suppression_audit.py was itself failing the new ruff gate.

Two consequences worth a maintainer's eye:

  • make bump / release / publish / release-status are gone with releasing.mk. rhiza_release.yml is tag-triggered, so release CI still works, but tags now need pushing by hand.
  • Template sync no longer runs on a schedule; /rhiza:update must be run manually.

3. Fixing the gates v1.2.5 turns on

Six checks failed on the raw sync. All pass now.

Type checking (3.12/3.13/3.14)mypy --strict reported 67 errors; ty was already clean.

  • Added a typecheck dependency group with pandas-stubs, in default-groups so uv run --with mypy resolves them from the project environment.
  • SubplotSpec was a bare assignment, which mypy rejects as "not valid as a type"; it is now a PEP 695 type alias, which also repairs isinstance narrowing downstream.
  • Annotated DataManager's stored arrays so the public properties stop returning Any, and declared final_open/high/low/close up front so both chart-mode branches can assign array-or-None.
  • ChartServer._server was inferred as None, making .run() an attr-defined error.
  • Normalizing the index now tests np.ndarray before pd.Index/pd.Series: with real pandas stubs visible, the tuple isinstance leaves an ndarray/Index intersection that fails to_numpy's Self bound.

Pre-commit — 27 ruff errors, mostly missing annotations. Two deliberate suppressions:

  • open is kept as an OHLC keyword (A001/A002 silenced locally). It is the domain vocabulary and part of the documented public API — plot(open=...) — so renaming it would break callers.
  • BLE001 silenced at two intentionally broad catches: the best-effort static mount, and the browser launch that falls back to printing the URL.

docs-coverage — 98.4% → 100%, via docstrings on 8 nested test helpers.

make rhiza-test — a v1.2.5-shipped assertion bans the deprecated License :: trove classifier. Moved to the PEP 639 SPDX form (license = "MIT"); uv build verified to emit Metadata-Version: 2.4 with License-Expression: MIT.

Verification

typecheck, test (154 passed, 100% coverage), docs-coverage, rhiza-test, deptry, security and pre-commit all pass locally. Full CI is green on the mirror of this branch at tschm#25 — every check passing across 3.12/3.13/3.14 on ubuntu, macos and windows.

No quality scorecard was run; /rhiza:quality covers that separately.

🤖 Generated with Claude Code

tschm and others added 3 commits July 30, 2026 15:22
The v1.2.5 template turned on gates this codebase had never been checked
against. Six CI checks were failing: Pre-commit, Type checking on 3.12/
3.13/3.14, docs-coverage, and the CI gate.

Type checking (mypy --strict: 67 errors -> 0; ty stays clean)
- Add a `typecheck` dependency group with pandas-stubs, in default-groups
  so `uv run --with mypy` resolves them from the project environment.
- Make SubplotSpec a real PEP 695 type alias; as a bare assignment mypy
  rejected it as "not valid as a type", which also broke narrowing.
- Annotate DataManager's stored arrays so the public properties no longer
  return Any, and declare final_open/high/low/close up front so both
  chart-mode branches can assign either an array or None.
- Annotate the nested FastAPI handlers, DataResponse's bare `list` fields,
  ChartServer._server (inferred as None, so `.run()` was an attr-defined
  error), and __enter__/__exit__.
- Test ndarray before pd.Index/pd.Series when normalizing the index: the
  tuple isinstance left an ndarray/Index intersection that fails
  to_numpy's Self bound once the real pandas stubs are visible.

Lint (ruff: 27 errors -> 0)
- Annotate the remaining handlers, helpers and demo.generate_ohlc.
- Keep `open` as an OHLC keyword and silence A001/A002 locally with the
  rationale: it is the domain vocabulary and part of the public API, so
  renaming it would break callers.
- Silence BLE001 where the broad catch is deliberate (best-effort static
  mount, browser launch that falls back to printing the URL).

docs-coverage (98.4% -> 100%)
- Docstring the 8 nested test helpers interrogate reported as missed.

pyproject
- Drop the deprecated "License :: OSI Approved :: MIT License" classifier
  and move to the PEP 639 SPDX form (`license = "MIT"`), which is what
  .rhiza/tests/test_pyproject.py now requires. Verified `uv build` emits
  Metadata-Version 2.4 with License-Expression: MIT.

Orphaned files
- Delete the 31 paths this PR previously left unstaged. They are leftovers
  from v0.18.8 that the v1.2.5 lock does not own, and one of them
  (.rhiza/utils/suppression_audit.py) was itself failing the ruff gate.
  Verified none are in template.lock and no lock-owned file imports them.

Verified locally: typecheck, test (154 passed, 100% coverage),
docs-coverage, rhiza-test, deptry, security and pre-commit all pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 30, 2026 13:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR syncs the repository to the jebel-quant/rhiza template v1.2.5 and adjusts the project code, tests, and tooling to satisfy the stricter quality gates introduced by that major template bump.

Changes:

  • Synced Rhiza template from v0.18.8 to v1.2.5, updating/removing numerous .rhiza/ assets and GitHub workflow stubs.
  • Tightened typing and linting across src/ (mypy strict compatibility, Ruff rule expansion) and updated pytest/docs tooling configuration.
  • Updated release/CI helpers and added new maintenance/security workflows (e.g., Scorecard, fuzzing, mutation) via reusable workflow stubs.

Reviewed changes

Copilot reviewed 77 out of 82 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
uv.lock Adds pandas-stubs and a typecheck dependency group in the lock metadata.
tests/pycharting/core/test_lifecycle.py Adds helper docstrings to satisfy docs-coverage gating.
tests/pycharting/api/test_interface.py Adds docstrings to nested test doubles for docs-coverage gating.
src/pycharting/data/ingestion.py Improves typing (PEP 695 alias, typed locals) and mypy-friendly narrowing in ingestion/validation.
src/pycharting/core/server.py Adds type annotations and improves handler signatures/import usage for stricter lint/type gates.
src/pycharting/core/lifecycle.py Adds explicit return/argument typing and corrects _server type for mypy strictness.
src/pycharting/api/routes.py Tightens response model typing and endpoint return annotation.
src/pycharting/api/interface.py Tightens input typing, documents builtin-shadowing rationale, and broad-except lint suppressions.
ruff.toml Updates Ruff configuration: enables additional rule families and adjusts per-file ignores.
pytest.ini Adds pythonpath for .rhiza/tests, disables live CLI logging by default, and tightens warning handling.
pyproject.toml Moves to SPDX license expression, adds typecheck dependency group, and updates uv default groups.
Makefile Adjusts MkDocs extra packages override for Rhiza book builds.
docs/index.md Removes trailing blank line from snippet include.
docs/development/TESTS.md Documents opt-in pytest live logging and updates testing dependency provisioning notes.
demo.py Adds explicit typing to demo helpers to satisfy stricter type/lint gates.
cliff.toml Adds git-cliff configuration for changelog generation.
.rhiza/utils/suppression_audit.py Removes orphaned Rhiza utility no longer shipped by v1.2.5.
.rhiza/utils/pip_audit_policy.py Removes orphaned Rhiza utility no longer shipped by v1.2.5.
.rhiza/tests/utils/test_git_repo_fixture.py Removes orphaned Rhiza test file no longer shipped by v1.2.5.
.rhiza/tests/test_utils.py Removes orphaned Rhiza test utilities no longer shipped by v1.2.5.
.rhiza/tests/test_readme_validation.py Adds new README code-block validation tests shipped by v1.2.5.
.rhiza/tests/test_pyproject.py Updates Rhiza pyproject validation tests (incl. classifier expectations).
.rhiza/tests/test_docstrings.py Adds doctest-based docstring checks shipped by v1.2.5.
.rhiza/tests/sync/conftest.py Removes orphaned sync conftest no longer shipped by v1.2.5.
.rhiza/tests/structure/test_requirements.py Removes orphaned requirements-structure tests no longer shipped by v1.2.5.
.rhiza/tests/structure/test_project_layout.py Removes orphaned project-layout tests no longer shipped by v1.2.5.
.rhiza/tests/stress/README.md Removes orphaned stress docs no longer shipped by v1.2.5.
.rhiza/tests/stress/conftest.py Removes orphaned stress conftest no longer shipped by v1.2.5.
.rhiza/tests/stress/init.py Removes orphaned stress package marker no longer shipped by v1.2.5.
.rhiza/tests/shell/test_scripts.sh Removes orphaned shell test suite no longer shipped by v1.2.5.
.rhiza/tests/README.md Rewrites suite documentation to match the new v1.2.5 test layout and purpose.
.rhiza/tests/integration/test_virtual_env_unexport.py Removes orphaned integration test no longer shipped by v1.2.5.
.rhiza/tests/integration/test_test_mk.py Removes orphaned integration test no longer shipped by v1.2.5.
.rhiza/tests/integration/test_docs_targets.py Removes orphaned integration test no longer shipped by v1.2.5.
.rhiza/tests/integration/test_book_targets.py Removes orphaned integration test no longer shipped by v1.2.5.
.rhiza/tests/conftest.py Simplifies Rhiza test conftest to shared root/logger fixtures.
.rhiza/tests/api/test_makefile_targets.py Removes orphaned Makefile API tests no longer shipped by v1.2.5.
.rhiza/tests/api/test_makefile_api.py Removes orphaned Makefile API tests no longer shipped by v1.2.5.
.rhiza/tests/api/test_make_variable_overrides.py Removes orphaned Makefile variable tests no longer shipped by v1.2.5.
.rhiza/tests/api/test_github_targets.py Removes orphaned GitHub targets tests no longer shipped by v1.2.5.
.rhiza/tests/api/conftest.py Removes orphaned API conftest no longer shipped by v1.2.5.
.rhiza/template.yml Updates template ref to v1.2.5.
.rhiza/template.lock Updates lock SHA/ref and file manifest to match v1.2.5.
.rhiza/rhiza.mk Updates Rhiza core make logic (POSIX shell check on Windows, revised targets, updated rhiza-test).
.rhiza/requirements/tools.txt Removes deprecated requirements file (template no longer ships it).
.rhiza/requirements/tests.txt Removes deprecated requirements file (template no longer ships it).
.rhiza/requirements/README.md Removes deprecated requirements docs (template no longer ships it).
.rhiza/requirements/marimo.txt Removes deprecated requirements file (template no longer ships it).
.rhiza/requirements/docs.txt Removes deprecated requirements file (template no longer ships it).
.rhiza/make.d/test.mk Updates test/typecheck/security/docs-coverage targets to provision tooling via uv run --with …, retries pytest internal errors, and adds TYPECHECKER selector.
.rhiza/make.d/releasing.mk Removes legacy releasing target file no longer shipped by v1.2.5.
.rhiza/make.d/quality.mk Updates deptry workflow and removes suppression-audit target; aligns quality targets with v1.2.5.
.rhiza/make.d/marimo.mk Contributes Marimo folder to deptry scan when present.
.rhiza/make.d/github.mk Adds GitHub helper targets (gh install/status/listing helpers).
.rhiza/make.d/completions.mk Adds make-target shell completion installation target.
.rhiza/make.d/bootstrap.mk Updates install behavior (uv sync --inexact) and improves cleanup branch pruning logic.
.rhiza/make.d/book.mk Updates Marimo export to provision via uv run --with marimo.
.rhiza/completions/rhiza-completion.zsh Adds caching for make-target completion and removes bump variable suggestions.
.rhiza/completions/rhiza-completion.bash Adds caching for make-target completion and removes bump variable suggestions.
.rhiza/completions/README.md Documents completion caching and adds make install-completions quick install instructions.
.rhiza/.rhiza-version Removes deprecated rhiza-tools version pin file.
.rhiza/.env Expands documentation and retains project overrides.
.rhiza/.cfg.toml Updates bump-my-version rules (regex anchored to [project]) and adds workflow pin rewrite rule for bundles.
.pre-commit-config.yaml Updates hook versions, pins Node runtime for npm hooks, and adds betterleaks.
.github/workflows/rhiza_weekly.yml Updates reusable workflow pin to v1.2.5.
.github/workflows/rhiza_sync.yml Removes scheduled sync workflow stub (template no longer ships it).
.github/workflows/rhiza_scorecard.yml Adds OpenSSF Scorecard workflow stub.
.github/workflows/rhiza_release.yml Updates release workflow steps, permissions model, and artifact handling (SBOM/provenance).
.github/workflows/rhiza_mutation.yml Adds optional mutation testing workflow stub.
.github/workflows/rhiza_marimo.yml Updates reusable workflow pin to v1.2.5.
.github/workflows/rhiza_fuzzing.yml Adds optional fuzzing workflow stub.
.github/workflows/rhiza_codeql.yml Updates reusable workflow pin and adjusts permissions scoping.
.github/workflows/rhiza_ci.yml Updates reusable workflow pin to v1.2.5 and documents classifier-driven Python matrix.
.github/workflows/rhiza_book.yml Updates trigger behavior and reusable workflow pin.
.github/workflows/rhiza_benchmark.yml Updates reusable workflow pin to v1.2.5.
.github/rulesets/tag-protection.json Adds ruleset JSON for version tag protection.
.github/rulesets/main-branch-protection.json Adds ruleset JSON for default-branch protection and required checks.
.github/pull_request_template.md Adds CHANGELOG checklist item.
.github/DISCUSSION_TEMPLATE/ideas.yml Adds discussion template for ideas.
.github/DISCUSSION_TEMPLATE/help-wanted.yml Adds discussion template for help-wanted requests.
.github/dependabot.yml Removes trailing whitespace / formatting cleanup.
.github/CONFIG.md Adds documentation for required/optional GitHub Actions secrets (PAT_TOKEN, release secrets).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

elif isinstance(index, (pd.Index, pd.Series)):
index_array = index.to_numpy()
else:
raise DataValidationError(f"Index must be a pd.Index or np.ndarray, got {type(index)}") # noqa: TRY003
Comment thread ruff.toml
# SLF: private-member access is needed in tests; too coarse to enable repo-wide
# TCH/TID: no typing-only import cycles or import-tidiness issues at this size
# RSE: raise micro-style; TRY covers the error-prone patterns
# NPY/PD: no NumPy/pandas runtime code in this repository
Remove the [dependency-groups] lint group and relock. "lint" also came
out of [tool.uv] default-groups, which uv rejects once the group itself
is gone.

The group only carried ruff, which comes from the pre-commit hooks; mypy
was already injected by `make typecheck` via `uv run --with mypy`, not
from the group.

Also drop test_lint_group_present from .rhiza/tests/test_pyproject.py,
which required the group just removed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tschm

tschm commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Pushed one more commit here: chore: drop the lint dependency group (4e40494).

It's a separate concern from the v1.2.5 update, but it rides along because it touches a file that only exists on this branch — .rhiza/tests/test_pyproject.py arrives with the v1.2.5 sync, so the test removal can't be split into a PR off master.

What it does:

  • removes the lint group from [dependency-groups] and relocks uv.lock
  • drops "lint" from [tool.uv] default-groups — uv errors on a default group that isn't defined
  • drops test_lint_group_present from .rhiza/tests/test_pyproject.py

The group only carried ruff, which comes from the pre-commit hooks. mypy was already injected by make typecheck via uv run --with mypy, so nothing loses a tool.

Verified: uv lock --check passes, pytest .rhiza/tests/test_pyproject.py → 22 passed / 1 skipped, all pre-commit hooks pass including uv-lock.

Same change is up for the sibling repos: tschm/cs#502, tschm/jsharpe#298, tschm/pyhrp#756.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants