Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 956 Categories, Downloaded 50.068.264 Times

extensions for linux 0.4

Company: Tarek Ziade
Date Added: November 27, 2013  |  Visits: 338

extensions for linux

Report Broken Link
Printer Friendly Version


Product Homepage
Download (32 downloads)



extensions is a simple plugin system inspired from setuptools entry points. It allows an application to define and/or use plugins.<br /><br />How to define a plugin<br /><br />A plugin can be any callable object . It has to be registered through the extensions registry.<br /><br />For example, let's take a simple function that calculates the average of some numbers, and let's save it into a file called extensions.py in a package called myapp:<br /><br />def average(*args):<br /> return sum(args) / len(args)<br /><br />This function can be registered in the plugin system using the register function. Plugins have a name and belong to a group. For our example, the group can be myapp.operator and the name average:<br /><br />from extensions import register<br /><br /># usage : register(group, name, location)<br />register('myapp.operator', 'average', 'myapp.extensions:average')<br /><br />The third parameter gives the location of the callable, with the form module_name:attrs, where module_name is the full name of the module, and attrs the attributes in the module.<br /><br />Notice that the group name includes the name of the package, which is a good practice to avoid collisions since the group names are global to all applications that use extensions.<br /><br />Using a configuration file<br /><br />There's another way to register your plugins by using a configuration file. You can write a ini-like file, using groups for sections title, and name = location for the values.<br /><br />For example, if you create a operators.cfg file with this content:<br /><br />[myapp.operator]<br /><br />average = myapp.extensions:average<br /><br />You will be able to load it using register_file:<br /><br />from extensions import register_file<br /><br />register_file('operators.cfg')<br /><br />This function will scan your file and register the plugins for you.<br /><br />How to use a plugin<br /><br />Iterate over registered plugins<br /><br />extensions provides a get function that allows you to iterate over all registered plugins for a given group:<br /><br />from extensions import get<br /><br />for plugin in get(group='myapp.operator'):<br /> print plugin.name<br /><br />You can also give the name to the function:<br /><br />for plugin in get(group='myapp.operator', name='average'):<br /> print plugin.name<br /><br />Or even iterate over all plugins:<br /><br />from itertools import islice<br /><br />for plugin in islice(get(), 5):<br /> print plugin.name<br /><br />The Plugin object<br /><br />The objects returned by the get function are Plugin class instances.<br /><br />The Plugin class provides one method called load, that returns the registered object, so you can use it<br /><br /># let's get the plugin `average` of the group `myapp.operator`<br />plugin = get(group='myapp.operator', name='average').next()<br /><br /># let's load it<br />func = plugin.load()<br /><br /># let's use it now<br />average = func(1, 2, 3)<br /><br />Plugin also provides a name and a group attribute, that corresponds to the name of the registered plugin, and to its group.<br /><br />Distribute your plugins<br /><br />If you want to distribute your plugins, you just have to import the module that registers the plugins into your setup.py file:<br /><br />from distutils.core import setup<br />from myapp import plugins # registers the plugins<br /><br />setup(name='myapp', version='1.0'<br /> packages=['myapp'])<br /><br />This will register the plugins when the package is installed by creating a special file called PLUGINS into the .egg-info directory created when your package is installed.<br /><br />Compatibility with setuptools entry points<br /><br />extensions is fully compatible with setuptools entry points. So you can iterate and use entry points defined in third-party applications that are installed in your Python.<br /><br />If you want to iterate through setuptools entry points, use the consume_entry_points option when you call the get function:<br /><br />plugins = get(consume_entry_points=True)<br /><br />This will iterate over extensions plugins and setuptools entry points.<br /><br />#md5=e498fe6da146aefb677c3e8a210fbb29

Requirements: No special requirements
Platforms: *nix, Linux
Keyword: Called Entry Extensions Extensions Linux Function Getgroup Myappoperator Group Import Iterate Let039s Linux Package Plugin Plugins Points Print Register Registered Setuptools
Users rating: 0/10

License: Freeware Size: 20.48 KB
USER REVIEWS
More Reviews or Write Review


