Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7006771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:31:14+00:00 2026-05-27T21:31:14+00:00

I use yapsy in this struct: script.py plugins |-equipments | |-eq1.py | |-eq1.yapsy-plugin |-tasks

  • 0

I use yapsy in this struct:

script.py
plugins
 |-equipments
 | |-eq1.py
 | |-eq1.yapsy-plugin
 |-tasks
   |-tsk1.py
   |-tsk1.yapsy-plugin 

script.py

from yapsy.PluginManager import PluginManager

# Load the plugins from the plugin directory.
manager = PluginManager()
manager.setPluginPlaces(["plugins"])
manager.collectPlugins()

# Loop round the plugins and initialization.
for plugin in manager.getAllPlugins():
    print plugin.plugin_object.init_plugin()
    print plugin.path
    print plugin.category

It works fine. But how to make plugins in various directory have different categories?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:31:15+00:00Added an answer on May 27, 2026 at 9:31 pm

    Categories in yapsy are not detected by directories but via the class inherited by each plugin instance.

    For instance, with your application, you could have your “equipment” plugins inherit an IEquipementPlugin class, and your “task” plugins inherit an ITaskPlugin .

    Then, when configuring your plugin manager, it’s just a matter of giving a mapping between your categories’ names and their respective base classes:

    # Define the various categories corresponding to the different
    # kinds of plugins you have defined
    manager.setCategoriesFilter({
       "Equipement" : IEquipementPlugin,
       "Task" : ITaskPlugin,
       })
    

    Please be aware of a caveat that makes it hasardous to have one of your categories be defined by a child class of a class defining another category (the plugin manager will be confused), see related question on stack overflow and the corresponding bug report.

    See also on yapsy’s documentation: http://yapsy.sourceforge.net/#more-sophisticated-plugin-classes.

    I know Yapsy’s documentation is still poor on the example side of things[1], but there are working examples of plugin categories in the unit-tests.

    There are also examples of categories in some real-life project out there. For instance in mathbench: http://mathbench.sourceforge.net/ (yapsy was originally designed as a subcomponent of it) and other projects listed on yapsy’s documentation, see http://yapsy.sourceforge.net/index.html#brief-history

    [1]: Sorry for that, I don’t have much time for it but I try to incrementally improve yapsy and its doc by taking into account user feedback like yours.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Use Eclipse Classic with ADT plugin. Tried to make project from existing example of
'''use Jython''' import shutil print dir(shutil) There is no, shutil.move, how does one move
Use case: user clicks the link on a webpage - boom! load of files
use this website a lot but first time posting. My program creates a number
We use a data acquisition card to take readings from a device that increases
use strict; use Time::HiRes qw[gettimeofday tv_interval]; my $start_index = int(rand(50))+100;#this value is arbitrary for
use qcvalues_test go select [finalConc] ,[rowid] from qvalues where rowid in (select rowid from
Use trap to capture signals like this: i=-1;while((++i<33)); do trap echo $i >> log.txt
use DBI(); What is causing this insert to fail to err 1, the SELECT
Use case is this: I want to unit test (in browser, QUnit or something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.