Skip to content

Conversation

ferdia-sopermaccafraidh-lrn
Copy link
Contributor

@ferdia-sopermaccafraidh-lrn ferdia-sopermaccafraidh-lrn commented Oct 16, 2024

The py.typed acts as a marker for type checkers that the type annotations can be used.

This needs to be enabled to take better advantage of type hinting in our own application code.

Ref: https://typing.readthedocs.io/en/latest/spec/distributing.html#packaging-type-information

Package maintainers who wish to support type checking of their code MUST add a marker file named py.typed to their package supporting typing. This marker applies recursively: if a top-level package includes it, all its sub-packages MUST support type checking as well.

## Testing

Tested locally by install the learnosity_sdk before and after the py.typed marker within application code and running mypy to ensure it would pick it up

Before change:

Skipping analyzing "learnosity_sdk": module is installed, but missing library stubs or py.typed marker  [import-untyped]
See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 66 source files)

After change:

Success: no issues found in 66 source files

Checklist

  • Feature

  • Bug

  • Security

  • Documentation

  • ChangeLog.md updated

  • Tests added

  • All testsuites passed

  • make dist completed successfully

@ferdia-sopermaccafraidh-lrn ferdia-sopermaccafraidh-lrn merged commit a375325 into master Oct 16, 2024
2 of 3 checks passed
@ferdia-sopermaccafraidh-lrn ferdia-sopermaccafraidh-lrn deleted the add-pytyped-marker branch October 16, 2024 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants