{"id":6571,"library":"cmeel","title":"Cmeel - CMake Wheel Builder","description":"Cmeel is a Python PEP 517/518 build backend that enables building Python wheels directly from CMake projects. It streamlines the packaging of C++/C/Fortran code wrapped for Python, automating much of the build process. It has an active and frequent release cadence, often with multiple patch or minor releases per month.","status":"active","version":"0.59.0","language":"en","source_language":"en","source_url":"https://github.com/cmake-wheel/cmeel","tags":["build-system","cmake","wheel","packaging","cxx","fortran"],"install":[{"cmd":"pip install cmeel","lang":"bash","label":"Install cmeel"}],"dependencies":[],"imports":[{"note":"Cmeel is primarily a build backend and not intended for direct programmatic import in user Python code. Its main entry point for users is through the `pyproject.toml` configuration.","symbol":"cmeel","correct":"build-system.build-backend = \"cmeel\" (in pyproject.toml)"}],"quickstart":{"code":"# 1. Create a pyproject.toml file\n# pyproject.toml\n# ---\n# [build-system]\n# requires = [\"cmeel[build]>=0.59.0\"]\n# build-backend = \"cmeel\"\n#\n# [project]\n# name = \"my-cmake-project\"\n# version = \"0.1.0\"\n# description = \"A simple project built with CMake and cmeel\"\n# requires-python = \">=3.9\"\n# ---\n\n# 2. Create a minimal CMakeLists.txt file\n# CMakeLists.txt\n# ---\n# cmake_minimum_required(VERSION 3.15)\n# project(my_cmake_project LANGUAGES CXX)\n# \n# # Required to find Python headers and libraries for extensions\n# find_package(Python 3.9 COMPONENTS Interpreter Development REQUIRED)\n# \n# # A real project would add sources and build Python extensions here.\n# # For this quickstart, we just ensure CMake configures successfully.\n# message(STATUS \"CMake successfully configured with Python ${Python_VERSION}\")\n# ---\n\n# 3. Create a package directory and an __init__.py\n# mkdir -p src/my_cmake_project\n# touch src/my_cmake_project/__init__.py\n# ---\n# src/my_cmake_project/__init__.py\n# ---\n# # Minimal __init__.py for a package structure\n# __version__ = \"0.1.0\"\n# ---\n\n# 4. Build the wheel\n# Run this command in the project root directory:\n# python -m build --wheel\n\nimport os\nimport subprocess\n\ndef create_file(path, content):\n    os.makedirs(os.path.dirname(path), exist_ok=True)\n    with open(path, 'w') as f:\n        f.write(content)\n\n# Create a temporary directory for the project\nproject_dir = \"cmeel_quickstart_project\"\nos.makedirs(project_dir, exist_ok=True)\nos.chdir(project_dir)\n\n# 1. pyproject.toml\ncreate_file(\"pyproject.toml\", '''\n[build-system]\nrequires = [\"cmeel[build]>=0.59.0\"]\nbuild-backend = \"cmeel\"\n\n[project]\nname = \"my-cmake-project\"\nversion = \"0.1.0\"\ndescription = \"A simple project built with CMake and cmeel\"\nrequires-python = \">=3.9\"\n''')\n\n# 2. CMakeLists.txt\ncreate_file(\"CMakeLists.txt\", '''\ncmake_minimum_required(VERSION 3.15)\nproject(my_cmake_project LANGUAGES CXX)\n\nfind_package(Python 3.9 COMPONENTS Interpreter Development REQUIRED)\n\nmessage(STATUS \"CMake successfully configured with Python ${Python_VERSION}\")\n''')\n\n# 3. Package directory and __init__.py\ncreate_file(\"src/my_cmake_project/__init__.py\", '# Minimal __init__.py\\n__version__ = \"0.1.0\"\\n')\n\nprint(\"Project structure created. Now attempting to build the wheel...\")\n\ntry:\n    # 4. Build the wheel\n    # Use 'python -m build' command for PEP 517/518 backends\n    result = subprocess.run([\"python\", \"-m\", \"build\", \"--wheel\"], capture_output=True, text=True, check=True)\n    print(\"Build successful!\")\n    print(\"\\n--- Build Output ---\")\n    print(result.stdout)\n    print(\"\\n--- Build Errors (if any) ---\")\n    print(result.stderr)\n    print(\"\\nLook for the .whl file in the 'dist/' directory.\")\nexcept subprocess.CalledProcessError as e:\n    print(f\"Build failed: {e}\")\n    print(f\"Stdout: {e.stdout}\")\n    print(f\"Stderr: {e.stderr}\")\nexcept FileNotFoundError:\n    print(\"Error: 'python -m build' command not found. Please install the 'build' package: pip install build\")\nfinally:\n    # Clean up (optional, for running in a sandbox)\n    os.chdir(\"..\")\n    # import shutil\n    # shutil.rmtree(project_dir)\n    # print(f\"Cleaned up directory: {project_dir}\")\n","lang":"python","description":"This quickstart demonstrates how to set up a minimal project using `cmeel` as a build backend. It creates the necessary `pyproject.toml`, `CMakeLists.txt`, and a package structure, then attempts to build a wheel using `python -m build`."},"warnings":[{"fix":"Ensure your project's `requires-python` in `pyproject.toml` and your development environment use Python 3.9 or a later version.","message":"Cmeel now requires Python 3.9 or newer. Projects using older Python versions will need to upgrade their interpreter to use cmeel v0.58.0 and later.","severity":"breaking","affected_versions":">=0.58.0"},{"fix":"Migrate your project configuration from `setup.py` to `pyproject.toml` using the standard PEP 621 metadata fields for `[project]` and `[build-system]`.","message":"Cmeel is a PEP 517/518 build backend and only supports `pyproject.toml` for project configuration. It does not support legacy `setup.py` files.","severity":"gotcha","affected_versions":"all"},{"fix":"Update any CI/CD pipelines, git clones, or local branches that refer to `master` to use `cmeel` instead (e.g., `git checkout cmeel`).","message":"The main development branch of the cmeel repository was renamed from `master` to `cmeel`.","severity":"gotcha","affected_versions":">=0.58.0"},{"fix":"If targeting musl-based systems, ensure your build environment and deployment targets are aligned with the `musllinux_1_2` standard, and rebuild wheels as necessary.","message":"The musllinux wheel standard was updated from `musllinux_1_1` to `musllinux_1_2` in v0.58.0. This may affect compatibility for wheels deployed on specific musl-based Linux distributions, requiring a rebuild for the newer standard.","severity":"gotcha","affected_versions":">=0.58.0"},{"fix":"Explicitly specify the Python version and required components in your `CMakeLists.txt` (e.g., `find_package(Python 3.9 COMPONENTS Interpreter Development REQUIRED)`). For troubleshooting, set `CMAKE_ARGS` environment variable to include more verbose CMake output (e.g., `export CMAKE_ARGS=\"-DCMAKE_VERBOSE_MAKEFILE=ON\"`).","message":"While `cmeel` attempts to configure CMake with the correct Python interpreter using `-DPython_EXECUTABLE` and `-DPython3_EXECUTABLE`, complex or non-standard Python environments can still lead to CMake failing to find Python. This is especially true if `find_package(Python)` is used without specifying a version or components.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}