Flit-core
Flit-core provides a PEP 517 compliant build backend, encapsulating the core distribution-building logic for projects that use Flit for packaging. It is an essential dependency for the user-facing `flit` tool, enabling the creation of wheels and source distributions. The current version is 3.12.0, released on March 25, 2025, and maintains a fairly active release cadence with multiple updates throughout the year.
Warnings
- breaking Upcoming Flit 4.0 (which uses flit-core) plans to remove support for old-style metadata in `[tool.flit.metadata]` in favor of the standardized `[project]` table in `pyproject.toml`.
- breaking In Flit 4.0, the `flit build` command will no longer default to using information from Git to determine source distribution contents. This changes how `sdist` includes are determined by default, to be more explicit.
- gotcha Flit-core provides a PEP 517 build backend and is an internal component. Direct programmatic interaction for general packaging tasks is usually done via the `flit` CLI or standard tools like `python -m build` and `twine`.
- gotcha Flit-core requires Python 3. While older `flit-core` versions supported Python 3.4+, current versions (like 3.12.0) explicitly require `Python >=3.6`. Ensure your environment meets this minimum requirement.
Install
-
pip install flit-core
Imports
- buildapi
from flit_core import buildapi
Quickstart
# This is typically found in pyproject.toml, not direct Python code.
# A project using flit-core as its build backend would declare it like this:
# pyproject.toml
# [build-system]
# requires = ["flit_core>=3.2,<4"]
# build-backend = "flit_core.buildapi"
print("flit-core is primarily a build backend. ")
print("Its usage is declared in pyproject.toml and invoked by build tools.")
print("For creating and publishing a package, install 'flit' (pip install flit).")
print("Then run 'flit init' and 'flit publish'.")