Opened 12 years ago

Closed 12 years ago

#401 closed enhancement (fixed)

add plugin infrastructure

Reported by: Will Kahn-Greene Owned by: Will Kahn-Greene
Priority: major Milestone: 0.3.1
Component: programming Keywords:
Cc: Christopher Allan Webber Parent Tickets:

Description

The gist of it is:

  • design and codify how plugins will get installed, removed and configured
  • implement required infrastructure code
  • design and codify how plugins will hook into mediagoblin core
  • write documentation for plugin authors

The wiki page tracking this is at: http://wiki.mediagoblin.org/PluginSystemDesignDocument

This ticket does not cover creating actual hooks in mediagoblin. Either each hook should get tracked separately or we should create a new bug for a bunch of things or something like that.

Change History (13)

comment:1 by Will Kahn-Greene, 12 years ago

Initial pass in https://gitorious.org/~willkg/mediagoblin/willkg-mediagoblin/commits/401-plugins

There's still a bunch of stuff to do, but that's been interesting.

comment:2 by Will Kahn-Greene, 12 years ago

There are a handful of bugs. I'm writing tests now and fixing the bugs as I discover them.

Also, I talked with Chris about how to do multi-line lists in the .ini. We're going to change the way plugins are configured so that each plugin has its own section under the [plugins] section. e.g.

[plugins]

[[mediagoblin.plugins.sampleplugin]]
key = val
...

[[some.other.plugin]]
key = val
...

Then the plugins will be imported and loaded in the order listed in the .ini file.

Also, need to implement a .ini type that is essentially a multi-line list that's done with ''' (which is kind of icky, but seems to be the only possible solution now). We'll use this for specifying handlers, transformers, processors, ... in the .ini file.

After that:

  • needs site admin focused documentation (how to install, how to remove, how to configure, ...)
  • needs plugin writers documentation (how to create a plugin, structure, configuration, ...)

comment:3 by Will Kahn-Greene, 12 years ago

Status: newaccepted

I did a bunch during the sprint at PyCon. Then I did some more work later. I haven't had a chance to touch it since.

I might have time to work on it next week while traveling. If I don't then this isn't going to make 0.2.2. Sorry. :(

comment:4 by Elrond, 12 years ago

Milestone: 0.3.0

I guess, we'll do that post-0.3.0.

comment:5 by Will Kahn-Greene, 12 years ago

Sorry it took so long. I redid it, then bumped into issues, then redid it again. The latest round works and meets the requirements I think we have.

It's in the 401-plugins branch in my fork.

https://gitorious.org/~willkg/mediagoblin/willkg-mediagoblin/commits/401-plugins

This has completed code, tests, and docs.

The one thing it doesn't really have is documentation on writing plugins or anything along those lines. I think we need to expand the documentation that comes in docs/ to include everything: some rough contributor documentation, site admin documentation, plugin writer documentation, ... The reason for that is that a lot of this stuff is specific to a version of MediaGoblin and it's better to put it all in one place.

I want to spin writing docs for writing plugins off to a new bug.

Once this code lands, the next step is to identify some core plugins we want to write, figure out what API points we need to implement to write those plugins, implement the API points, write the plugins, rinse, repeat.

Anyhow, this code is ready for review.

comment:6 by Will Kahn-Greene, 12 years ago

Milestone: 0.3.1

I think this should land in 0.3.1, so I'm sticking it in that milestone.

comment:7 by Christopher Allan Webber, 12 years ago

Just as a small update, this is moving along. Will already has that branch landed in master. However there aren't really any plugins written yet. I think Will is planning to write a flatpages plugin first.

comment:8 by Christopher Allan Webber, 12 years ago

Component: component1programming

comment:9 by Will Kahn-Greene, 12 years ago

I pushed a few changes. They're all in my flatpages branch: https://gitorious.org/~willkg/mediagoblin/willkg-mediagoblin/commits/flatpages

  1. added a flatpages file plugin
  2. added a couple of methods to the pluginapi allowing plugins to register routes and templates
  3. tweaked the documentation a bit adding a plugin docs section where we can document core plugins

I did some rough testing. There are probably a bunch of error conditions it doesn't handle well. But it seems to work ok.

One thing that still isn't done that this issue needs is that we need to add documentation for the plugin API to the plugin writer's guide. That should probably be just an autodoc of the pluginapi module.

comment:10 by Will Kahn-Greene, 12 years ago

I updated the flatpages commits based on Chris' comments.

Just waiting on a thumbs-up to land.

comment:11 by Will Kahn-Greene, 12 years ago

I landed flatpages.

There are some minor issues I have with the plugin infrastructure, though. The gist of it is that the side-effects from importing plugins makes it difficult to build controlled environments for testing. I'm going to work on addressing those this week.

comment:12 by Will Kahn-Greene, 12 years ago

Cc: Christopher Allan Webber added

https://gitorious.org/~willkg/mediagoblin/willkg-mediagoblin/commits/plugins-infrastructure-rewrite

Chris: Can you take a look at the infrastructure rewrite and give comments?

comment:13 by Will Kahn-Greene, 12 years ago

Resolution: fixed
Status: acceptedclosed

I reworked plugins, the code has landed, and I think that's what we're going to roll with going forward.

Marking this as closed.

Note: See TracTickets for help on using tickets.