Skip to content

Conversation

@dvrogozh
Copy link
Collaborator

@dvrogozh dvrogozh commented Jan 6, 2026

This commit adds support of out-of-tree plugins autoloading using python package entry point specification:

Out-of-tree plugins must register entry points as torchcodec.backends:

[project.entry-points.'torchcodec.backends']
device_backend = 'torchcodec_plugin:load_plugin'

Torchcodec will automatically load plugins if discovered. Loading can be explicitly suppressed with TORCHCODEC_DEVICE_BACKEND_AUTOLOAD=1 environment variable.

The same approach is being used to load PyTorch device backends. See:

Here is a PR for XPU plugin which will enable autoloading if torchcodec PR will get merged:

CC: @scotts @NicolasHug

This commit adds support of out-of-tree plugins autoloading using
python package entry point specification:
* https://packaging.python.org/en/latest/specifications/entry-points/#entry-points
* https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/#using-package-metadata

Out-of-tree plugins must register entry points as `torchcodec.backends`:
```
[project.entry-points.'torchcodec.backends']
device_backend = 'torchcodec_plugin:load_plugin'
```

Torchcodec will automatically load plugins if discovered. Loading can be
explicitly suppressed with `TORCHCODEC_DEVICE_BACKEND_AUTOLOAD=1` environment
variable.

The same approach is being used to load PyTorch device backends. See:
* pytorch/pytorch#127074

Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 6, 2026
dvrogozh added a commit to dvrogozh/torchcodec-xpu that referenced this pull request Jan 6, 2026
Requires: meta-pytorch/torchcodec#1151
Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant