Skip to content

No [tool.mypy] config and library itself not type-checked in CI despite py.typed marker #134

Description

@codeforester

Problem

pyproject.toml declares py.typed as package data (PEP 561), and mypy>=1.17 is in the dev dependencies. CI runs mypy --strict examples/typed_consumer.py — one example file. However:

  1. The library code itself is not type-checked by mypy in CI. mypy --strict lib/python/base_cli/ is not run anywhere in the test or package workflows.
  2. There is no [tool.mypy] section in pyproject.toml. Downstream users who run mypy on their own code and use base-cli have no guidance on what mypy configuration is compatible.

For a package that ships py.typed and promises typed public APIs, not running mypy on the library itself is a gap. Type errors in the library's own code would not be caught until a consumer's mypy run fails.

Fix

  1. Add a [tool.mypy] section to pyproject.toml:
[tool.mypy]
python_version = "3.10"
strict = true
warn_unused_ignores = true
  1. Add a mypy check to the CI tests workflow:
- name: Type-check library
  run: python -m mypy --strict lib/python/base_cli/
  1. Resolve any mypy errors this surfaces (common ones: missing stubs for optional deps like rich, opentelemetry-api — these can be conditioned with TYPE_CHECKING guards).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions