-
I am currently working on a codebase which uses python-like syntax but is not truly Python. This involves non conventional import statements such as I was wondering if this is something that's possible for Pyright to support through one of the configs. My thinking is that if Pyright had to support similar function-like imports in the past, then this convention may already be handle and that there may be existing hooks which I can reuse for my specific use case. For my use case, I only care about string literals, and don't need to support any string interpolation . |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Pyright is a standards-compliant Python type checker. What you're suggesting would be a non-standard extension. Pyright has no hard-coded knowledge of third-party libraries. All of its knowledge about the semantics of third-party libraries comes from the type annotations provided in the library code or in stub files. There's currently no way in the Python type system to indicate that a library is providing custom import behavior. If you want to explore something like this, you could propose it in the Python typing forum, but my guess is that there won't be much appetite within the typing community to support non-standard mechanisms like this. Pyright is open-sourced, so one option is to create your own fork. Another option is to use a |
Beta Was this translation helpful? Give feedback.
Pyright is a standards-compliant Python type checker. What you're suggesting would be a non-standard extension.
Pyright has no hard-coded knowledge of third-party libraries. All of its knowledge about the semantics of third-party libraries comes from the type annotations provided in the library code or in stub files. There's currently no way in the Python type system to indicate that a library is providing custom import behavior.
If you want to explore something like this, you could propose it in the Python typing forum, but my guess is that there won't be much appetite within the typing community to support non-standard mechanisms like this.
Pyright is open-sourced, so one option is to c…