Michio JP

Michio JP


How to Support CPython Extension Module for Flit

This is a PEP 517 build backend piggybacking (and hacking) Flit to support building C extensions.

Mostly a proof-of-concept, but could be further developed into something more generally useful if Flit can better support hooking into the build system.


  • Can build C extensions.
  • Does not require a user to pre-install a compiler.
  • Very good caching; incremental compilation performs much better than setuptools from my totally non-scientific observation.
  • Produces a wheel with appropriate-ish tag for distribution.


  • Since Flit only supports one single top-level Python module/package, and enforces the existence of that file/directory, this can only build extensions as a submodule of a package right now.
  • Since Flit's automatic metadata introspection (read version and description from module) needs to import the top-level module/package, you either need to jump through some hooks to make those work without the extension being available, or only write metadata in pyproject.toml.
  • Slower "cold" compilation time compared to setuptools and platform-provided compilers.
  • Does not allow custom compiler flags (possible to implement).
  • Only handles C for now. I believe it's possible to support C++ (and Zig).
  • Probably more, setuptools has so many years behind it and can therefore cover many edge cases I've never dreamt of.


  • Compiles extension modules directly into the top-level Python package. This makes it possible to run the extension "in-place" without installing, which I find useful. But it makes the source tree a bit messy (you probably need to run git clean once in a while to keep things sane).


There's a minimal example in examples/demo that has all the needed parts.

requires = ["zlig"]
build-backend = "zlig"

# ... Project metadata declaration.

# Exclude extension modules from sdist.
exclude = ["src/demo/*.so"]

# Declare extensions and its sources.
extensions = [{name = "demo.demo", sources = ["src/**/*.c"]}]

Add the following entries to your .gitignore:

# Flit builds things to /dist so add it too.
# Also *.pyd and *.so files but you should've already ignored them.


As a PEP 517 backend, this module simply bridges most of Flit's build API, but re-implements build_wheel to do some additional things:

  • Compile extension modules before handing the package to Flit, which would add all the files (including compiled extensions) into the wheel.
  • When adding a file to the wheel, first check whether the file is an extension's source and exclude it.
  • Override Flit's logic deciding a wheel's file name to use a platform-specific wheel tag instead.

Compilation magic is provided by Zig's build system. A working Zig compiler is installed as a PEP 517 build dependency. During compilation, the backend generates a build script (build.zig) from pyproject.toml, and call the Zig compiler to do the rest. After compilation, those binaries are copied to the location Flit expects to fine modules.

Download Details:

Author: uranusjr
Download Link: Download The Source Code
Official Website: https://github.com/uranusjr/zlig 
License: MIT License

What is GEEK

Buddha Community

How to Support CPython Extension Module for Flit
Rahim Makhani

Rahim Makhani


Get the best Magento maintenance service for your e-commerce store

Magento is the most demanded technology for developing online eCommerce stores and Magento service is important for better working of the online store. Nevina Infotech provides you with Magento maintenance and services.

Magento maintenance is the process of checking the performance of the website and checking the regular updates, backups, online store management, and much more.

You can choose Nevina Infotech for Magento maintenance service for your eCommerce store. We provide the best Magento support and maintenance for eCommerce stores.

#magento maintenance and support services #magento support services #magento support and maintenance #magento support #magento maintenance support #magento technical support

Rahim Makhani

Rahim Makhani


Maintain your Magento app for a smoother and faster user Experience

Magento is the best open-source eCommerce platform for website development. We all know the importance of a website in every sector; whether it is about business or anything else, it can represent the look and feel of your company. So to maintain these websites, it is essential to do Magento support and maintenance so that you can also maintain your website.

Nevina Infotech is the best Magento app development company that can guide you to maintain and support your Magento app. We have a dedicated team of developers who will help you with the maintenance and support of your app.

#magento maintenance and support services #magento support services #magento support and maintenance #magento support #magento maintenance support #magento technical support

Rahim Makhani

Rahim Makhani


Maintain your Magento web app for better Performance

Magento is the best cross-platform framework that helps you to develop the best eCommerce web apps. It is important to maintain your Magento eCommerce web app to increase the performance of your web application.

Magento maintenance and support services play a vital role in maintaining the website because if the website or web app is not maintained properly it can create bugs in the future and many more problems can occur through which there is a chance that customers get frustrated and won’t visit your website again.

Nevina Infotech is the best choice for Magento maintenance and service of your web apps. We have a hardworking team of developers that will help you to increase the performance of your web apps.

#magento maintenance and support services #magento support services #magento support and maintenance #magento support #magento maintenance support #magento technical support

Rahim Makhani

Rahim Makhani


Get the latest Features in your current eCommerce App

Are you tired of outdated features in your eCommerce app and do you want some latest and trending features in your eCommerce app? Then you need to update your app regularly to stay updated with the latest and trending features to add to your app. For updating it you need to update to the latest version of the Magento so that whatever update occurs in the latest version can also occur in your eCommerce app.

You can hire Nevina Infotech that can help you to provide Magento support and maintenance and will also guide you to update your eCommerce app for adding the latest features to your app. Our team is great and enthusiastic about their work. You can easily rely on us to get the latest features in your eCommerce app.

#magento maintenance and support services #magento support services #magento support and maintenance #magento support #magento maintenance support #magento technical support

Gloria Jenkins


Epson printer support

If you face an Epson printer malfunction, you first go for technical assistance directly from the official tech support center. They would only supply you with an internet service, which will take a lot of time and will also provide very little or no support. With the aid of Epson Printer technical assistance, the errors in Epson printers are quickly handled. We provide our customers with the best Epson customer support. To overcome the challenges, we have a team of well-experienced and qualified experts.
Get More info: https://epsonprintersupports.com/

#epson printers support #epson printer support #epson printer support number #epson printer technical support number #epson printer technical support #epson printer customer service