Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    skeleton 0.6

    Download button

    No screenshots available
    Downloads: 258  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Damien Lebrun | More programs
    BSD License / FREE
    May 12th, 2010, 11:13 GMT [view history]
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    skeleton description

    Basic Template system for project skeleton

    skeleton is a project similar to the template part of PasteScript but without any dependencies; it is also compatible with Python 3.

    Installation:

    The easiest way to get skeleton is if you have setuptools / distribute or pip installed:

    easy_install skeleton

    or:

    pip install skeleton

    The current development version can be found at http://github.com/dinoboff/skeleton/tarball/master.

    Usage example:

    Let's create a basic module template; one with a setup.py, a README and the module files.

    First, create the skeleton script layout:

    mkmodule.py
    basic-module/README
    basic-module/setup.py_tmpl
    basic-module/{ModuleName}.py


    mkmodule.py

    mkmodule.py is the script that create new module:

    #!/usr/bin/env python

    from skeleton import Skeleton, Var


    class BasicModule(Skeleton):
     src = 'basic-module'
     vars = [
     Var('ModuleName'),
     Var('Author'),
     Var('AuthorEmail'),
     ]


    def main():
     BasicModule().run()

    if __name__ == '__main__':
     main()


    The src attribute sets the relative path to the skeleton directory where the script will find the files and directories to create.

    The vars attribute list the variables the templates will require. The variables with a default can be left blank by the user.

    Skeleton.run() is a convenient method to set an optparser and the logging basic config, and to apply the skeleton:

    Usage: mkmodule.py [options] dst_dir

    Options:
     -h, --help show this help message and exit
     --ModuleName=MODULENAME
     ModuleName
     --Author=AUTHOR Author
     --AuthorEmail=AUTHOREMAIL
     AuthorEmail


    If you needed to run a Skeleton yourself, you would use the constructor, the update or __setitem__ methods to set the variables (Skeleton is a dict subclass), and the write(dstdir) method to apply the skeleton.

    basic-module/README`

    README a is static file that will simply be copied:

    TODO: write the description of this module.

    basic-module/setup.py_tmpl

    setup.py_tmpl is a template (it ends with the _tmpl suffix) that will be used to create a setup.py file:

    #!/usr/bin/env python

    from distutils.core import setup


    PROJECT = {ModuleName!r}
    VERSION = '0.1'
    AUTHOR = {Author!r}
    AUTHOR_EMAIL = {AuthorEmail!r}
    DESC = "A short description..."

    setup(
     name=PROJECT,
     version=VERSION,
     description=DESC,
     long_description=open('README.rst').read(),
     author=AUTHOR,
     author_email=AUTHOR_EMAIL,
     py_module={ModuleName!r}
    )


    By default, Skeleton uses python 2.6+ string formatting.

    basic-module/{ModuleName}.py

    {ModuleName}.py is the module file for which the name will be set dynamically at run time.

    Note:

    All file names are formatted using Skeleton.template_formatter method. Watch out for special characters (with the default formatter, use {{ to render { and }} for } - unless you want to render a variable).


    Product's homepage

    Requirements:

    · Python

    What's New in This Release: [ read full changelog ]

    · Fix syntax error in the package virtualenvwrapper.project extension.

      


    TAGS:

    template system | skeleton template | skeleton | template | Python

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM