From 4ea185c5ecd258df9b2f7f1ba573e12601d74c5b Mon Sep 17 00:00:00 2001 From: Believethehype Date: Wed, 10 Jan 2024 14:42:38 +0100 Subject: [PATCH] losen package dependencies for older versions --- .gitignore | 2 +- setup.py | 6 +-- .../{ => nicegui}/nostrAI_search_client.py | 48 ++++++++----------- 3 files changed, 24 insertions(+), 32 deletions(-) rename tests/gui/{ => nicegui}/nostrAI_search_client.py (83%) diff --git a/.gitignore b/.gitignore index 1813e8e..055951d 100644 --- a/.gitignore +++ b/.gitignore @@ -176,4 +176,4 @@ backends/nserver/modules/image_upscale/weights cache/ cookies_snapshot/satoshi2077@protonmail.com.json Todo.md -tests/gui/node_modules +tests/gui/svelte/node_modules diff --git a/setup.py b/setup.py index 124f2c9..1e1da59 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = '0.1.7' +VERSION = '0.1.8' DESCRIPTION = 'A framework to build and run Nostr NIP90 Data Vending Machines' LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. ' 'This is an early stage release. Interfaces might change/brick') @@ -15,13 +15,13 @@ setup( long_description=LONG_DESCRIPTION, packages=find_packages(include=['nostr_dvm/**']), install_requires=["nostr-sdk==0.7.1", - "bech32==1.2.0", + "bech32", "pycryptodome==3.19.0", "python-dotenv==1.0.0", "emoji==2.8.0", "eva-decord==0.6.1", "ffmpegio==0.8.5", - "lnurl==0.4.1", + "lnurl", "pandas==2.1.3", "Pillow==10.1.0", "PyUpload==0.1.4", diff --git a/tests/gui/nostrAI_search_client.py b/tests/gui/nicegui/nostrAI_search_client.py similarity index 83% rename from tests/gui/nostrAI_search_client.py rename to tests/gui/nicegui/nostrAI_search_client.py index 4cfe880..d6deecb 100644 --- a/tests/gui/nostrAI_search_client.py +++ b/tests/gui/nicegui/nostrAI_search_client.py @@ -1,17 +1,13 @@ -import asyncio import json import time from datetime import timedelta -from pathlib import Path from nicegui import run, ui -import dotenv -from nostr_sdk import Keys, Client, Tag, EventBuilder, Filter, HandleNotification, nip04_decrypt, \ - nip04_encrypt, Options, Timestamp, ZapRequestData, ClientSigner, EventId, Nip19Event, PublicKey +from nostr_sdk import Keys, Client, Tag, EventBuilder, Filter, \ + Options, Timestamp, ClientSigner, EventId, Nip19Event, PublicKey from nostr_dvm.utils import dvmconfig -from nostr_dvm.utils.database_utils import fetch_user_metadata from nostr_dvm.utils.dvmconfig import DVMConfig -from nostr_dvm.utils.nostr_utils import send_event, check_and_set_private_key, get_event_by_id, get_events_by_id +from nostr_dvm.utils.nostr_utils import send_event, check_and_set_private_key, get_events_by_id from nostr_dvm.utils.definitions import EventDefinitions @@ -74,19 +70,18 @@ def init(): if lastfeedback != fevents[0].content(): for tag in fevents[0].tags(): if tag.as_vec()[0] == "status": - if tag.as_vec()[1] == "error": - with mainrow: - with maincolumn: - ui.notify(fevents[0].content(), type="negative") - lastfeedback = fevents[0].content() - break - else: - with mainrow: - with maincolumn: - ui.notify(fevents[0].content(), type="info") - lastfeedback = fevents[0].content() - break - + if tag.as_vec()[1] == "error": + with mainrow: + with maincolumn: + ui.notify(fevents[0].content(), type="negative") + lastfeedback = fevents[0].content() + break + else: + with mainrow: + with maincolumn: + ui.notify(fevents[0].content(), type="info") + lastfeedback = fevents[0].content() + break if len(events) == 0: response = False @@ -135,8 +130,8 @@ def init(): for word in taggedusersfrom: search = str(search).replace(word, "") user_pubkey = PublicKey.from_bech32(word.replace("@", "")).to_hex() - pTag = ["p", user_pubkey] - tags.append(pTag) + pTag = Tag.parse(["p", user_pubkey]) + tags.append(pTag.as_vec()) search = str(search).replace("from:", "").replace("to:", "").replace("@", "").lstrip().rstrip() print(search) ev = nostr_client_test_search(search, tags) @@ -161,21 +156,18 @@ def init(): with mainrow: with maincolumn: - ui.label('NostrAI Search Page').classes('text-2xl') + ui.label('Noogle Search').classes('text-2xl') prompt = ui.input('Search').style('width: 20em') ui.button('Search', on_click=search).style('width: 15em') - # image = ui.image().style('width: 60em') columns = [ {'name': 'result', 'label': 'result', 'field': 'result', 'sortable': True, 'align': 'left', }, {'name': 'time', 'label': 'time', 'field': 'time', 'sortable': True, 'align': 'left'}, - # {'name': 'eventid', 'label': 'eventid', 'field': 'eventid', 'sortable': True, 'align': 'left'}, ] - # table = ui.table(columns, rows=data).classes('w-full bordered') table = ui.table(columns=columns, rows=data, row_key='result', pagination={'rowsPerPage': 10, 'sortBy': 'time', 'descending': True, 'page': 1}).style( - 'width: 80em') + 'width: 50em') table.add_slot('header', r''' @@ -191,7 +183,7 @@ def init(): @click="props.expand = !props.expand" :icon="props.expand ? 'remove' : 'add'" /> - + {{ col.value }}