.pyi Python 3 script

Text & source code

MIME typetext/x-python3
DescriptionPython 3 script
CategoryText & source code
Signature (magic bytes)23 21 20 2F 62 69 6E 2F 70 79 74 68 6F 6E 33 (#! /bin/python3)
23 21 2F 62 69 6E 2F 70 79 74 68 6F 6E 33 (#!/bin/python3)
Based ontext/x-python
Other extensions.py, .py3, .py3x

Frequently asked questions

What is a .pyi file?

A .pyi file is a “Python 3 script” (MIME type text/x-python3).

How do I open a .pyi file?

With any text editor – Notepad++, Visual Studio Code, or gedit and vim on Linux. The file contains readable text, possibly source code or configuration.

How can you tell a genuine .pyi file?

By the bytes at the start of the file, the signature (magic bytes): 23 21 20 2F 62 69 6E 2F 70 79 74 68 6F 6E 33 (#! /bin/python3) and 23 21 2F 62 69 6E 2F 70 79 74 68 6F 6E 33 (#!/bin/python3). On Linux and macOS, file --mime-type example.pyi checks the real type regardless of the extension.

Which format is .pyi based on?

Technically a .pyi file is a subtype of “Python script” (text/x-python), so programs for that base format can often read it too.

Which MIME type belongs to .pyi?

The MIME type is text/x-python3. In the Apache web server: AddType text/x-python3 .pyi; in nginx: types { text/x-python3 pyi; }.

Nearby entries