EXTENSIONS FOR LINUX RELATED
Development Editors  -  NH's Function Point Analyzer 1.0
With NH's Function Point Analyzer it is easy to get a quick and clear documentation of function point countings according to IFPUG (International Function Point Users Group) standard 4.2. While counting, you will record functions and databases in...
778.24 KB  
Modules  -  Single Random Post 1.02
The post can be called through the single_random_post() template function. InstallationUnpack and upload it to the /wp-content/plugins/ directory.Activate the plugin through the 'Plugins' menu in WordPress. Requirements: - WordPress 2.0 or higher
 
Web Browser Tools  -  Proxilla for linux 0.8.0
Proxilla is a Firefox extension that makes it easier for you to connect to your favorite Glype proxies. It comes pre-set with 3 proxies for immediate use and testing. Use the toolbar, browse form, or right click a link for easy Glype proxy...
112.64 KB  
Development Tools  -  New Block Library Simulink called The Phase Filter 1.0
It is a new block simulink signal library called the Phase Filter.The transfert function is F(p)=(1+T1p)/(1+T2p).Students can change parameters T1 and T2 time constants of filter.The phase filter in automatic control is for Corrector block and...
10 KB  
Utilities  -  Auditor Security Linux 200605
The Auditor security collection is a Live-System based on KNOPPIX. With no installation whatsoever, the analysis platform is started directly from the CD-Rom and is fully accessible within minutes. Independent of the hardware in use, the Auditor...
645 MB  
Utilities  -  Lunar Linux 1.6.1 / 1.6.2 Beta 1
Lunar is a source based Linux distribution developed by a talented team of programmers from all over the world, working together to extend the Linux technology into better-tailored and more optimized software for the end user. Lunar uses and...
257 MB  
Communication  -  String Letter Counter Function 1.0
Statement: strLetterCounter('string')....where, 'string' is an input string containing alphabet or numbers.Ex: string='aaaaaaaabbbbbbccd'Statement: strLetterCounter(string)Output: '8a,6b,2c,1d'Note: This function is different from the Matlab...
10 KB  
Network & Internet  -  XAMPP for Linux 1.8.0 Beta 1
By the way: In the past this software was called LAMPP but to avoid misconceptions we renamed it to ?*A*XAMPP for Linux?*A*. So if you are seeking for LAMPP you're on the right track. ;) If you encounter any problems with XAMPP please...
76.21 MB  
Utilities  -  GNOME Wireless Applet 0.8
This is the home page for the GNOME Wireless Applet project. This project aims to create a GNOME-based panel applet and management tool to manage wireless network cards that support Linux wireless extensions. You can find a list of such...
184.32 KB  
Development Tools  -  NetCDF/GRIB reader 1.0
MATLAB-CDI is a collection of MATLAB functions that import/read GRIB and netCDF files through high-level function calls that follows an unified syntax. The package supports a subset of the full GRIB and netCDF format specification typically...
5.7 MB  
NEW DOWNLOADS IN LINUX SOFTWARE, PROGRAMMING
Linux Software  -  EasyEDA PCB Designer for Linux 2.0.0
EasyEDA, a great web based EDA(Electronics Design Automation) tool, online PCB tool, online PCB software for electronics engineers, educators, students, makers and enthusiasts. Theres no need to install any software. Just open EasyEDA in any...
34.4 MB  
Linux Software  -  wpCache® WordPress HTTP Cache 1.9
wpCache® is a high-performance, distributed object, caching system application, generic in nature, but intended for use in speeding up dynamic web applications, by decreasing database load time. wpCache® decreases dramatically the page...
3.51 MB  
Linux Software  -  Polling Autodialer Software 3.4
ICTBroadcast Auto Dialer software has a survey campaign for telephone surveys and polls. This auto dialer software automatically dials a list of numbers and asks them a set of questions that they can respond to, by using their telephone keypad....
488 B  
Linux Software  -  Total Video Converter Mac Free 3.5.5
Total Video Converter Mac Free developed by EffectMatrix Ltd is the official legal version of Total Video Converter which was a globally recognized brand since 2006. Total Video Converter Mac Free is a free but powerful all-in-one video...
17.7 MB  
Linux Software  -  Skeith mod_log_sql Analyzer 2.10beta2
Skeith is a php based front end for analyzing logs for Apache using mod_log_sql.
47.5 KB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB