.PYI 文件扩展名

Python Interface Definition

开发者 Python Software Foundation
受欢迎程度
4.2  |  5 
 

什么是 PYI 文件?

A PYI file is a code stub used to specify type hints for a Python module. Python type checkers can read PYI files and use them to warn developers of potential type mismatches. PYI files have the same syntax as regular Python modules; they are typically stored alongside the module for which they contain type hints.

更多信息

在 Microsoft Visual Studio Code 中打开的 .pyi 文件截图
在 Microsoft Visual Studio Code 中打开的 PYI 文件

Because Python is a dynamically-typed programming language, the Python interpreter performs type checking only when code runs. However, some Python code editors allow developers to manually define and check a module's types while coding, using PYI files. That way, developers can catch and fix type errors before attempting to run their program.

For example, JetBrains PyCharm allows developers to check types using PYI files. If a developer's code creates a mismatch between a module's actual and defined types, PyCharm will warn the developer.

如何打开 PYI 文件

You can open and edit a PYI file in any text or source code editor. Source code editors, such as Microsoft Visual Studio Code (multiplatform), Sublime Text (multiplatform), and JetBrains PyCharm (multiplatform), provide helpful syntax-highlighting and code-editing tools that make reviewing and editing PYI files easier.

使用File Viewer Plus打开 400 多种文件格式。免费下载

可打开 PYI 文件的程序

分类: 开发者
更新时间: 2022-03-21

验证者 FileInfo.com

FileInfo.com 团队 独立研究了本页面列出的 Python Interface Definition 文件格式和 Mac, Windows, and Linux 应用。 我们的目标是达到 100% 的准确率,并且仅发布我们已验证过的文件类型信息。

如果您想为此页面提出新增或更新建议,请告诉我们