cmakepresets


Namecmakepresets JSON
Version 0.2.6 PyPI version JSON
download
home_pageNone
SummaryA library for parsing CMakePresets.json
upload_time2025-03-18 22:18:33
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords cmakepresets.json cmake presets
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CMakePresets

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

[//]: # (x-release-please-start-version)
```bash
pip install git+https://github.com/tkk2112/cmakepresets.git@v0.2.6
```
[//]: # (x-release-please-end)

## Python API

```python
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

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

### List specific types of presets

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

### Show details of a specific preset

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

### Show in JSON format

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

### Find related presets

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

### Script-friendly output

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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cmakepresets",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "CMakePresets.json, cmake, presets",
    "author": null,
    "author_email": "Thomas Kristensen <thomas@sl.m04r.space>",
    "download_url": "https://files.pythonhosted.org/packages/b2/74/ce8b599d80f00e481963fa6affda8a08b9f3b0cca1ee3c4283398b0b36c8/cmakepresets-0.2.6.tar.gz",
    "platform": null,
    "description": "# CMakePresets\n\nA Python library and CLI tool for working with CMakePresets.json configuration files in CMake projects.\n\n## About\n\nCMakePresets 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.\n\n## Features\n\n- Parse and analyze CMakePresets.json files\n- List all available presets of different types (configure, build, test, package, workflow)\n- Show detailed information about specific presets\n- Find related presets (e.g., build presets that use a specific configure preset)\n- Display inheritance relationships between presets\n- Output in different formats (rich tables, plain text, JSON)\n\n## Installation\n\n[//]: # (x-release-please-start-version)\n```bash\npip install git+https://github.com/tkk2112/cmakepresets.git@v0.2.6\n```\n[//]: # (x-release-please-end)\n\n## Python API\n\n```python\nfrom cmakepresets import CMakePresets\n\n# Load presets from a file or directory\npresets = CMakePresets(\"path/to/CMakePresets.json\")\n# or\npresets = CMakePresets(\"path/to/project/directory\")\n\n# Access preset data\nconfigure_presets = presets.configure_presets\nbuild_presets = presets.build_presets\n\n# Get preset by name\npreset = presets.get_preset_by_name(\"configure\", \"my-preset\")\n\n# Get preset tree showing hierarchical relationships\npreset_tree = presets.get_preset_tree()\n\n# Get flattened preset with all inherited properties resolved\nflattened = presets.flatten_preset(\"configure\", \"my-preset\")\n```\n\n\n## CLI Usage\n\n### List all presets\n\n```bash\ncmakepresets --file CMakePresets.json list\ncmakepresets --directory /path/to/project list\n```\n\n### List specific types of presets\n\n```bash\ncmakepresets --file CMakePresets.json list --type configure\n```\n\n### Show details of a specific preset\n\n```bash\ncmakepresets --file CMakePresets.json show my-preset\ncmakepresets --file CMakePresets.json show my-preset --type configure\n```\n\n### Show in JSON format\n\n```bash\ncmakepresets --file CMakePresets.json show my-preset --json\n```\n\n### Find related presets\n\n```bash\ncmakepresets --file CMakePresets.json related my-configure-preset\ncmakepresets --file CMakePresets.json related my-configure-preset --type build\n```\n\n### Script-friendly output\n\n```bash\ncmakepresets --file CMakePresets.json related my-configure-preset --plain\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A library for parsing CMakePresets.json",
    "version": "0.2.6",
    "project_urls": {
        "Homepage": "https://github.com/tkk2112/cmakepresets",
        "Issues": "https://github.com/tkk2112/cmakepresets/issues",
        "Repository": "https://github.com/tkk2112/cmakepresets.git"
    },
    "split_keywords": [
        "cmakepresets.json",
        " cmake",
        " presets"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d283009951f6e850eb169de053bf4a31991ace7a63592c9ff55c1b11a3e1aff6",
                "md5": "982eda624efff0b47774cc47c0c29994",
                "sha256": "0ef2bd68f3d3b46d4011e618fa6c2393d1dfd6a318379a7ab859266ec7e657de"
            },
            "downloads": -1,
            "filename": "cmakepresets-0.2.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "982eda624efff0b47774cc47c0c29994",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 19688,
            "upload_time": "2025-03-18T22:18:32",
            "upload_time_iso_8601": "2025-03-18T22:18:32.765884Z",
            "url": "https://files.pythonhosted.org/packages/d2/83/009951f6e850eb169de053bf4a31991ace7a63592c9ff55c1b11a3e1aff6/cmakepresets-0.2.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b274ce8b599d80f00e481963fa6affda8a08b9f3b0cca1ee3c4283398b0b36c8",
                "md5": "f5666152d0e72cf730aa46c809444fc6",
                "sha256": "d981342571f52015a95af5da8e2a561eae9a53c2f13bebc6bb684874c28a82f1"
            },
            "downloads": -1,
            "filename": "cmakepresets-0.2.6.tar.gz",
            "has_sig": false,
            "md5_digest": "f5666152d0e72cf730aa46c809444fc6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 74803,
            "upload_time": "2025-03-18T22:18:33",
            "upload_time_iso_8601": "2025-03-18T22:18:33.761411Z",
            "url": "https://files.pythonhosted.org/packages/b2/74/ce8b599d80f00e481963fa6affda8a08b9f3b0cca1ee3c4283398b0b36c8/cmakepresets-0.2.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-03-18 22:18:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tkk2112",
    "github_project": "cmakepresets",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cmakepresets"
}
        
Elapsed time: 1.14493s