Skip to content

Conversation

Priyansh121096
Copy link
Contributor

Description

Fixes #482 so that dependent packages can type check themselves against trino.

Non-technical explanation

Release notes

( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
(x) Release notes are required, with the following suggested text:

* Make this package PEP-561 compatible ({issue}`482`)

@hashhar
Copy link
Member

hashhar commented Jan 15, 2025

how can I verify this works as expected? Is it as simple as importing trino module and seeing if mypy for example can do type checking for a script which calls methods from trino module?

@lgo
Copy link

lgo commented Aug 19, 2025

Hi @hashhar - just checking if this is something y'all would be able to merge?

To answer your question - yes. As I understand, mypy will assume the package is untyped unless it presents a py.typed on the package meaning that by default mypy says "sorry! cannot type against this package, please add type: ignored or disable the package", and needs some overrides to get around it (e.g. follow_untyped_imports).

The presence of the marker file is an intent that "yes, this package is reasonably well typed" to avoid incidentally typing against low quality packages that is untyped and lead to Any getting tossed around everywhere.

@hashhar
Copy link
Member

hashhar commented Aug 20, 2025

I checked and it wasn't obvious to me that mypy doesn't check types from libraries unless they have py.typed marker.

IDEs for example use type information always (even when using mypy as the backend) so I didn't notice.

Thanks for your change. Merging this.

@Priyansh121096
Copy link
Contributor Author

Thanks @hashhar !

@hashhar hashhar merged commit d6b0920 into trinodb:master Aug 20, 2025
12 checks passed
@hashhar
Copy link
Member

hashhar commented Aug 20, 2025

I'll update here once a new version with this is released (probably in a couple of weeks).

@Priyansh121096 Priyansh121096 deleted the pep561 branch August 20, 2025 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Make this package PEP-561 compatible by adding a py.typed marker
3 participants