Skip to content

Add PEP 561 support #375

Closed
Closed

Description

@chdsbd

It would be useful to be able to use the type hints defined in this library with mypy. This library needs to add support for PEP 561 for this to work.

Activity

  1. untitaker commented on May 23, 2019

    @untitaker
    Member

    Thanks for bringing this to my attention, I think this should be fixed in the next release.

  2. RDIL commented on Nov 15, 2019

    @RDIL
    Contributor

    Mypy is still complaining for me.

  3. d33tah commented on Jan 27, 2020

    @d33tah

    Same here. Pinging @untitaker

  4. untitaker commented on Jan 27, 2020

    @untitaker
    Member

    can you go into more detail about what actually happens?

  5. d33tah commented on Jan 27, 2020

    @d33tah

    @untitaker consider the following Dockerfile:

    FROM python
    RUN pip install mypy sentry-sdk
    RUN echo 'import sentry_sdk\nsentry_sdk.init("a")' > a.py
    RUN mypy --strict a.py
    

    Here's what happens when you run docker build .:

    Sending build context to Docker daemon  2.048kB
    Step 1/4 : FROM python
     ---> d6a7b0694364
    Step 2/4 : RUN pip install mypy sentry-sdk
     ---> Using cache
     ---> 2e54c901f49a
    Step 3/4 : RUN echo 'import sentry_sdk\nsentry_sdk.init("a")' > a.py
     ---> Running in f5b0ac401a61
    Removing intermediate container f5b0ac401a61
     ---> 33e2ee6286de
    Step 4/4 : RUN mypy --strict a.py
     ---> Running in edd714b6961b
    a.py:2: error: Module has no attribute "init"
    Found 1 error in 1 file (checked 1 source file)
    The command '/bin/sh -c mypy --strict a.py' returned a non-zero code: 1
    
  6. untitaker commented on Jan 28, 2020

    @untitaker
    Member

    Okay right, --strict does not work. I don't know how to fix that. Patches welcome :)

  7. added
    Help Wanted
    on Jan 28, 2020
  8. rafales commented on Apr 22, 2020

    @rafales

    @untitaker mypy can't deal with dynamic __all__. Copying all entries and making it a simple list solves the problem.

    image

  9. intgr commented on Oct 26, 2020

    @intgr
    Contributor

    I created a PR #892 that enables type hints for the top-level sentry_sdk module.

    It seems that should address the problems brought up in this issue?

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

    Help Wanted

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions