python package

This commit is contained in:
Morgan McMillian 2021-11-19 15:14:24 -08:00
parent c0dc240e44
commit 4ae27d2a00
5 changed files with 24 additions and 4 deletions

0
partybot/__init__.py Normal file
View file

View file

@ -10,11 +10,10 @@ import random
import re
import argparse
# from database import db_session, init_db
from sqlalchemy import create_engine, and_
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from models import Base, Karma, Optout, Queue, Preferences, MdnpRequests
from partybot.models import Base, Karma, Optout, Queue, Preferences, MdnpRequests
_startup = threading.Event()
_shutdown = threading.Event()
@ -353,8 +352,7 @@ def on_open(ws):
t = threading.Thread(target=run)
t.start()
if __name__ == "__main__":
def main():
logger = logging.getLogger()
a_parser = argparse.ArgumentParser()
a_parser.add_argument(
@ -394,3 +392,7 @@ if __name__ == "__main__":
while r:
_error.clear()
r = ws.run_forever()
if __name__ == "__main__":
main()

18
setup.py Normal file
View file

@ -0,0 +1,18 @@
from setuptools import setup
setup(
name='partybot',
py_modules=['models','pnutbot'],
install_requires=[
'PyYAML',
'pnutpy',
'requests',
'SQLAlchemy',
'websocket-client',
],
entry_points={
'console_scripts': [
'partybot = partybot.pnutbot:main'
]
},
)