Skip to content

chore: bring pyright strict mode to zero errors - #4

Merged
nnayda merged 2 commits into
mainfrom
chore/pyright-strict-zero
Jun 18, 2026
Merged

chore: bring pyright strict mode to zero errors#4
nnayda merged 2 commits into
mainfrom
chore/pyright-strict-zero

Conversation

@nnayda

@nnayda nnayda commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary

Annotate the full source tree and test suite so pyright passes in strict mode with zero errors, and make the CI typecheck job blocking (previously continue-on-error).

The vast majority is annotation debt inherited from upstream and newly surfaced by the fork's CI: missing parameter/return types, typed test fixtures and mock helpers, and oxml-layer accessor declarations. No runtime behavior change there.

Real fixes uncovered along the way

  • Document.add_comment normalizes a None text argument to "" instead of forwarding None.
  • OpcPackage.walk_parts no longer uses a mutable default argument.
  • BaseStyle accessors read the always-present style element, fixing the post-delete() state.
  • CT_NumBuilder.__attrs__ is the intended one-tuple ("w:numId",).

Making the | None accessor signatures honest also completes two previously error-raising edge paths (both now tested):

  • Assigning None to a cell's bg_color clears shading instead of raising ValueError.
  • Assigning a next-paragraph-style whose own style_id is None removes the w:next setting.

Tooling

  • Bump pyright to 1.1.410 (clears a typeshed false positive).
  • Remove continue-on-error from the CI typecheck job.

Verification

  • uv run ruff check . / ruff format --check . — clean
  • uv run pyright0 errors, 0 warnings
  • uv run pytest1653 passed
  • uv run behave654 scenarios passed

Version bumped to 1.2.1 (patch); CHANGELOG updated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y9zbyKfqck1a5RM6Y7LLTN

nnayda and others added 2 commits June 18, 2026 12:56
Annotate the full source tree and test suite so `pyright` passes in strict
mode with zero errors, and make the CI `typecheck` job blocking.

The bulk of this is annotation debt inherited from upstream and newly surfaced
by the fork's CI: missing parameter/return types, typed test fixtures and mock
helpers, and oxml-layer accessor declarations. A small number of genuine
latent bugs uncovered along the way are also fixed:

- `Document.add_comment` normalizes a `None` `text` argument to `""`.
- `OpcPackage.walk_parts` drops its mutable default argument.
- `BaseStyle` accessors read the always-present style element, fixing the
  post-`delete()` state.
- `CT_NumBuilder.__attrs__` is the intended one-tuple `("w:numId",)`.

Making the `| None` accessor signatures honest also completes two previously
error-raising edge paths (both now covered by tests):

- Assigning `None` to a cell's `bg_color` clears shading instead of raising.
- Assigning a next-paragraph-style whose own `style_id` is `None` removes the
  `w:next` setting, consistent with assigning `None` or self.

Tooling: bump `pyright` to `1.1.410` (clears a typeshed false positive) and
remove `continue-on-error` from the CI typecheck job.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y9zbyKfqck1a5RM6Y7LLTN
@nnayda nnayda changed the title v1.2.1 chore: bring pyright strict mode to zero errors chore: bring pyright strict mode to zero errors Jun 18, 2026
@nnayda
nnayda merged commit 79f313c into main Jun 18, 2026
13 of 14 checks passed
@nnayda
nnayda deleted the chore/pyright-strict-zero branch June 18, 2026 15:26
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.

1 participant