Plugin Walkthrough

This guide assumes that you are familiar with general pulp concepts as well as the Plugin Planning Guide. It will be helpful to skim the Plugin Concepts pages, and refer back to them as you go through the process.

Bootstrap your plugin

Start your new plugin by using the Plugin Template. Follow the documentation in the README to get a working stub plugin.

Define your plugin Content type

To define a new content type(s), e.g. ExampleContent:

Content model should not be used directly anywhere in plugin code. Only plugin-defined Content classes are expected to be used.

Check pulp_file implementation of the FileContent and its serializer and viewset. For a general reference for serializers and viewsets, check DRF documentation.

Add any fields that correspond to the metadata of your content, which could be the project name, the author name, or any other type of metadata.

Define your plugin Remote

To define a new remote, e.g. ExampleRemote:

Remote model should not be used directly anywhere in plugin code. Only plugin-defined Remote classes are expected to be used.

There are several important aspects relevant to remote implementation which are briefly mentioned in the Object Relationships section:

  • due to deduplication of Content and Artifact data, they may already exist and the remote needs to fetch and use them when they do.

  • ContentArtifact associates Content and Artifact. If Artifact is not downloaded yet, ContentArtifact contains NULL value for artifact. It should be updated whenever corresponding Artifact is downloaded

Note

Some of these steps may need to behave differently for other download policies.

The remote implementation suggestion above allows plugin writer to have an understanding and control at a low level.

Define your Tasks

See Tasks. Almost all plugins must implement a sync task, most implement a publish task as well.

Plugin Completeness Checklist