Conan C/C++ Package Manager

2.27.0 · active · verified Fri Apr 10

Conan is an open-source C/C++ package manager that facilitates dependency management and binary distribution for C and C++ projects. It offers significant flexibility for integrating with various build systems, compilers, and configurations across different platforms. The current version is 2.27.0, and it maintains an active development cycle with frequent releases, typically on a monthly or bi-monthly cadence.

Warnings

Install

Imports

Quickstart

This quickstart initializes the Conan API and demonstrates how to programmatically interact with Conan, specifically by listing recipes in the local cache and retrieving the Conan home directory. The `ConanAPI` object provides access to various sub-APIs for different functionalities.

from conan.api.conan_api import ConanAPI

# Initialize the Conan API. For advanced use, cache_folder can be specified.
conan_api = ConanAPI()

print("Conan API initialized.")

# Example: List installed recipes in the local cache
# The 'list' sub-API provides methods for inspecting packages and recipes.
local_recipes = conan_api.list.recipes(query="*")

if local_recipes:
    print(f"Found {len(local_recipes)} local recipes:")
    for ref in local_recipes:
        print(f"  - {ref}")
else:
    print("No recipes found in the local Conan cache.")

# Example: Get Conan's current home folder
conan_home = conan_api.home_folder
print(f"Conan home folder: {conan_home}")

view raw JSON →