Skip to main content

A library for parsing CMakePresets.json

Project description

CMakePresets 0.3.0

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.0.tar.gz (74.9 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.0-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cmakepresets-0.3.0.tar.gz
Algorithm Hash digest
SHA256 17c1cbe48b24e0393920917c4b6c7ec21a8542eb8a191be6ab1eceb8aaa3f16a
MD5 ff01791c1ae8b7f7bfd54239fb52ae90
BLAKE2b-256 b49d32ffe6c666316ebf8d97afbb2d4dab0ca790001a6972ab6be75ba6be2f02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cmakepresets-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5563a7c5f6cc3efcb1ca0dc4e0b0afe71196d70a4b06f34ad0cfb17529ec10c4
MD5 f811b813cb2b2aa9343d876394653b5f
BLAKE2b-256 e671e8c083db40230a9aa6e028ed3ecf9adba62aff80413c105ae78f55fc69b9

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