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#
Return type to use when defining a conda virtual package plugin hook.
For details on how this is used, see
conda_virtual_packages()
.Note
The
version
andbuild
parameters can be provided in two ways:Direct values: a string or
None
(whereNone
translates to0
)Deferred callables: functions that return either a string,
None
(translates to0
), orNULL
(indicates the virtual package should not be exported)
- Parameters:
name -- Virtual package name (e.g.,
my_custom_os
).version -- Virtual package version (e.g.,
1.2.3
).build -- Virtual package build string (e.g.,
x86_64
).override_entity -- Can be set to either to "version" or "build", the corresponding value will be overridden if the environment variable
CONDA_OVERRIDE_<name>
is set.empty_override -- Value to use for version or build if the override environment variable is set to an empty string. By default, this is
NULL
.version_validation -- Optional version validation function to ensure that the override version follows a certain pattern.
- build#
- empty_override#
- name#
- override_entity#
- to_virtual_package()#
- version#
- version_validation#
- conda_virtual_packages()#
Register virtual packages in Conda.
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", )
- Returns:
An iterable of virtual package entries.