Virtual Packages

Conda allows for the registering of virtual packages in the index data via the plugin system. This mechanism lets users write plugins that provide version identification for properties only known at runtime (e.g., OS information).

class CondaVirtualPackage(name: str, version: str | None, build: str | None)

A conda virtual package.

Parameters
  • name -- Virtual package name (e.g., my_custom_os).

  • version -- Virtual package version (e.g., 1.2.3).

  • version -- Virtual package build string (e.g., x86_64).

property build

Alias for field number 2

property name

Alias for field number 0

property version

Alias for field number 1

conda_virtual_packages(self) Iterable[CondaVirtualPackage]

Register virtual packages in Conda.

Returns

An iterable of virtual package entries.

Example:

from conda import plugins


@plugins.hookimpl
def conda_virtual_packages():
    yield plugins.CondaVirtualPackage(
        name="my_custom_os",
        version="1.2.3",
        build="x86_64",
    )