Change Python API to be a real pip package.

This commit is contained in:
Ian Adam Naval 2015-04-29 17:24:11 -04:00
parent 95a1c98fb8
commit b23a4f40f8
5 changed files with 43 additions and 23 deletions

4
python/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
__pycache__
*.egg-info
*.pyc

26
python/example.py Normal file
View File

@ -0,0 +1,26 @@
from jsh import Stream
import sys
def main():
s = Stream(sys.stdout, 4)
s.start()
for i in range(7):
proc = {"pid": i + 1, "name": "init"}
s.output("things", proc)
q = s.new_stream('q')
q.output("test", 'potato')
for i in range(10):
proc = {"pid": i + 1, "name": "init"}
s.output("processes", proc)
q.output("test", 'salad')
q.output("test", 'rocks')
s.flush()
s.stop()
if __name__ == '__main__':
main()

2
python/jsh/__init__.py Normal file
View File

@ -0,0 +1,2 @@
from jsh.streams import *

View File

@ -169,26 +169,3 @@ class Stream(JSONSerializable):
def __repr__(self):
return str(self)
def main():
s = Stream(sys.stdout, 4)
s.start()
for i in range(7):
proc = {"pid": i + 1, "name": "init"}
s.output("things", proc)
q = s.new_stream('q')
q.output("test", 'potato')
for i in range(10):
proc = {"pid": i + 1, "name": "init"}
s.output("processes", proc)
q.output("test", 'salad')
q.output("test", 'rocks')
s.flush()
s.stop()
if __name__ == '__main__':
main()

11
python/setup.py Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env python
from distutils.core import setup
setup(name='jsh',
version='1.0',
description='API for implementing JSH streams in Python.',
author='Augmented Unix Userland MQP',
author_email='jsh@wpi.edu',
packages=['jsh'],
)