Skip to content

[Feature] mypy typings #569

Open
Open

Description

@bryanforbes

Currently, asyncpg is untyped and has to be ignored as an import when using mypy. Because of this, I created an asyncpg-stubs package generated from stubgen that I use in my own projects as a git dependency, but it would be great to have these in the main library (and verified by the developers). If this is something that is desired, I would be willing to create the initial PR.

Activity

  1. 1st1 commented on May 18, 2020

    @1st1
    Member

    Yeah, we would love to see typing support in asyncpg.

  2. cstigen commented on Jul 1, 2022

    @cstigen

    Any update on whether asyncpg-stubs is planned to get merged into asyncpg?

  3. DanielNoord commented on Jul 30, 2024

    @DanielNoord
    Contributor

    @1st1 #577 seems a bit too big to merge and review, but there is lots of stuff in that PR that can easily be merged and will help reduce the noise around the more critical/problematic changes. To give an example def _check_conn_validity(self, meth_name: str) -> None:.

    Does it make sense to start splitting off some of those contributions into separate PRs so that they can be merged and users can benefit from improved IDE suggestions as well as get #577 more manageable (and therefore more mergeable)?

  4. DanielNoord commented on Oct 22, 2024

    @DanielNoord
    Contributor

    @elprans I know maintainers time is limited, but you just made a release and therefore seem the most active.

    I would like to dedicate time to getting type annotations for asyncpg to at least partially work, but it seems there is limited time to review PRs. Is there anyway that would make it feasible for you to review PRs that add type stubs without changing features of the package?

  5. elprans commented on Oct 22, 2024

    @elprans
    Member

    Happy to review if the typing-adding PR is split. It's nearly impossible to confidently review #577 as-is.

  6. DanielNoord commented on Oct 22, 2024

    @DanielNoord
    Contributor

    Cool! I made a first PR to test the waters here: #1197

    Let me know if there is anything you need from my side.

  7. nicholas-johnson-techxcel commented on May 19, 2025

    @nicholas-johnson-techxcel

    The Pool in asyncpg-stubs does not match the Pool in this package, they need to be unified.

  8. nicholas-johnson-techxcel commented on May 19, 2025

    @nicholas-johnson-techxcel

    I can pull request this and bring this up to py313 syntax with py.typed if you are willing to accept.

  9. dnk8n commented on May 4, 2026

    @dnk8n

    One year later, is this still being considered?

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