8000 [question] Current recommended way to use an internal library with type annotations · Issue #4608 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content
[question] Current recommended way to use an internal library with type annotations #4608
Closed
@mfcabrera

Description

@mfcabrera

Hi,

I have a question/bug that may be related to this bug and to this pep-0561 but I am using mypy maybe this is the right place to ask-

I have two modules/package:

  • A with inline typing information - it is an internal package and it won't probably be open source. We distribute package A with an internal pipy server.
  • Module B uses module A and wants to make use of A typing information.

Installing the package:
If I do: pip install A or using python setup.py develop / pip install -e . and then try to check with mypy files from module B that import module A I get the message:

B/foo.py:14: error: Cannot find module named `A`
B/foo.py:14: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)

In my case I don't want to use --ignore-missing-imports as module A has type annotations.
I could use MYPYPATH but that would mean that I have to set it for each of my internal packages that contain type annotation.

So the question:
Is there a recommended way to distribute type annotation for non-opensource libraries that mypy can automatically use it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0