Change Python API to be a real pip package.
This commit is contained in:
parent
95a1c98fb8
commit
b23a4f40f8
4
python/.gitignore
vendored
Normal file
4
python/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
__pycache__
|
||||
*.egg-info
|
||||
*.pyc
|
||||
|
26
python/example.py
Normal file
26
python/example.py
Normal 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
2
python/jsh/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
from jsh.streams import *
|
||||
|
@ -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
11
python/setup.py
Normal 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'],
|
||||
)
|
Reference in New Issue
Block a user