Skip to content

Ship a py.typed marker so type checkers use the package's inline types #63

Closed

Description

@david-debest

Problem

knowledge_mapper has no py.typed marker (PEP 561). Type checkers treat the installed package as untyped:

  • mypy reports Skipping analyzing "knowledge_mapper": module is installed, but missing library stubs or py.typed marker [import-untyped] and infers everything from the package as Any.
  • Pyright/Pylance infer types from source anyway, but in strict mode they also treat the package as partially typed.

As a result, the typed APIs (e.g. AskKI[M] / PostKI[A, R] from #62, BindingModel fields, handler signatures) give no static checking for mypy users.

Proposal

  • Add an empty src/knowledge_mapper/py.typed.
  • Make sure the build backend includes it in the wheel/sdist (check [tool.setuptools.package-data] or equivalent in pyproject.toml).
  • Verify: install the built wheel in a fresh env and run mypy on a small script that imports knowledge_mapper; the import-untyped error should be gone.

Notes

Found while verifying #57 / #62.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions