Skip to content

Add type hints, py.typed marker and strict mypy - #49

Merged
markbac merged 2 commits into
mainfrom
chore/19-type-hints
Oct 3, 2026
Merged

markbac merged 2 commits into
mainfrom
chore/19-type-hints

Conversation

@markbac

@markbac markbac commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Summary

The package had partial annotations and no py.typed marker, so downstream type checkers treated it as untyped.

Changes

  • Annotate every function, method and class in pylogkit/log_setup.py: ParamSpec and TypeVar keep the signature of functions wrapped by log_duration, and tqdm_logging is generic over the iterable's item type.
  • Ship a PEP 561 py.typed marker, listed as package data.
  • Enable strict = true for mypy. Targeted type: ignore comments cover subclassing the untyped colorlog and python-json-logger classes, and use unused-ignore so they pass whether or not the libraries are typed.
  • CI checks that the built wheel contains py.typed.
  • Tests: marker present, package data configured, and every public callable fully annotated.

Verification

  • mypy --strict is clean with the latest dependencies, with no extras, and ruff is clean.
  • pytest: 99 passed (latest dependencies) and 81 passed with 18 skipped (no extras).

Closes #19

🤖 Generated with Claude Code

https://claude.ai/code/session_01U2nYHVGDdthQpcwNBPbp8r


Generated by Claude Code

claude added 2 commits October 3, 2026 11:53
## Summary

The package had partial annotations and no `py.typed` marker, so downstream type checkers treated it as untyped.

## Changes

- Annotate every function, method and class in `pylogkit/log_setup.py`: `ParamSpec` and `TypeVar` keep the signature of functions wrapped by `log_duration`, and `tqdm_logging` is generic over the iterable's item type.
- Ship a PEP 561 `py.typed` marker, listed as package data.
- Enable `strict = true` for mypy. Targeted `type: ignore` comments cover subclassing the untyped `colorlog` and `python-json-logger` classes, and use `unused-ignore` so they pass whether or not the libraries are typed.
- CI checks that the built wheel contains `py.typed`.
- Tests: marker present, package data configured, and every public callable fully annotated.

## Verification

- `mypy --strict` is clean with the latest dependencies, with no extras, and `ruff` is clean.
- `pytest`: 99 passed (latest dependencies) and 81 passed with 18 skipped (no extras).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U2nYHVGDdthQpcwNBPbp8r
@markbac
markbac merged commit d2f635c into main Oct 3, 2026
9 checks passed
@markbac
markbac deleted the chore/19-type-hints branch October 19, 2026 08:53
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.

Add type hints and ship py.typed

2 participants