Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CEP-17 add language-agnostic plugins #78

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions cep-17.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<table>
<tr><td> Title </td><td> Language-Independent Plugins</td>
<tr><td> Status </td><td> Draft </td></tr>
<tr><td> Author(s) </td><td> Matthew R. Becker &lt;[email protected]&gt;</td></tr>
<tr><td> Created </td><td> May 31, 2024</td></tr>
<tr><td> Updated </td><td> May 31, 2024</td></tr>
<tr><td> Discussion </td><td> NA </td></tr>
<tr><td> Implementation </td><td> NA </td></tr>
</table>

## Abstract

This CEP proposes a standard for language-independent plugins for `conda` and `conda`-like tools (e.g., `pixi`, `mamba`, `rattler`).
The goal is to generalize the existing work on plugins in `conda` via `pluggy` to something that can be implemented
by more parties in the ecosystem. The standard below augments the existing `pluggy` plugins by defining an additional
source of plugin information that `conda` can use to generate plugins for `pluggy`. Other `conda`-compliant package managers
can use the same information to take appropriate actions (e.g., add a virtual package to the repodata) in order to achieve
the same effects. The primary target of this CEP is virtual packages. Other possible cross-language plugins can be added in future
CEPS as the need arises.

## Specification

To generate plugins, a `conda`-compliant tool will

1. Look for the `conda-plugins` executable on the current PATH.
2. If `conda-plugins` is found, execute it.
3. If `conda-plugins` executes successfully, parse `stdout` as JSON and take the appropriate action as defined below.
4. If `conda-plugins` executes non-successfully, display an error to `stderr` containing any `stderr` from `conda-plugins` and continue.

The JSON output from `conda-plugins` must be formatted and interpreted as follows:

```JSON
{
"virtual_pkgs": [
{
"name": "pkg1-name",
"version": "pkg1-version",
"build": "pkg1-build",
},
{
"name": "pkg2-name",
"version": "pkg2-version",
"build": "pkg2-build",
}
]
}
```

### `virtual_pkgs`

For every item in the `virtual_pkgs` list, a virtual package is defined with name `__<name>`, version `<version>`, and build string `<build>`.
Any errors must be printed to `stderr` and the tool must continue. If the list is empty, no virtual packages will be defined. The `virtual_pkgs` key
must be present at the top-level.

## Backwards Compatibility

The specification in this CEP can easily be made backwards compatible with the existing `conda` plugin architecture.
A PR to `conda` should be made to run the `conda-plugins` executable, if it exists, and take the appropriate actions.
In order to ensure conisstent behavior across the ecosystem, any plugins derived from `conda-plugins` should override
Comment on lines +58 to +59
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PATH based approach for extensibility is a no-go in the future, hence the adoption of a in-depth plugin system, as it doesn't provide for example a scalable error handling method (it's just glue all the way down).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not following. Anything that runs on unix is on the PATH or located on disk somewhere...

any other source of plugins, including plugins implemented via `pluggy`.

## Copyright

All CEPs are explicitly [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/).
Loading