conda requirements vs constraints

Viewed 260

In the following is part of the package meta data for clang ~/conda/pkgs/clang-13.0.0-ha770c72_0/info/repodata_record.json, which has two sections "constrains" and "depends"

{
  "arch": "x86_64",
  "build": "ha770c72_0",
  "build_number": 0,
  "channel": "https://conda.anaconda.org/conda-forge/linux-64",
  "constrains": [
    "libclang 13.0.0.*",
    "clang-tools 13.0.0.*",
    "llvm 13.0.0.*",
    "llvm-tools 13.0.0.*",
    "llvmdev 13.0.0.*"
  ],
  "depends": [
    "clang-13 13.0.0 default_hc23dcda_0",
    "gcc_impl_linux-64"
  ],
  ...
}

What are the items listed in "constrains" and "depends"?

I suspect that "depends" means that if we need to install clang version 13.0.0 we need also install clang-13 version 13.0.0 and gcc_impl_linux-64. Is this correct?

Then how about the constrains? Does this clang package also rely on those packages such as llvm?

1 Answers

There are four types of requirements that can be defined in a Conda recipe: build, host, run, and run_constrained. The last two get translated to depends and constrains in the final metadata JSON, respectively.

The run requirements identify packages that must be co-installed; the run_constrained defines version constraints if the listed packages are co-installed.

For details, see the documentation on the Requirements section for a Conda package recipe's meta.yaml file.

Also, see the Conda Forge recipe for the clang-{{major_version}} package.

Related