Skip to content
Discussion options

You must be logged in to vote

There are two scenarios here:

Scenario 1: You want to type check a codebase that imports symbols from the toy-package library, but the toy-package library is either written in a language other than Python or is written in untyped Python. Stub files are designed for this scenario. You can create stub files and include them either within toy-package or as a separate "stub library". Consumers of toy-package can then benefit from type checking when they import symbols from the library. When a type checker sees a import statement like from toy_package.foo import bar, it will look for a toy_package/foo.pyi stub file before looking for a toy_package/foo.py file. If the stub file exists, it will …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@wilgri
Comment options

@erictraut
Comment options

Answer selected by wilgri
@wilgri
Comment options

@erictraut
Comment options

@wilgri
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants