{"id":865,"library":"flit-core","title":"Flit-core","description":"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.","status":"active","version":"3.12.0","language":"python","source_language":"en","source_url":"https://github.com/pypa/flit","tags":["python","packaging","build-backend","pep517","distribution"],"install":[{"cmd":"pip install flit-core","lang":"bash","label":"Install flit-core"}],"dependencies":[{"reason":"Core dependency for Python package functionality.","package":"python","optional":false}],"imports":[{"note":"flit_core.buildapi is the *only* public interface, exposed for PEP 517 build backend integration. Direct user-level imports for typical application logic are uncommon; most users interact via the `flit` CLI or `python -m build`.","symbol":"buildapi","correct":"from flit_core import buildapi"}],"quickstart":{"code":"# This is typically found in pyproject.toml, not direct Python code.\n# A project using flit-core as its build backend would declare it like this:\n\n# pyproject.toml\n# [build-system]\n# requires = [\"flit_core>=3.2,<4\"]\n# build-backend = \"flit_core.buildapi\"\n\nprint(\"flit-core is primarily a build backend. \")\nprint(\"Its usage is declared in pyproject.toml and invoked by build tools.\")\nprint(\"For creating and publishing a package, install 'flit' (pip install flit).\")\nprint(\"Then run 'flit init' and 'flit publish'.\")","lang":"python","description":"Flit-core is a build backend, not typically imported directly by end-user applications for their runtime logic. Its primary 'usage' is being declared in a project's `pyproject.toml` file to specify how the package should be built. The example shows the standard `pyproject.toml` configuration for using `flit-core`."},"warnings":[{"fix":"Migrate your project's metadata from `[tool.flit.metadata]` to the `[project]` table in `pyproject.toml`.","message":"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`.","severity":"breaking","affected_versions":"Flit 4.0 onwards (affects projects built with Flit)"},{"fix":"Explicitly define `sdist` inclusions/exclusions in `pyproject.toml` under `[tool.flit.sdist]`, or use `python -m build` which already bypasses this implicit Git integration.","message":"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.","severity":"breaking","affected_versions":"Flit 4.0 onwards (affects projects built with Flit CLI)"},{"fix":"For packaging projects, install `flit` (`pip install flit`) and use its CLI commands (`flit init`, `flit build`, `flit publish`), or use `python -m build` combined with `twine upload` for a more universal packaging workflow.","message":"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`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your development and build environments use Python 3.6 or newer.","message":"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.","severity":"gotcha","affected_versions":"All versions (specific minimum Python version varies by flit-core version)"}],"env_vars":null,"last_verified":"2026-05-12T20:32:15.633Z","next_check":"2026-06-27T00:00:00.000Z","problems":[{"fix":"Ensure `flit_core` is installed in the environment or that the build process correctly handles build isolation. If building a project, `pip install .` or `python -m build` should automatically manage build backend dependencies. For specific scenarios like `conda build`, explicitly add `flit-core` to build dependencies.","cause":"This error occurs when the Python environment where a build or installation is being attempted cannot locate the `flit_core` package, often due to build isolation issues or an incomplete environment setup where a tool expects `flit_core` to be directly importable.","error":"ModuleNotFoundError: No module named 'flit_core'"},{"fix":"Refactor the project's `__init__.py` to avoid relative imports if Flit needs to import it to determine the version. Alternatively, ensure the version can be determined through static analysis (e.g., by defining `__version__` directly without complex logic or imports).","cause":"This specific module not found error arises when Flit attempts to extract the package version by importing the module (due to static analysis failure) and encounters a relative import within the `__init__.py` file of the package being built, which fails during this fallback import.","error":"ModuleNotFoundError: No module named 'flit_core.dummy'"},{"fix":"Verify network connectivity if installing online, check PyPI mirrors or internal package indexes, or ensure that the correct `flit_core` wheel file (matching the required version range and platform) is available in the specified `--find-links` directory for offline installations. Using `--no-build-isolation` might sometimes circumvent the issue if the host environment already has a suitable `flit-core` version.","cause":"This error typically indicates that `pip` is unable to find a compatible `flit-core` distribution that matches the version requirements specified by a dependent package, often in offline installation scenarios, due to a misconfigured package index, or when a pre-downloaded wheel is not located correctly.","error":"ERROR: Could not find a version that satisfies the requirement flit_core<4,>=3.9.0 (from versions: none). ERROR: No matching distribution found for flit_core<4,>=3.9.0"},{"fix":"Change the `backend-path` entry in your `pyproject.toml` from a string to a list. For example, change `backend-path = \".\"` to `backend-path = [\".\"]`.","cause":"This error occurs because the `backend-path` field in `pyproject.toml` (specifically for `flit-core >= 3`) expects a list of paths, even if there's only one, but it was provided as a string.","error":"Invalid pyproject.toml: TOML parse error at line X, column Y | backend-path = \".\" | ^^^ invalid type: string \".\", expected a sequence."},{"fix":"Ensure the build command or tool explicitly recognizes `pyproject.toml` as the build system (e.g., `pip install .` or `python -m build`). If using an older tool that strictly requires `setup.py`, consider if `flit` is the appropriate build backend or explore options to generate a `setup.py` if available (though this goes against the spirit of Flit's simplicity).","cause":"This error happens when an external tool or a build environment expects a `setup.py` file, but the project is configured to use `flit-core` as its build backend, which relies solely on `pyproject.toml` for metadata and build instructions and does not generate a `setup.py` by default.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'setup.py'"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.12.0","cli_name":"flit","install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","installed_version":"3.12.0","pypi_latest":"3.12.0","is_stale":false,"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"flit-core","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.19,"mem_mb":9.6,"disk_size":"18.1M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"flit-core","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.21,"mem_mb":9.6,"disk_size":"18.1M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"flit-core","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.13,"mem_mb":9.6,"disk_size":"19M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"flit-core","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.13,"mem_mb":9.6,"disk_size":"19M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"flit-core","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.29,"mem_mb":10.1,"disk_size":"20.0M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"flit-core","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.33,"mem_mb":10.1,"disk_size":"20.0M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"flit-core","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.24,"mem_mb":10.1,"disk_size":"21M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"flit-core","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.25,"mem_mb":10.1,"disk_size":"21M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"flit-core","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.24,"mem_mb":10.2,"disk_size":"11.9M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"flit-core","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.29,"mem_mb":10.2,"disk_size":"11.9M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"flit-core","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.4,"import_time_s":0.24,"mem_mb":10.2,"disk_size":"12M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"flit-core","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.25,"mem_mb":10.2,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"flit-core","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.22,"mem_mb":9.7,"disk_size":"11.6M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"flit-core","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.24,"mem_mb":9.7,"disk_size":"11.5M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"flit-core","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.21,"mem_mb":9.5,"disk_size":"12M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"flit-core","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.23,"mem_mb":9.5,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"flit-core","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.17,"mem_mb":9.2,"disk_size":"17.6M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"flit-core","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.21,"mem_mb":9.2,"disk_size":"17.6M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"flit-core","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0.15,"mem_mb":9.2,"disk_size":"18M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"flit-core","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.15,"mem_mb":9.2,"disk_size":"18M"}]},"quickstart_checks":{"last_tested":"2026-04-24","tag":null,"tag_description":null,"results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}