Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds

Creating Skeleton Apps with Coily in Spring Python

Save for later
  • 3 min read
  • 16 Dec 2010

article-image

 

Spring Python 1.1




creating-skeleton-apps-coily-spring-python-img-0

Create powerful and versatile Spring Python applications using pragmatic libraries and useful abstractions

 

  • Maximize the use of Spring features in Python and develop impressive Spring Python applications
  • Explore the versatility of Spring Python by integrating it with frameworks, libraries, and tools
  • Discover the non-intrusive Spring way of wiring together Python components
  • Packed with hands-on-examples, case studies, and clear explanations for better understanding 




        Read more about this book      

(For more resources on this subject, see here.)

Plugin approach of Coily

coily is a Python script designed from the beginning to provide a plugin based platform for building Spring Python apps. Another important feature is version control of the plugins. Developers should not have to worry about installing an out-of-date plugin that was designed for an older version of Spring Python. coily allows different users on a system to have different sets of plugins installed. It also requires no administrative privileges to install a plugin.

Key functions of coily

coily is included in the standard installation of Spring Python. To see the available commands, just ask for help.

Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at ₹800/month. Cancel anytime

creating-skeleton-apps-coily-spring-python-img-1

The following table elaborates these commands.

creating-skeleton-apps-coily-spring-python-img-2

Required parts of a plugin

A coily plugin closely resembles a Python package with some slight tweaks. This doesn't mean that a plugin is meant to be installed as a Python package. It is only a description of the folder structure.

Let's look at the layout of the gen-cherrypy-app plugin as an example.

creating-skeleton-apps-coily-spring-python-img-3

Some parts of this layout are required, and other parts are not. The top folder is the name of the plugin.

  • A plugin requires a __init__.py file inside the top directory.
  • __init__.py must include a __description__ variable. This description is shown when we run the coily --help command.
  • __init__.py must include a command function, which is either a create or apply function. create is used when the plugin needs one argument from the user. apply is used when no argument is needed from the user.

Let's look at how gen-cherrypy-app meets each of these requirements.

  1. We can already see from the diagram that the top level folder has the same name as our plugin.
  2. Inside __init__.py, we can see the following help message defined.

    __description__ = "plugin to create skeleton CherryPy applications"

  3. gen-cherrypy-app is used to create a skeleton application. It needs the user to supply the name of the application it will create. Again, looking inside __init__.py, the following method signature can be found.

    def create(plugin_path, name)

  4. plugin_path is an argument provided to gen-cherrypy-app by coily, which points at the base directory of gen-cherrypy-app. This argument is also provided for plug-ins that use the apply command function.
  5. name is the name of the application provided by the user.