Skip to main content

A library for parsing CMakePresets.json

Project description

CMakePresets 0.3.1

A Python library and CLI tool for working with CMakePresets.json configuration files in CMake projects.

About

CMakePresets is a utility that helps you inspect and work with CMake preset configurations. It provides both a Python API for programmatic access and a command-line interface for interactive use.

Features

  • Parse and analyze CMakePresets.json files
  • List all available presets of different types (configure, build, test, package, workflow)
  • Show detailed information about specific presets
  • Find related presets (e.g., build presets that use a specific configure preset)
  • Display inheritance relationships between presets
  • Output in different formats (rich tables, plain text, JSON)

Installation

pip install cmakepresets

Python API

from cmakepresets import CMakePresets

# Load presets from a file or directory
presets = CMakePresets("path/to/CMakePresets.json")
# or
presets = CMakePresets("path/to/project/directory")

# Access preset data
configure_presets = presets.configure_presets
build_presets = presets.build_presets

# Get preset by name
preset = presets.get_preset_by_name("configure", "my-preset")

# Get preset tree showing hierarchical relationships
preset_tree = presets.get_preset_tree()

# Get flattened preset with all inherited properties resolved
flattened = presets.flatten_preset("configure", "my-preset")

CLI Usage

List all presets

cmakepresets --file CMakePresets.json list
cmakepresets --directory /path/to/project list

List specific types of presets

cmakepresets --file CMakePresets.json list --type configure

Show details of a specific preset

cmakepresets --file CMakePresets.json show my-preset
cmakepresets --file CMakePresets.json show my-preset --type configure

Show in JSON format

cmakepresets --file CMakePresets.json show my-preset --json

Find related presets

cmakepresets --file CMakePresets.json related my-configure-preset
cmakepresets --file CMakePresets.json related my-configure-preset --type build

Script-friendly output

cmakepresets --file CMakePresets.json related my-configure-preset --plain

Project details


Download files

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

Source Distribution

cmakepresets-0.3.1.tar.gz (79.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cmakepresets-0.3.1-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file cmakepresets-0.3.1.tar.gz.

File metadata

  • Download URL: cmakepresets-0.3.1.tar.gz
  • Upload date:
  • Size: 79.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.6

File hashes

Hashes for cmakepresets-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c453073f7a845b7341fec4710d06e37ab221fd716b8bbd019641b2b0309d6c79
MD5 e16b87c6e1b1611d0146b138f3109562
BLAKE2b-256 3b5439529c6c99bc9e042ae781ba2c20411c21886f6ee559d6a41ea4dd2af607

See more details on using hashes here.

File details

Details for the file cmakepresets-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cmakepresets-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dd6dac8af321eb533a70b8f48904c0c4892ec71b548572ff65f7facc3d16cbce
MD5 a716d4f201b0321a00b3c30ea07f9b23
BLAKE2b-256 c5a7b065797cf5f3dd53698ba48f6368fb767eb32753c647458983171ae281b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page