This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

jumon is a small framework for sub commands.

The jumon is a small framework for implementing the sub command. You can be implemented sub commands, as the hierarchial structure of the sub modules in the packages. It finds importable sub module from the arguments passed, Runs main function in the importable sub module with arguments.

You can be displayed the hierarchial structure of the sub commands with tree command etc, because it be implementing sub commands as the hierarchial structure of the sub module. It will be easy to see where sub command has been implemented.

Please consider to use jumon, if you are trying to implement the sub commands.

Installing

Use setup.py in the source code root directory:

$ python setup.py install

by pip (from PyPI)

$ pip install jumon

How to use

This is a description of how to use the jumon. Let create a package called “testcmd”, and sub package called “testcmd.command”.

$ mkdir testcmd
$ touch testcmd/__init__.py
$ mkdir testcmd/command

Let implementing sub commands in “testcmd.command” subordinate.

First, create top level command.:

$ touch testcmd/command/__init__.py

testcmd/command/__init__.py:

import jumon

def main():
    jumon.entry(__name__)

Under this package is the search range of sub commands.

Next, create sub command.:

$ touch testcmd/command/aaa.py

testcmd/command/aaa.py:

def main(argv):
    print 'OK'
    return 0

This commamd is printed string “OK”, and end with exit code 0.

You can be implemented sub command of sub command.:

$ mkdir testcmd/command/bbb
$ touch testcmd/command/bbb/__init__.py
$ touch testcmd/command/bbb/ccc.py

testcmd/command/bbb/__init__.py:

def main(argv):
    print 'bbb'
    return 1

testcmd/command/bbb/ccc.py:

def main(argv):
    print 'ccc'
    return 2

I implemented sub commands, called “bbb” and “bbb ccc”. This commamd “bbb” is printed string “bbb”, and end with exit code 1. This commamd “bbb ccc” is printed string “ccc”, and end with exit code 2.

Next, install “testcmd”.:

$ cp testcmd $SITE_PACKAGES -R

Last, create command.:

$ touch test.py

test.py:

#! /usr/bin/env python
import testcmd.command

def main():
    testcmd.command.main()

if __name__ == '__main__':
    main()

Add permission:

$ chmod 755 test.py

Run, displayed usage.:

$ ./test.py
Usage: test.py [options]

test.py: error: Command Not Found:

Run sub command “aaa”.:

$ ./test.py aaa
OK
$ echo $?
0

Run sub command “bbb”.:

$ ./test.py bbb
bbb
$ echo $?
1

Run sub command “bbb ccc”.:

$ ./test.py bbb ccc
ccc
$ echo $?
2

Do you want to created command with setup.py?

setup.py:

#-*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
    name='testcmd',
    version='1',
    license='BSD',
    author='TakesxiSximada',
    author_email='takesxi.sximada@gmail.com',
    packages=find_packages(),
    entry_points = """\
    [console_scripts]
    testcmd = testcmd.command:main
    """
)

This is important:

entry_points = """\
[console_scripts]
testcmd = testcmd.command:main
"""

Do you want to transparenting the undefined options?

You can use jumon.TransparentOptionParser() class.

>>> import jumon
>>> parser = jumon.TransparentOptionParser()
>>> opts, args = parser.parse_args(['-f', '-n', '1'])
>>> args
['-f', '-n', '1']

Requirements

  • Python 2.6 or laterr (not supprt 3.x)

License

Apache License 2.0

Release History

Release History

1.1.11

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.10

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.9

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.8

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
jumon-1.1.11.tar.gz (6.2 kB) Copy SHA256 Checksum SHA256 Source Nov 7, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting