Skip to content

Latest commit

 

History

History
93 lines (64 loc) · 2.8 KB

conda-plugins.rst

File metadata and controls

93 lines (64 loc) · 2.8 KB

Conda plugins

In order to enable customization and extra features that are compatible with and discoverable by conda (but do not necessarily ship as a default part of the conda codebase), an official conda plugin mechanism has been implemented as of version 22.11.0.

Plugins in conda integrate the "hook + entry point" structure by utilizing the Pluggy Python framework. This implementation can be broken down via the following two steps:

  • Define the hook(s) to be registered
  • Register the plugin under the conda entrypoint namespace

Below is an example of a very basic plugin "hook":

import conda.plugins


@conda.plugins.hookimpl
def conda_subcommands():
    ...

Below is an example that configures setuptools using a pyproject.toml file (note that the setup.py file is optional if a pyproject.toml file is defined, and thus will not be discussed here):

[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "my-conda-plugin"
version = "1.0.0"
description = "My conda plugin"
requires-python = ">=3.7"
dependencies = ["conda"]

[project.entry-points."conda"]
my-conda-plugin = "my_plugin"

The new conda plugin API ecosystem brings about many possibilities, including but not limited to:

A conda plugin ecosystem enables contributors across the conda community to develop and share new features, thus bringing about more functionality and focus on the user experience. Though the list below is by no means exhaustive, some of the benefits of conda plugins include:

  • Support for a better distribution of maintenance in the conda community
  • Enabling third party contributors to use official APIs instead of having to divert to workarounds and wrappers
  • The ability to extend conda internals via official APIs
  • Lowering the barrier for contributions from other stakeholders in the conda ecosystem
  • ... and much more!