Skip to main content

Python compatibility headers

Project description

py3c helps you port C extensions to Python 3.

It provides a detailed guide, and a set of macros to make porting easy and reduce boilerplate.

Design principles

  • Reduce chances of accidental subtle errors
  • Minimize boilerplate
  • Prefer the Python 3 way of doing things
  • Minimize semantic changes under Python 2


Projects using py3c will be compatible with CPython 2.6, 2.7, and 3.3+.


A detailed porting guide is provided.

A cheatsheet is available for those that already know the Python C API, and want to know what the py3c macros do.


If your build system supports pkg-config, you can set it up to look for a system-wide installation of py3c.

Alternately, py3c can be used as a header-only library: copy the headers to your project and use them.

If you wish to install py3c system-wide (e.g. if you are a distro packager), see the Contributing chapter in the documentation.


The code is licensed under the MIT license. May it serve you well.

The documentation is licensed under CC-BY-SA 3.0.

See the files LICENSE.MIT and doc/LICENSE.CC-BY-SA-3.0.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for py3c, version 1.3
Filename, size File type Python version Upload date Hashes
Filename, size py3c-1.3-py2.py3-none-any.whl (9.2 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size py3c-1.3.tar.gz (2.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page