Deployers are a mechanism to facilitate copying files from one folder, usually the Conan cache, to user folders.
While Conan provides two built-in ones (
direct_deploy), users can easily manage their own
conan config install.
Deployers run before generators, and they can change the target folders.
For example, if the
--deployer=full_deploy deployer runs before
the files generated by
CMakeDeps will point to the local copy in the user folder done by the
and not to the Conan cache. Multiple deployers can be specified by supplying more than one
and they will be ran in order of appearance.
Deployers can be multi-configuration. Running
conan install . --deployer=full_deploy repeatedly for different profiles
can achieve a fully self-contained project, including all the artifacts, binaries, and build files.
This project will be completely independent of Conan and no longer require it at all to build.
--deployer-folder argument to change the base folder output path for the deployer as desired.
Deploys each package folder of every dependency to your recipe’s
output_folder in a subfolder tree based on:
The build context
The dependency name and version
The build type
The build arch
Then every dependency will end up in a folder such as:
See a full example of the usage of
full_deploy deployer in Creating a Conan-agnostic deploy of dependencies for developer use.
full_deploy, but only processes your recipe’s direct dependencies.
This deployer will output your dependencies in a tree folder such as:
The built-in deployers are in preview. See the Conan stability section for more information.
full_deploy and the
direct_deploy understand when the conf
tools.deployer:symlinks is set to
to disable deployers copying symlinks. This can be convenient in systems that do not support symlinks and could fail
if deploying packages that contain symlinks.
Custom deployers can be managed via
conan config install. When looking for a specific deployer,
Conan will look in these locations for the deployer in the following order:
Relative to cwd
As built-in deployers
Conan will look for a
deploy() method to call for each installed file.
The function signature of your custom deployers should be as follows:
def deploy(graph, output_folder: str, **kwargs):
(Note that the arguments are passed as named parameters, so both the
output_folder names are mandatory)
**kwargs is mandatory even if not used, as new arguments can be added in future Conan versions, and those would break
**kwargs is not defined.
You can access your conanfile object with
See ConanFile.dependencies for information on how to iterate over its dependencies.
Your custom deployer can now be invoked as if it were a built-in deployer using the filename in which it’s found,
in this case
conan install . --deployer=my_custom_deployer. Note that supplying the .py extension is optional.
See the custom deployers section for examples on how to implement your own deployers.