.PXD

PXD File

Cython Definition File
Ask a question
QUICK ANSWER

A .pxd file is a Cython definition file - the Cython equivalent of a C header (.h). It holds C-level declarations that other Cython modules import with 'cimport'. Open it in any code editor such as VS Code or PyCharm; you do not run it directly. The Cython compiler reads it at build time.

Developer: Cython project (originally Pyrex by Greg Ewing) Category: Developer Files Open standard MIME: text/x-cython
OPENS ON Windows macOS Linux
Related: .DO · .MD · .HEX · .XSD

On this page

19k+ extensions indexed
Last reviewed Jul 14, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the PXD file format?

.pxd is a developer file format originally associated with the Pyrex programming language and now the standard declaration format for Cython, its actively maintained successor. .pxd files store module declarations - type definitions, function signatures, and external C library interfaces - that can be shared across Cython modules. Much like a C header, a .pxd is added to the build so that other modules can access the declared types and functions. Cython stores implementation code in .pyx files.

Pyrex allowed developers to create Python extension modules using C-like syntax. Cython, forked from Pyrex in 2007, supports both C and Python syntax and remains the actively maintained project today. Both Pyrex and Cython syntax closely resembles that of Python rather than C, making adoption approachable for Python developers. Applications that mix modules written in C and Python are more efficient performance-wise, at the cost of some code complexity and additional compilation steps. A .pxd declaration file is brought into another Cython source using the cimport keyword - unlike standard Python modules, which use import.

Security & safety

RISK: LOW

A .pxd is plain-text source code - not executable on its own and low risk to open in an editor. The usual source-code caution applies: building a project that includes untrusted .pyx/.pxd files runs the Cython compiler and a C compiler on that code, which can execute arbitrary build logic - only compile code you trust. Reading a .pxd is harmless.

Format details

in a nutshell
FULL NAMECython Definition Fileaka Cython declaration file, Cython header file
DEVELOPERCython project (originally Pyrex by Greg Ewing)since Pyrex (early 2000s); adopted and extended by Cython (forked 2007)
MIME TYPEtext/x-cython
TYPESource code - Cython declaration file (text)
STANDARDOpen · royalty-free
This extension is also used by…
  • Pixadex icon library (Mac) - The discontinued Mac app Pixadex stored icon collections in .pxd files - unrelated to Cython.
  • Pyxis / PixelView / ProxyDesigner data - Various niche tools (a Pyxis molecular viewer, ProxyDesigner) used .pxd for their own binary project/data files.

Programs that open PXD files

Windows3 apps
Visual Studio Code Free Open the .pxd as text; install the Cython extension for syntax highlighting.
Cython (compiler/toolchain) Open-source Used at build time: Cython reads the .pxd when compiling .pyx modules that cimport it (pip install cython).
PyCharm Freemium Open the project; PyCharm recognizes Cython files and provides editing support.
macOS1 app
Cython (compiler/toolchain) Open-source pip install cython; the compiler consumes .pxd during builds. Edit with any code editor.
Linux1 app
Cython (compiler/toolchain) Open-source pip install cython; edit .pxd in any editor (Vim, VS Code) and build via setup.py/cythonize.

Technical details

deep spec
File typePlain-text Cython declaration source file
MIME typetext/x-cython (also accepted as text/plain)
Character encodingUTF-8 or ASCII; human-readable source text with no binary header
File signatureNone - recognized by extension and Cython-specific keywords such as cdef, ctypedef, and cimport
Paired formatTypically paired with a same-named .pyx implementation file (e.g., mymodule.pxd alongside mymodule.pyx)
Import mechanismConsumed by other Cython modules via the cimport keyword, not the standard Python import statement
Content restrictionsDeclarations only: cdef types and functions, ctypedef, struct/union/enum, extern C/C++ blocks; no function implementations or executable statements permitted
Compilation roleBuild-time only; not compiled to a separate binary - declarations are inlined into consuming .pyx files by the Cython compiler
C analogueFunctional equivalent of a C .h header file for Cython modules
ToolchainProcessed by the Cython compiler; integrates with setuptools, pip, scikit-build, and CMake build systems
Platform supportCross-platform: Windows, macOS, Linux - any OS with a C compiler and CPython or PyPy
Typical file sizeA few hundred bytes to tens of KB, depending on the number of declared symbols
Language versioningFollows the Cython language version of the compiling toolchain (currently Cython 3.x)
ReleasedPyrex (early 2000s); adopted and extended by Cython (forked 2007)
Latest versionTracks the current Cython release (Cython 3.x)
Open standardYes · royalty-free
Specificationcython.readthedocs.io

PXD conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with PXD files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about PXD files.

Frequently asked questions

What is a .pxd file?
It's a Cython definition file - the Cython version of a C header (.h). It declares C-level types and functions that other Cython modules import with 'cimport'. It's plain-text source code.
How do I open a .pxd file?
Open it in any code/text editor - VS Code (with the Cython extension), PyCharm, Vim, etc. It's human-readable source. You don't 'run' it; the Cython compiler uses it during builds.
What's the difference between .pxd and .pyx?
A .pyx is the implementation (the actual code); a .pxd is the declaration/interface (like a .h header) shared with other modules via cimport. They often have the same base name and work together.
Can a .pxd contain function bodies or Python classes?
No. A .pxd holds only declarations - no function/method implementations, no Python (def) class definitions, no executable statements. Those belong in the .pyx.
Is .pxd a Pyrex or Cython file?
It originated in Pyrex, but Pyrex is abandoned and Cython (which forked from it in 2007) is the maintained standard. Today a .pxd is a Cython file.
Why do scientific Python packages ship .pxd files?
So other Cython code can cimport their fast C-level APIs. Packages like NumPy and scikit-learn provide .pxd files to expose their C interfaces for high-performance extensions.

References

1Cython - pxd files (tutorial)cython.readthedocs.io
2Cython - Sharing Declarations Between Modulescython.readthedocs.io

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.JPGJPEG Image
4.DATProgram Data File (generic)
5.EXEWindows Executable (Portable Executable)
6.RPMSGRestricted Permission Message
7.PARTPartial Download File
8.BINCD/DVD Disc Image (BIN/CUE)
9.DBSQLite Database File
10.JSONJavaScript Object Notation file

Related extensions

.DOStata Do-File
.MDMarkdown Document
.HEXIntel HEX File
.XSDXML Schema Definition
.MAPSource Map (JavaScript / CSS)
.CONFIGConfiguration File

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z