Python API

Warning

The full Python API is experimental. See the Conan stability section for more information.

The Python API is a set of Python classes that allow you to interact with Conan programmatically. It’s designed to be used as part of the custom commands extension point, or in Python scripts or applications, providing a more flexible and powerful way to work with Conan than the command line interface.

It is organized in submodules, each one providing a specific set of functionalities.

Note

Only the documented public members of these classes are guaranteed to be stable, and the rest of the members are considered private and can change without notice.

Note

Although instantiating the ConanAPI class is possible in standalone scripts, the recommended way to use the Python API is through custom commands, which provide a more stable and controlled environment for interacting with Conan.

Warning

Subapis must not be initialized by themselves. They are intended to be accessed only through the main ConanAPI attributes.

There are also some model classes that represent the data structures used in the API. Note that as with the API, only the documented public members are guaranteed to be stable, and the rest of the members are considered private and can change without notice.