Mercurial > hg > numerics
changeset 3:690778ffd302
rename
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Wed, 03 Sep 2014 18:47:23 -0700 |
parents | 2d7d3034db18 |
children | 097296d6132e |
files | kplot/__init__.py kplot/main.py kplot/template.py kplot/web.py numerics/__init__.py numerics/main.py numerics/template.py numerics/web.py setup.py |
diffstat | 9 files changed, 119 insertions(+), 121 deletions(-) [+] |
line wrap: on
line diff
--- a/kplot/__init__.py Thu Aug 14 16:34:04 2014 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -# -from main import * -
--- a/kplot/main.py Thu Aug 14 16:34:04 2014 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -""" -personal experiments in plotting -""" - -# imports -import argparse -import os -import subprocess -import sys - -# module globals -__all__ = ['main', 'Parser'] -here = os.path.dirname(os.path.realpath(__file__)) -string = (str, unicode) - -def ensure_dir(directory): - """ensure a directory exists""" - if os.path.exists(directory): - assert os.path.isdir(directory) - return directory - os.makedirs(directory) - return directory - - -class Parser(argparse.ArgumentParser): - """CLI option parser""" - def __init__(self, **kwargs): - kwargs.setdefault('description', __doc__) - argparse.ArgumentParser.__init__(self, **kwargs) - self.options = None - - def parse_args(self, *args, **kw): - options = argparse.ArgumentParser.parse_args(self, *args, **kw) - self.validate(options) - self.options = options - return options - - def validate(self, options): - """validate options""" - -def main(args=sys.argv[1:]): - """CLI""" - - # parse command line options - parser = Parser() - options = parser.parse_args(args) - -if __name__ == '__main__': - main() -
--- a/kplot/template.py Thu Aug 14 16:34:04 2014 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -#!/usr/bin/env python - -""" -kplot template for makeitso -""" - -import sys -from cli import MakeItSoCLI -from optparse import OptionParser -from template import MakeItSoTemplate - -class kplotTemplate(MakeItSoTemplate): - """ - kplot template - """ - name = 'kplot' - templates = ['template'] - look = True - -class TemplateCLI(MakeItSoCLI): - """ - CLI driver for the kplot template - """ - -def main(args=sys.argv[:]): - cli = TemplateCLI() - cli(*args) - -if __name__ == '__main__': - main() - -
--- a/kplot/web.py Thu Aug 14 16:34:04 2014 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -#!/usr/bin/env python - -""" -web handler for kplot -""" - -from webob import Request, Response, exc - -class Handler(object): - - def __init__(self, **kw): - pass - - def __call__(self, environ, start_response): - request = Request(environ) - response = Response(content_type='text/plain', - body="kplot") - return response(environ, start_response) - -if __name__ == '__main__': - from wsgiref import simple_server - app = Handler() - server = simple_server.make_server(host='0.0.0.0', port=8080, app=app) - server.serve_forever() - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/numerics/__init__.py Wed Sep 03 18:47:23 2014 -0700 @@ -0,0 +1,3 @@ +# +from main import * +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/numerics/main.py Wed Sep 03 18:47:23 2014 -0700 @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +personal experiments in plotting +""" + +# imports +import argparse +import os +import subprocess +import sys + +# module globals +__all__ = ['main', 'Parser'] +here = os.path.dirname(os.path.realpath(__file__)) +string = (str, unicode) + +def ensure_dir(directory): + """ensure a directory exists""" + if os.path.exists(directory): + assert os.path.isdir(directory) + return directory + os.makedirs(directory) + return directory + + +class Parser(argparse.ArgumentParser): + """CLI option parser""" + def __init__(self, **kwargs): + kwargs.setdefault('description', __doc__) + argparse.ArgumentParser.__init__(self, **kwargs) + self.options = None + + def parse_args(self, *args, **kw): + options = argparse.ArgumentParser.parse_args(self, *args, **kw) + self.validate(options) + self.options = options + return options + + def validate(self, options): + """validate options""" + +def main(args=sys.argv[1:]): + """CLI""" + + # parse command line options + parser = Parser() + options = parser.parse_args(args) + +if __name__ == '__main__': + main() +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/numerics/template.py Wed Sep 03 18:47:23 2014 -0700 @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +""" +kplot template for makeitso +""" + +import sys +from cli import MakeItSoCLI +from optparse import OptionParser +from template import MakeItSoTemplate + +class kplotTemplate(MakeItSoTemplate): + """ + kplot template + """ + name = 'kplot' + templates = ['template'] + look = True + +class TemplateCLI(MakeItSoCLI): + """ + CLI driver for the kplot template + """ + +def main(args=sys.argv[:]): + cli = TemplateCLI() + cli(*args) + +if __name__ == '__main__': + main() + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/numerics/web.py Wed Sep 03 18:47:23 2014 -0700 @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +""" +web handler for kplot +""" + +from webob import Request, Response, exc + +class Handler(object): + + def __init__(self, **kw): + pass + + def __call__(self, environ, start_response): + request = Request(environ) + response = Response(content_type='text/plain', + body="kplot") + return response(environ, start_response) + +if __name__ == '__main__': + from wsgiref import simple_server + app = Handler() + server = simple_server.make_server(host='0.0.0.0', port=8080, app=app) + server.serve_forever() + +
--- a/setup.py Thu Aug 14 16:34:04 2014 -0700 +++ b/setup.py Wed Sep 03 18:47:23 2014 -0700 @@ -1,5 +1,5 @@ """ -setup packaging script for kplot +setup packaging script for numerics """ import os @@ -16,7 +16,6 @@ from setuptools import setup kw['entry_points'] = """ [console_scripts] - kplot = kplot.main:main """ kw['install_requires'] = dependencies except ImportError: @@ -30,18 +29,17 @@ description = '' -setup(name='kplot', +setup(name='numerics', version=version, - description="personal experiments in plotting", + description="personal experiments in numerics + plotting", long_description=description, classifiers=[], # Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers author='Jeff Hammel', author_email='k0scist@gmail.com', - url='http://k0s.org/hg/kplot', + url='http://k0s.org/hg/numerics', license='', - packages=['kplot'], + packages=['numerics'], include_package_data=True, zip_safe=False, **kw ) -