From 5af3642ad5558bedd3518d1826395f06f76fa542 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Tue, 31 Jan 2023 04:13:00 +0000 Subject: [PATCH] Use poetry --- docker/Dockerfile | 16 +-- pctest/add_publisher.py | 39 ------ pctest/create_products.py | 68 ---------- pctest/get_product_list.py | 32 ----- pctest/get_products.py | 62 --------- pctest/init_prices.py | 42 ------ pctest/test_publish.py | 153 --------------------- pctest/test_pyth.py | 224 ------------------------------ pyth/{__init__.py => README.md} | 0 pyth/poetry.lock | 226 +++++++++++++++++++++++++++++++ pyth/pyproject.toml | 20 +++ pyth/pyth/__init__.py | 0 pyth/tests/test_get_product.py | 2 +- pyth/tests/test_qset.py | 2 +- pyth/tests/test_twap.py | 2 +- pyth/tests/test_update_price.py | 2 +- scripts/build-bpf.sh | 6 +- scripts/run-aggregation-tests.sh | 6 +- 18 files changed, 258 insertions(+), 644 deletions(-) delete mode 100755 pctest/add_publisher.py delete mode 100755 pctest/create_products.py delete mode 100755 pctest/get_product_list.py delete mode 100755 pctest/get_products.py delete mode 100755 pctest/init_prices.py delete mode 100755 pctest/test_publish.py delete mode 100755 pctest/test_pyth.py rename pyth/{__init__.py => README.md} (100%) create mode 100644 pyth/poetry.lock create mode 100644 pyth/pyproject.toml create mode 100644 pyth/pyth/__init__.py diff --git a/docker/Dockerfile b/docker/Dockerfile index 67c19b170..5b89a4b8d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,9 +16,6 @@ RUN apt-get install -qq \ git \ libzstd1 \ libzstd-dev \ - python3-pytest \ - python3-pytest-asyncio \ - python3-websockets \ sudo \ zlib1g \ zlib1g-dev \ @@ -46,15 +43,14 @@ RUN mkdir /usr/bin/sdk/bpf/dependencies \ USER pyth WORKDIR /home/pyth +# Install poetry +RUN curl -sSL https://install.python-poetry.org | python3 - +ENV PATH="${PATH}:/home/pyth/.local/bin:/home/pyth/pyth-client/build" + +#Install rust RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ | sh -s -- -y - -RUN echo "\n\ -export PATH=\"\${PATH}:\${HOME}/pyth-client/build:\${HOME}/.cargo/bin\"\n\ -export PYTHONPATH=\"\${PYTHONPATH:+\$PYTHONPATH:}\${HOME}/pyth-client\"\n\ -" >> .profile - COPY --chown=pyth:pyth . pyth-client/ # Build off-chain binaries. @@ -69,7 +65,7 @@ RUN cd pyth-client && ./scripts/build-bpf.sh . RUN cd pyth-client && ./scripts/check-size.sh # Run aggregation logic tests RUN cd pyth-client && ./scripts/run-aggregation-tests.sh -RUN /bin/bash -l -c "pytest-3 --pyargs pyth" +RUN cd pyth-client/pyth && poetry install && poetry run python -m pytest ENTRYPOINT [] CMD [] diff --git a/pctest/add_publisher.py b/pctest/add_publisher.py deleted file mode 100755 index 430033f08..000000000 --- a/pctest/add_publisher.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/python3 - -import sys -import json -import subprocess - -if __name__ == '__main__': - if len(sys.argv)<3: - print( 'usage: add_publisher.py ', - file=sys.stderr ) - sys.exit(1) - conf_file = sys.argv[1] - pub_key = sys.argv[2] - - # read config file - cf = open( conf_file ) - cd = json.loads( cf.read() ) - cf.close() - key_store = cd['key_store'] - rpc_host = cd['rpc_host'] - prod_file = cd['product_file'] - - # read products file - pf = open( prod_file ) - pd = json.loads( pf.read() ) - pf.close() - - # process each product - for prod in pd: - # add publisher to each price account - for pxa in prod['price_accounts']: - px_acct = pxa['account'] - cmds = [ './pyth_admin', 'add_publisher', pub_key, px_acct, - '-k', key_store, '-r', rpc_host, '-n' ] - print( cmds, file=sys.stderr ) - res = subprocess.run( cmds, capture_output=True, text=True ) - if res.returncode != 0: - print( res.stderr, file=sys.stderr ); - sys.exit(1) diff --git a/pctest/create_products.py b/pctest/create_products.py deleted file mode 100755 index 788bf5918..000000000 --- a/pctest/create_products.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/python3 - -import sys -import json -import subprocess - -def run_cmd( cmds ) : - print( cmds, file=sys.stderr ) - res = subprocess.run( cmds, capture_output=True, text=True ) - if res.returncode != 0: - print( res.stderr, file=sys.stderr ); - sys.exit(1) - return res - -if __name__ == '__main__': - if len(sys.argv)<2: - print( 'usage: create_products.py ', - file=sys.stderr ) - sys.exit(1) - conf_file = sys.argv[1] - - # read config file - cf = open( conf_file ) - cd = json.loads( cf.read() ) - cf.close() - key_store = cd['key_store'] - rpc_host = cd['rpc_host'] - prod_file = cd['product_file'] - - # read products file - pf = open( prod_file ) - pd = json.loads( pf.read() ) - pf.close() - - # process each product - for prod in pd: - # create product account - cmds = [ './pyth_admin', 'add_product', '-k', key_store, '-r', rpc_host, - '-c', 'finalized' ] - res = run_cmd( cmds ) - prod_acct = res.stdout.strip() - prod['account'] = prod_acct - - # create price accounts for this product - for pxa in prod['price_accounts']: - px_type = pxa['price_type'] - px_expo = pxa['price_exponent'] - cmds = [ './pyth_admin', 'add_price', prod['account'], px_type, - '-e', str(px_expo), '-k', key_store, '-r', rpc_host, - '-c', 'finalized', '-n' ] - res = run_cmd( cmds ) - pxa['account'] = res.stdout.strip() - - # add corresponding publishers - for pub in pxa['publisher_accounts']: - cmds = [ './pyth_admin', 'add_publisher', pub['account'], pxa['account'], - '-k', key_store, '-r', rpc_host, '-c', 'finalized', '-n' ] - run_cmd( cmds ) - - # write back updated products file - pf = open( prod_file, "w+" ) - pf.write( json.dumps( pd, indent=True ) ) - pf.close() - - # finally generate product reference data - cmds = [ './pyth_admin', 'upd_product', prod_file, - '-k', key_store, '-r', rpc_host ] - res = run_cmd( cmds ) diff --git a/pctest/get_product_list.py b/pctest/get_product_list.py deleted file mode 100755 index 11e17fde1..000000000 --- a/pctest/get_product_list.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/python3 - -# pip3 install websockets -import asyncio -import websockets -import json -import datetime -import sys - -async def get_symbol_list( uri ): - - # connect to pythd - ws = await websockets.connect(uri) - - # submit get_product_list request - req = { 'jsonrpc': '2.0', 'method': 'get_product_list', 'id': None } - await ws.send( json.dumps( req ) ) - - # wait for reply - msg = json.loads( await ws.recv() ) - - # print result - print( json.dumps( msg, indent=True ) ) - -if __name__ == '__main__': - uri='ws://localhost:8910' - eloop = asyncio.get_event_loop() - try: - eloop.run_until_complete( get_symbol_list( uri ) ) - except ConnectionRefusedError: - print( f'connection refused uri={uri}' ) - sys.exit(1) diff --git a/pctest/get_products.py b/pctest/get_products.py deleted file mode 100755 index de7fed055..000000000 --- a/pctest/get_products.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/python3 - -import sys -import json -import subprocess - -if __name__ == '__main__': - if len(sys.argv)<2: - print( 'usage: get_products.py ', - file=sys.stderr ) - sys.exit(1) - conf_file = sys.argv[1] - - # read config file - cf = open( conf_file ) - cd = json.loads( cf.read() ) - cf.close() - key_store = cd['key_store'] - rpc_host = cd['rpc_host'] - prod_file = cd['product_file'] - pd= [] - - # get product list - cmd = [ './pyth', 'get_product_list', '-k', key_store, - '-r', rpc_host, '-j' ] - print( cmd, file=sys.stderr ) - res = subprocess.run( cmd, capture_output=True, text=True ) - if res.returncode != 0: - print( res.stderr, file=sys.stderr ); - sys.exit(1) - prod_list = json.loads( res.stdout.strip() ) - for prod in prod_list: - # get product - cmd = [ './pyth', 'get_product', prod['account'], '-k', key_store, - '-r', rpc_host, '-j' ] - print( cmd, file=sys.stderr ) - res = subprocess.run( cmd, capture_output=True, text=True ) - if res.returncode != 0: - print( res.stderr, file=sys.stderr ); - sys.exit(1) - prod = json.loads( res.stdout.strip() ) - pres = {} - pres['account'] = prod['account'] - pres['attr_dict'] = prod['attr_dict'] - pres['price_accounts'] = [] - pd.append( pres ); - for px in prod['price_accounts']: - xres = {} - xres['price_exponent'] = px['price_exponent'] - xres['price_type'] = px['price_type'] - xres['account'] = px['account'] - xres['publisher_accounts'] = [] - pres['price_accounts'].append( xres ) - for pub in px['publisher_accounts']: - ures = {} - ures['account'] = pub['account'] - xres['publisher_accounts'].append( ures ) - - # write products file - pf = open( prod_file, "w+" ) - pf.write( json.dumps( pd, indent=True ) ) - pf.close() diff --git a/pctest/init_prices.py b/pctest/init_prices.py deleted file mode 100755 index a0544858a..000000000 --- a/pctest/init_prices.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/python3 - -import sys -import json -import subprocess - -def run_cmd( cmds ) : - print( cmds, file=sys.stderr ) - res = subprocess.run( cmds, capture_output=True, text=True ) - if res.returncode != 0: - print( res.stderr, file=sys.stderr ); - sys.exit(1) - return res - -if __name__ == '__main__': - if len(sys.argv)<2: - print( 'usage: init_price.py ', - file=sys.stderr ) - sys.exit(1) - conf_file = sys.argv[1] - - # read config file - cf = open( conf_file ) - cd = json.loads( cf.read() ) - cf.close() - key_store = cd['key_store'] - rpc_host = cd['rpc_host'] - prod_file = cd['product_file'] - - # read products file - pf = open( prod_file ) - pd = json.loads( pf.read() ) - pf.close() - - # process each product - for prod in pd: - # update each price accounts for this product - for pxa in prod['price_accounts']: - px_expo = pxa['price_exponent'] - cmds = [ './pyth_admin', 'init_price', pxa['account'], - '-e', str(px_expo), '-k', key_store, '-r', rpc_host, '-n' ] - run_cmd( cmds ) diff --git a/pctest/test_publish.py b/pctest/test_publish.py deleted file mode 100755 index f337709d0..000000000 --- a/pctest/test_publish.py +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/python3 - -# pip3 install websockets -import asyncio -import websockets -import json -import datetime -import sys - -class test_publish: - idnum = 1 - - def __init__( self, sym, price, spread ): - self.symbol = sym - self.pidnum = test_publish.idnum - test_publish.idnum += 1 - self.sidnum = test_publish.idnum - test_publish.idnum += 1 - self.psubid = -1 - self.ssubid = -1 - self.price = price - self.spread = spread - - def gen_subscribe_price(self): - req = { - 'jsonrpc': '2.0', - 'method' : 'subscribe_price', - 'params' : { - 'account': self.account, - 'price_type' : 'price' - }, - 'id': self.sidnum - } - return json.dumps( req ) - - def gen_subscribe_price_sched(self): - req = { - 'jsonrpc': '2.0', - 'method' : 'subscribe_price_sched', - 'params' : { - 'account': self.account, - 'price_type' : 'price' - }, - 'id': self.pidnum - } - return json.dumps( req ) - - def gen_update_price(self): - req = { - 'jsonrpc': '2.0', - 'method': 'update_price', - 'params':{ - 'account': self.account, - 'status': 'trading', - 'price': self.price, - 'conf': self.spread - }, - 'id': None - } - self.price += self.spread - return json.dumps( req ) - - def parse_reply( self, msg, allsub ): - # parse subscription replies - subid = msg['result']['subscription'] - allsub[subid] = self - if msg['id'] == self.pidnum: - self.psubid = subid; - else: - self.ssubid = subid - - async def parse_notify( self, ws, msg ): - # parse subscription notification messages - subid = msg['params']['subscription'] - ts = datetime.datetime.utcnow().isoformat() - if subid == self.ssubid: - # aggregate price update - res = msg['params']['result'] - price = res['price'] - spread = res['conf'] - status = res['status'] - twap = res['twap'] - twac = res['twac'] - print( f'{ts} received aggregate price update symbol=' + self.symbol + - f',price={price}, spread={spread}, twap={twap}, twac={twac}, ' - f'status={status}' ) - else: - # request to submit price - print( f'{ts} submit price to block-chain symbol=' + self.symbol + - f',price={self.price}, spread={self.spread}, subscription={subid}') - await ws.send( self.gen_update_price() ) - - async def subscribe( self, acct, ws, allids ): - # submmit initial subscriptions - self.account = acct - allids[self.pidnum] = self - allids[self.sidnum] = self - await ws.send( self.gen_subscribe_price() ) - await ws.send( self.gen_subscribe_price_sched() ) - - -# wbsocket event loop -async def poll( uri ): - # connect to pythd - ws = await websockets.connect(uri) - - # submit subscriptions to pythd - allids = {} - allsub = {} - allsym = {} - sym1 = test_publish( 'SYMBOL1/USD', 10000, 100 ) - sym2 = test_publish( 'SYMBOL2/USD', 2000000, 20000 ) - allsym[sym1.symbol] = sym1 - allsym[sym2.symbol] = sym2 - - # lookup accounts by symbol and subscribe - req = { 'jsonrpc': '2.0', 'method': 'get_product_list', 'id': None } - await ws.send( json.dumps( req ) ) - msg = json.loads( await ws.recv() ) - for prod in msg['result']: - sym = prod['attr_dict']['symbol'] - for px in prod['price']: - if sym in allsym and px['price_type'] == 'price': - await allsym[sym].subscribe( px['account'], ws, allids ); - - # poll for updates from pythd - while True: - msg = json.loads( await ws.recv() ) -# print(msg) - if 'error' in msg: - ts = datetime.datetime.utcnow().isoformat() - code = msg['error']['code'] - emsg = msg['error']['message'] - print( f'{ts} error code: {code} msg: {emsg}' ) - sys.exit(1) - elif 'result' in msg: - msgid = msg['id'] - if msgid in allids: - allids[msgid].parse_reply( msg, allsub ) - else: - subid = msg['params']['subscription'] - if subid in allsub: - await allsub[subid].parse_notify( ws, msg ) - -# connect to pythd, subscribe to and start publishing on two symbols -if __name__ == '__main__': - uri='ws://localhost:8910' - eloop = asyncio.get_event_loop() - try: - eloop.run_until_complete( poll( uri ) ) - except ConnectionRefusedError: - print( f'connection refused uri={uri}' ) - sys.exit(1) diff --git a/pctest/test_pyth.py b/pctest/test_pyth.py deleted file mode 100755 index ceed4d2fd..000000000 --- a/pctest/test_pyth.py +++ /dev/null @@ -1,224 +0,0 @@ -#!/usr/bin/python3 - -# pip3 install websockets -import asyncio -import websockets -import json -import sys -import random - -def check_expr( expr, msg ): - if not expr: - print( f'expr validation failed: {msg}' ) - sys.exit(1) - -def check_error( ecode, msg, idval ): - if msg['jsonrpc'] != '2.0': - print( f'missing jsonrpc' ) - sys.exit(1) - if msg['id'] != idval: - print( f'missing expected idval' ) - sys.exit(1) - emsg = msg['error'] - rcode = emsg['code'] - if rcode != ecode: - print( f'missing code: expected={code} received={rcode}' ) - -def check_error_obj(ecode, msg, idval=None ): - print(msg) - check_error( ecode, json.loads( msg ), idval ) - -def check_error_arr(ecode, msg, idval=None ): - print(msg) - jmsg = json.loads( msg ) - for imsg in jmsg: - check_error( ecode, imsg, idval ) - -# basic bad request error checking -async def test_1(uri): - ws = await websockets.connect(uri) - - # ping/pong test - pw = await ws.ping() - await pw - - # bad json - await ws.send( 'foo' ) - check_error_obj( -32700, await ws.recv() ) - # invalid json array - await ws.send( '["hello"]' ) - check_error_arr( -32600, await ws.recv() ) - # empty array - await ws.send( '[]' ) - check_error_obj( -32600, await ws.recv() ) - # bad id/method - await ws.send( '{"id":{},"method":"get_symbol_list"}' ) - check_error_obj( -32600, await ws.recv() ) - await ws.send( '{"id":null,"method":[]}' ) - check_error_obj( -32600, await ws.recv() ) - await ws.send( '{"id":null,"method":"non-existant"}' ) - check_error_obj( -32601, await ws.recv() ) - # multibad request - await ws.send( '[{"id":null,"method":"non-existant"},{"id":null,"method":4}]') - check_error_arr( -32601, await ws.recv() ) - - # get symbol list - await ws.send( '{"id":42,"method":"get_symbol_list"}' ) - slist_s = await ws.recv() - print( slist_s ) - slist = json.loads( slist_s ) - check_expr( slist['id'] == 42, 'id mismatch' ) - sres = slist['result'] - check_expr( len(sres) == 3, 'expecting 3 symbols') - check_expr( sres[0]['symbol'] == 'US.EQ.SYMBOL1', 'symbol1 check' ) - check_expr( sres[0]['price_exponent'] == -4, 'symbol1 expo check' ) - check_expr( sres[1]['symbol'] == 'US.EQ.SYMBOL2', 'symbol2 check' ) - check_expr( sres[1]['price_exponent'] == -6, 'symbol2 expo check' ) - check_expr( sres[2]['symbol'] == 'US.EQ.SYMBOL3', 'symbol3 check' ) - check_expr( sres[2]['price_exponent'] == -2, 'symbol3 expo check' ) - - # subscribe to symbol - await ws.send( '{"id":42,"method":"subscribe_price", "params", {}}' ) - check_error_obj( -32602, await ws.recv(), idval=42 ) - await ws.send( '{"id":42,"method":"subscribe_price", "params": {}}' ) - check_error_obj( -32602, await ws.recv(), idval=42 ) - await ws.send( '{"id":42,"method":"subscribe_price", "params": ' - '{"symbol":"US.EQ.SYMBOL1", "price_type":"price"}}' ) - # get subscription result - pres_s = await ws.recv() - print( pres_s ) - pres = json.loads( pres_s ) - check_expr( pres['result']['subscription'] == 0, 'subscription result' ) - # immediate get first price update - pres_s = await ws.recv() - print( pres_s ) - pres = json.loads( pres_s ) - check_expr( pres['method'] == 'notify_price', 'first notify' ) - prms = pres['params'] - pdet = prms['result'] - check_expr( 'price' in pdet, 'missing price field' ) - check_expr( 'conf' in pdet, 'missing conf field' ) - check_expr( 'status' in pdet, 'missing status field' ) - check_expr( pdet['status'] in ['unknown','trading','halted'], - 'bad status field' ) - check_expr( prms['subscription'] == 0, 'subscription id' ) - - # second subscription - await ws.send( '{"id":10,"method":"subscribe_price", "params": ' - '{"symbol":"US.EQ.SYMBOL2", "price_type": "price"}}' ) - pres_s = await ws.recv() - print( pres_s ) - pres = json.loads( pres_s ) - check_expr( pres['result']['subscription'] == 1, 'subscription result' ) - await ws.recv() - - # send bad price updates - await ws.send( '{"id":null,"method":"update_price"}' ) - check_error_obj( -32602, await ws.recv() ) - await ws.send( '{"id":null,"method":"update_price", "params":[]}' ) - check_error_obj( -32602, await ws.recv() ) - await ws.send( '{"id":null,"method":"update_price", "params":["foo"]}' ) - check_error_obj( -32602, await ws.recv() ) - # unknown symbol update check - await ws.send( '{"id":18,"method":"update_price", "params":' - '{"symbol":"foo", "price_type": "price", "price" : 42, "conf": 1, ' - '"status":"trading"}}') - check_error_obj( -32000, await ws.recv(), idval=18 ) - - -def gen_sub(sym,idnum): - return { - 'jsonrpc':'2.0', - 'method': 'subscribe_price', - 'params': { 'symbol': sym, 'price_type': 'price' }, - 'id':idnum } - -def check_notify(res,fld): - check_expr( fld in res['result'], fild + ' missing in result' ) - -# simple price submission/subscription across multiple pythd servers -async def test_2(uri1,uri2): - ws1 = await websockets.connect(uri1) - ws2 = await websockets.connect(uri2) - # subscribe to symbol1, symbol2 and symbol3 on both servers - # note: ws2 does not have publishing rights to symbol3 - print( 'check invalid publisher for symbol3' ) - await ws2.send( '{"id":18,"method":"update_price", "params":' - '{"symbol":"US.EQ.SYMBOL3", "price_type": "price", "price": 1, ' - '"conf":2, "status": "trading"}}' ) - check_error_obj( -32001, await ws2.recv(), idval=18 ) - - print('submitting subscriptions for symbols1, 2, 3') - req = [ gen_sub( 'US.EQ.SYMBOL1', 1 ), - gen_sub( 'US.EQ.SYMBOL2', 2 ), - gen_sub( 'US.EQ.SYMBOL3', 3 ) ] - await ws1.send( json.dumps(req) ) - await ws2.send( json.dumps(req) ) - resp1 = json.loads( await ws1.recv() ) - resp2 = json.loads( await ws2.recv() ) - print( resp1 ) - print( resp2 ) - check_expr( resp1 == resp2, 'subsription responses the same' ) - check_expr( len(resp1)==3, '3 subscription responses in one reply' ) - check_expr( resp1[0]['result']['subscription'] == 0, 'first sub' ) - check_expr( resp1[1]['result']['subscription'] == 1, 'second sub' ) - check_expr( resp1[2]['result']['subscription'] == 2, 'third sub' ) - - # get notifications - for i in range(3): - resp1 = json.loads( await ws1.recv() ) - resp2 = json.loads( await ws2.recv() ) - print( resp1 ) - print( resp2 ) - check_expr( resp1 == resp2, 'subsription responses the same' ) - check_expr( resp1['method'] == 'notify_price', 'expecting notify' ) - prms = resp1['params'] - check_expr( prms['subscription'] == i, 'expecting notify sub' ) - check_expr( 'price' in prms['result'], 'missing price' ) - check_expr( 'conf' in prms['result'], 'missing conf' ) - check_expr( 'status' in prms['result'], 'missing status' ) - - last_px = 0 - last_conf = 0 - for i in range(3): - # submit price for symbol 2 - print( 'update price for symbol 2 : try ' + str(i) ) - px = random.randint( 1000, 20000 ) - conf = random.randint( 10, 200 ) - req = { 'jsonrpc': '2.0', 'method': 'update_price', 'params': - { 'symbol':'US.EQ.SYMBOL2', 'price_type': 'price', - 'price':px, 'conf': conf, 'status': 'trading' }, 'id': i+10 } - print( 'sending ' + json.dumps(req) ) - await ws1.send( json.dumps(req) ) - resp1 = json.loads( await ws1.recv() ) - print( resp1 ) - check_expr( resp1['result'] == 0, 'clean price update' ) - check_expr( resp1['id'] == i+10, 'correct response id' ) - resp1 = json.loads( await ws1.recv() ) - resp2 = json.loads( await ws2.recv() ) - print( resp1 ) - print( resp2 ) - check_expr( resp1 == resp2, 'subsription responses the same' ) - check_expr( resp1['method'] == 'notify_price', 'expecting notify' ) - prms = resp1['params'] - check_expr( prms['subscription'] == 1, 'expecting notify sub symbol2' ) - if i>0: - check_expr( prms['result']['price'] == last_px, 'incorrect price' ) - check_expr( prms['result']['conf'] == last_conf, 'incorrect conf' ) - check_expr( prms['result']['status'] == 'trading', 'incorrect status' ) - last_px = px - last_conf = conf - -async def test(): - uri1='ws://localhost:8910' - uri2='ws://localhost:8911' - await test_1( uri1 ) - await test_2( uri1, uri2 ) - -if __name__ == '__main__': - eloop = asyncio.get_event_loop() - try: - eloop.run_until_complete( test() ) - except ConnectionRefusedError: - print( f'connection refused uri={uri}' ) - sys.exit(1) diff --git a/pyth/__init__.py b/pyth/README.md similarity index 100% rename from pyth/__init__.py rename to pyth/README.md diff --git a/pyth/poetry.lock b/pyth/poetry.lock new file mode 100644 index 000000000..ae900d7ae --- /dev/null +++ b/pyth/poetry.lock @@ -0,0 +1,226 @@ +# This file is automatically @generated by Poetry and should not be changed by hand. + +[[package]] +name = "attrs" +version = "22.2.0" +description = "Classes Without Boilerplate" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "attrs-22.2.0-py3-none-any.whl", hash = "sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836"}, + {file = "attrs-22.2.0.tar.gz", hash = "sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99"}, +] + +[package.extras] +cov = ["attrs[tests]", "coverage-enable-subprocess", "coverage[toml] (>=5.3)"] +dev = ["attrs[docs,tests]"] +docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope.interface"] +tests = ["attrs[tests-no-zope]", "zope.interface"] +tests-no-zope = ["cloudpickle", "cloudpickle", "hypothesis", "hypothesis", "mypy (>=0.971,<0.990)", "mypy (>=0.971,<0.990)", "pympler", "pympler", "pytest (>=4.3.0)", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-mypy-plugins", "pytest-xdist[psutil]", "pytest-xdist[psutil]"] + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.1.0" +description = "Backport of PEP 654 (exception groups)" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.1.0-py3-none-any.whl", hash = "sha256:327cbda3da756e2de031a3107b81ab7b3770a602c4d16ca618298c526f4bec1e"}, + {file = "exceptiongroup-1.1.0.tar.gz", hash = "sha256:bcb67d800a4497e1b404c2dd44fca47d3b7a5e5433dbab67f96c1a685cdfdf23"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "packaging" +version = "23.0" +description = "Core utilities for Python packages" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "packaging-23.0-py3-none-any.whl", hash = "sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2"}, + {file = "packaging-23.0.tar.gz", hash = "sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97"}, +] + +[[package]] +name = "pluggy" +version = "1.0.0" +description = "plugin and hook calling mechanisms for python" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, + {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pytest" +version = "7.2.1" +description = "pytest: simple powerful testing with Python" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.2.1-py3-none-any.whl", hash = "sha256:c7c6ca206e93355074ae32f7403e8ea12163b1163c976fee7d4d84027c162be5"}, + {file = "pytest-7.2.1.tar.gz", hash = "sha256:d45e0952f3727241918b8fd0f376f5ff6b301cc0777c6f9a556935c92d8a7d42"}, +] + +[package.dependencies] +attrs = ">=19.2.0" +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] + +[[package]] +name = "pytest-asyncio" +version = "0.20.3" +description = "Pytest support for asyncio" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-asyncio-0.20.3.tar.gz", hash = "sha256:83cbf01169ce3e8eb71c6c278ccb0574d1a7a3bb8eaaf5e50e0ad342afb33b36"}, + {file = "pytest_asyncio-0.20.3-py3-none-any.whl", hash = "sha256:f129998b209d04fcc65c96fc85c11e5316738358909a8399e93be553d7656442"}, +] + +[package.dependencies] +pytest = ">=6.1.0" + +[package.extras] +docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1.0)"] +testing = ["coverage (>=6.2)", "flaky (>=3.5.0)", "hypothesis (>=5.7.1)", "mypy (>=0.931)", "pytest-trio (>=0.7.0)"] + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[[package]] +name = "websockets" +version = "10.4" +description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "websockets-10.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d58804e996d7d2307173d56c297cf7bc132c52df27a3efaac5e8d43e36c21c48"}, + {file = "websockets-10.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:bc0b82d728fe21a0d03e65f81980abbbcb13b5387f733a1a870672c5be26edab"}, + {file = "websockets-10.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ba089c499e1f4155d2a3c2a05d2878a3428cf321c848f2b5a45ce55f0d7d310c"}, + {file = "websockets-10.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:33d69ca7612f0ddff3316b0c7b33ca180d464ecac2d115805c044bf0a3b0d032"}, + {file = "websockets-10.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:62e627f6b6d4aed919a2052efc408da7a545c606268d5ab5bfab4432734b82b4"}, + {file = "websockets-10.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:38ea7b82bfcae927eeffc55d2ffa31665dc7fec7b8dc654506b8e5a518eb4d50"}, + {file = "websockets-10.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e0cb5cc6ece6ffa75baccfd5c02cffe776f3f5c8bf486811f9d3ea3453676ce8"}, + {file = "websockets-10.4-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:ae5e95cfb53ab1da62185e23b3130e11d64431179debac6dc3c6acf08760e9b1"}, + {file = "websockets-10.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:7c584f366f46ba667cfa66020344886cf47088e79c9b9d39c84ce9ea98aaa331"}, + {file = "websockets-10.4-cp310-cp310-win32.whl", hash = "sha256:b029fb2032ae4724d8ae8d4f6b363f2cc39e4c7b12454df8df7f0f563ed3e61a"}, + {file = "websockets-10.4-cp310-cp310-win_amd64.whl", hash = "sha256:8dc96f64ae43dde92530775e9cb169979f414dcf5cff670455d81a6823b42089"}, + {file = "websockets-10.4-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:47a2964021f2110116cc1125b3e6d87ab5ad16dea161949e7244ec583b905bb4"}, + {file = "websockets-10.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:e789376b52c295c4946403bd0efecf27ab98f05319df4583d3c48e43c7342c2f"}, + {file = "websockets-10.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7d3f0b61c45c3fa9a349cf484962c559a8a1d80dae6977276df8fd1fa5e3cb8c"}, + {file = "websockets-10.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f55b5905705725af31ccef50e55391621532cd64fbf0bc6f4bac935f0fccec46"}, + {file = "websockets-10.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:00c870522cdb69cd625b93f002961ffb0c095394f06ba8c48f17eef7c1541f96"}, + {file = "websockets-10.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f38706e0b15d3c20ef6259fd4bc1700cd133b06c3c1bb108ffe3f8947be15fa"}, + {file = "websockets-10.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:f2c38d588887a609191d30e902df2a32711f708abfd85d318ca9b367258cfd0c"}, + {file = "websockets-10.4-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:fe10ddc59b304cb19a1bdf5bd0a7719cbbc9fbdd57ac80ed436b709fcf889106"}, + {file = "websockets-10.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:90fcf8929836d4a0e964d799a58823547df5a5e9afa83081761630553be731f9"}, + {file = "websockets-10.4-cp311-cp311-win32.whl", hash = "sha256:b9968694c5f467bf67ef97ae7ad4d56d14be2751000c1207d31bf3bb8860bae8"}, + {file = "websockets-10.4-cp311-cp311-win_amd64.whl", hash = "sha256:a7a240d7a74bf8d5cb3bfe6be7f21697a28ec4b1a437607bae08ac7acf5b4882"}, + {file = "websockets-10.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:74de2b894b47f1d21cbd0b37a5e2b2392ad95d17ae983e64727e18eb281fe7cb"}, + {file = "websockets-10.4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e3a686ecb4aa0d64ae60c9c9f1a7d5d46cab9bfb5d91a2d303d00e2cd4c4c5cc"}, + {file = "websockets-10.4-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b0d15c968ea7a65211e084f523151dbf8ae44634de03c801b8bd070b74e85033"}, + {file = "websockets-10.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:00213676a2e46b6ebf6045bc11d0f529d9120baa6f58d122b4021ad92adabd41"}, + {file = "websockets-10.4-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:e23173580d740bf8822fd0379e4bf30aa1d5a92a4f252d34e893070c081050df"}, + {file = "websockets-10.4-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:dd500e0a5e11969cdd3320935ca2ff1e936f2358f9c2e61f100a1660933320ea"}, + {file = "websockets-10.4-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:4239b6027e3d66a89446908ff3027d2737afc1a375f8fd3eea630a4842ec9a0c"}, + {file = "websockets-10.4-cp37-cp37m-win32.whl", hash = "sha256:8a5cc00546e0a701da4639aa0bbcb0ae2bb678c87f46da01ac2d789e1f2d2038"}, + {file = "websockets-10.4-cp37-cp37m-win_amd64.whl", hash = "sha256:a9f9a735deaf9a0cadc2d8c50d1a5bcdbae8b6e539c6e08237bc4082d7c13f28"}, + {file = "websockets-10.4-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:5c1289596042fad2cdceb05e1ebf7aadf9995c928e0da2b7a4e99494953b1b94"}, + {file = "websockets-10.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0cff816f51fb33c26d6e2b16b5c7d48eaa31dae5488ace6aae468b361f422b63"}, + {file = "websockets-10.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:dd9becd5fe29773d140d68d607d66a38f60e31b86df75332703757ee645b6faf"}, + {file = "websockets-10.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:45ec8e75b7dbc9539cbfafa570742fe4f676eb8b0d3694b67dabe2f2ceed8aa6"}, + {file = "websockets-10.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4f72e5cd0f18f262f5da20efa9e241699e0cf3a766317a17392550c9ad7b37d8"}, + {file = "websockets-10.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:185929b4808b36a79c65b7865783b87b6841e852ef5407a2fb0c03381092fa3b"}, + {file = "websockets-10.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:7d27a7e34c313b3a7f91adcd05134315002aaf8540d7b4f90336beafaea6217c"}, + {file = "websockets-10.4-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:884be66c76a444c59f801ac13f40c76f176f1bfa815ef5b8ed44321e74f1600b"}, + {file = "websockets-10.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:931c039af54fc195fe6ad536fde4b0de04da9d5916e78e55405436348cfb0e56"}, + {file = "websockets-10.4-cp38-cp38-win32.whl", hash = "sha256:db3c336f9eda2532ec0fd8ea49fef7a8df8f6c804cdf4f39e5c5c0d4a4ad9a7a"}, + {file = "websockets-10.4-cp38-cp38-win_amd64.whl", hash = "sha256:48c08473563323f9c9debac781ecf66f94ad5a3680a38fe84dee5388cf5acaf6"}, + {file = "websockets-10.4-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:40e826de3085721dabc7cf9bfd41682dadc02286d8cf149b3ad05bff89311e4f"}, + {file = "websockets-10.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:56029457f219ade1f2fc12a6504ea61e14ee227a815531f9738e41203a429112"}, + {file = "websockets-10.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:f5fc088b7a32f244c519a048c170f14cf2251b849ef0e20cbbb0fdf0fdaf556f"}, + {file = "websockets-10.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2fc8709c00704194213d45e455adc106ff9e87658297f72d544220e32029cd3d"}, + {file = "websockets-10.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0154f7691e4fe6c2b2bc275b5701e8b158dae92a1ab229e2b940efe11905dff4"}, + {file = "websockets-10.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4c6d2264f485f0b53adf22697ac11e261ce84805c232ed5dbe6b1bcb84b00ff0"}, + {file = "websockets-10.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:9bc42e8402dc5e9905fb8b9649f57efcb2056693b7e88faa8fb029256ba9c68c"}, + {file = "websockets-10.4-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:edc344de4dac1d89300a053ac973299e82d3db56330f3494905643bb68801269"}, + {file = "websockets-10.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:84bc2a7d075f32f6ed98652db3a680a17a4edb21ca7f80fe42e38753a58ee02b"}, + {file = "websockets-10.4-cp39-cp39-win32.whl", hash = "sha256:c94ae4faf2d09f7c81847c63843f84fe47bf6253c9d60b20f25edfd30fb12588"}, + {file = "websockets-10.4-cp39-cp39-win_amd64.whl", hash = "sha256:bbccd847aa0c3a69b5f691a84d2341a4f8a629c6922558f2a70611305f902d74"}, + {file = "websockets-10.4-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:82ff5e1cae4e855147fd57a2863376ed7454134c2bf49ec604dfe71e446e2193"}, + {file = "websockets-10.4-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d210abe51b5da0ffdbf7b43eed0cfdff8a55a1ab17abbec4301c9ff077dd0342"}, + {file = "websockets-10.4-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:942de28af58f352a6f588bc72490ae0f4ccd6dfc2bd3de5945b882a078e4e179"}, + {file = "websockets-10.4-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c9b27d6c1c6cd53dc93614967e9ce00ae7f864a2d9f99fe5ed86706e1ecbf485"}, + {file = "websockets-10.4-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:3d3cac3e32b2c8414f4f87c1b2ab686fa6284a980ba283617404377cd448f631"}, + {file = "websockets-10.4-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:da39dd03d130162deb63da51f6e66ed73032ae62e74aaccc4236e30edccddbb0"}, + {file = "websockets-10.4-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:389f8dbb5c489e305fb113ca1b6bdcdaa130923f77485db5b189de343a179393"}, + {file = "websockets-10.4-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:09a1814bb15eff7069e51fed0826df0bc0702652b5cb8f87697d469d79c23576"}, + {file = "websockets-10.4-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ff64a1d38d156d429404aaa84b27305e957fd10c30e5880d1765c9480bea490f"}, + {file = "websockets-10.4-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:b343f521b047493dc4022dd338fc6db9d9282658862756b4f6fd0e996c1380e1"}, + {file = "websockets-10.4-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:932af322458da7e4e35df32f050389e13d3d96b09d274b22a7aa1808f292fee4"}, + {file = "websockets-10.4-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d6a4162139374a49eb18ef5b2f4da1dd95c994588f5033d64e0bbfda4b6b6fcf"}, + {file = "websockets-10.4-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c57e4c1349fbe0e446c9fa7b19ed2f8a4417233b6984277cce392819123142d3"}, + {file = "websockets-10.4-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b627c266f295de9dea86bd1112ed3d5fafb69a348af30a2422e16590a8ecba13"}, + {file = "websockets-10.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:05a7233089f8bd355e8cbe127c2e8ca0b4ea55467861906b80d2ebc7db4d6b72"}, + {file = "websockets-10.4.tar.gz", hash = "sha256:eef610b23933c54d5d921c92578ae5f89813438fded840c2e9809d378dc765d3"}, +] + +[metadata] +lock-version = "2.0" +python-versions = "^3.9" +content-hash = "9147e7077a13a00aac0c996266dbcee6522cef1041ecc3956b625e9327ac6047" diff --git a/pyth/pyproject.toml b/pyth/pyproject.toml new file mode 100644 index 000000000..6445ea1f2 --- /dev/null +++ b/pyth/pyproject.toml @@ -0,0 +1,20 @@ +[tool.poetry] +name = "pyth" +version = "0.1.0" +description = "" +authors = ["Pyth Data Association "] +readme = "README.md" +packages = [{include = "pyth"}] + +[tool.poetry.dependencies] +python = "^3.9" + +[tool.poetry.group.dev.dependencies] +pytest = "^7.2.1" +pytest-asyncio = "^0.20.3" +websockets = "^10.4" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/pyth/pyth/__init__.py b/pyth/pyth/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/pyth/tests/test_get_product.py b/pyth/tests/test_get_product.py index 14117abc0..d6ba838b0 100644 --- a/pyth/tests/test_get_product.py +++ b/pyth/tests/test_get_product.py @@ -2,7 +2,7 @@ import json import websockets -from pyth.tests.conftest import PRODUCTS +from tests.conftest import PRODUCTS def test_get_product_list(solana_test_validator, pythd, pyth_init_price): diff --git a/pyth/tests/test_qset.py b/pyth/tests/test_qset.py index 1ce709b9a..fb11b7941 100644 --- a/pyth/tests/test_qset.py +++ b/pyth/tests/test_qset.py @@ -1,4 +1,4 @@ -from pyth.tests.conftest import BaseTest +from tests.conftest import BaseTest __all__ = [ diff --git a/pyth/tests/test_twap.py b/pyth/tests/test_twap.py index ec19a9b3d..4aedada57 100644 --- a/pyth/tests/test_twap.py +++ b/pyth/tests/test_twap.py @@ -1,4 +1,4 @@ -from pyth.tests.conftest import BaseTest +from tests.conftest import BaseTest __all__ = [ diff --git a/pyth/tests/test_update_price.py b/pyth/tests/test_update_price.py index 44971ebe2..099b9b796 100644 --- a/pyth/tests/test_update_price.py +++ b/pyth/tests/test_update_price.py @@ -6,7 +6,7 @@ import itertools import random -from pyth.tests.conftest import PRODUCTS +from tests.conftest import PRODUCTS @pytest.mark.asyncio async def test_batch_update_price(solana_test_validator, solana_logs, pythd, pyth_dir, pyth_init_product, pyth_init_price): diff --git a/scripts/build-bpf.sh b/scripts/build-bpf.sh index 754ff630c..58e167e48 100755 --- a/scripts/build-bpf.sh +++ b/scripts/build-bpf.sh @@ -7,11 +7,7 @@ set -eu PYTH_DIR=$( cd "${1:-.}" && pwd) - -#find the makefile in pyth-client -#ASSUMES THAT there is only one makefile there -C_DIR="$( find $PYTH_DIR | grep makefile)" -C_DIR=$(dirname $C_DIR) +C_DIR="$PYTH_DIR/program/c/" if ! which cargo 2> /dev/null then diff --git a/scripts/run-aggregation-tests.sh b/scripts/run-aggregation-tests.sh index 81caab69c..9854d9133 100755 --- a/scripts/run-aggregation-tests.sh +++ b/scripts/run-aggregation-tests.sh @@ -1,11 +1,7 @@ set -eux PYTH_DIR=$( cd "${1:-.}" && pwd) - -#find the makefile in pyth-client -#ASSUMES THAT there is only one makefile there -C_DIR="$( find $PYTH_DIR | grep makefile)" -C_DIR=$(dirname $C_DIR) +C_DIR="$PYTH_DIR/program/c/" cd "${C_DIR}/src/oracle/model" ./run_tests