add requirements.dev.txt

This commit is contained in:
j3d1 2024-01-07 17:26:20 +01:00
parent 8399b7e125
commit 8f7c037606
4 changed files with 97 additions and 34 deletions

30
core/helper.py Normal file
View file

@ -0,0 +1,30 @@
import asyncio
import logging
import signal
loop = None
def create_task(coro):
global loop
loop.create_task(coro)
async def shutdown(sig, loop):
log = logging.getLogger()
log.info(f"Received exit signal {sig.name}...")
tasks = [t for t in asyncio.all_tasks() if t is not
asyncio.current_task()]
[task.cancel() for task in tasks]
log.info(f"Cancelling {len(tasks)} outstanding tasks")
await asyncio.wait_for(loop.shutdown_asyncgens(), timeout=10)
loop.stop()
log.info("Shutdown complete.")
def init_loop():
global loop
loop = asyncio.get_event_loop()
loop.add_signal_handler(signal.SIGTERM, lambda: asyncio.create_task(shutdown(signal.SIGTERM, loop)))
loop.add_signal_handler(signal.SIGINT, lambda: asyncio.create_task(shutdown(signal.SIGINT, loop)))
return loop

65
core/requirements.dev.txt Normal file
View file

@ -0,0 +1,65 @@
aiosmtpd==1.4.4.post2
aiosmtplib==3.0.1
anyio==4.1.0
asgiref==3.7.2
asynctest==0.7.1
atpublic==4.0
attrs==23.1.0
autobahn==23.6.2
Automat==22.10.0
certifi==2023.11.17
cffi==1.16.0
channels==4.0.0
channels-redis==4.1.0
charset-normalizer==3.3.2
click==8.1.7
constantly==23.10.4
coreapi==2.3.3
coreschema==0.0.4
coverage==7.3.2
cryptography==41.0.5
daphne==4.0.0
Django==4.2.7
django-async-test==0.2.2
django-extensions==3.2.3
django-rest-knox==4.2.0
django-soft-delete==0.9.21
djangorestframework==3.14.0
drf-yasg==1.21.7
h11==0.14.0
hyperlink==21.0.0
idna==3.4
incremental==22.10.0
inflection==0.5.1
itypes==1.2.0
Jinja2==3.1.2
MarkupSafe==2.1.3
msgpack==1.0.7
msgpack-python==0.5.6
openapi-codec==1.3.2
packaging==23.2
Pillow==10.1.0
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycparser==2.21
pyOpenSSL==23.3.0
python-dotenv==1.0.0
pytz==2023.3.post1
PyYAML==6.0.1
redis==5.0.1
requests==2.31.0
sdnotify==0.3.2
service-identity==23.1.0
setproctitle==1.3.3
six==1.16.0
sniffio==1.3.0
sqlparse==0.4.4
Twisted==23.10.0
txaio==23.1.1
typing_extensions==4.8.0
uritemplate==4.1.1
urllib3==2.1.0
uvicorn==0.24.0.post1
watchfiles==0.21.0
websockets==12.0
zope.interface==6.1

View file

@ -10,6 +10,7 @@ coreschema==0.0.4
Django==4.2.7
django-extensions==3.2.3
django-mysql==4.12.0
django-rest-knox==4.2.0
django-soft-delete==0.9.21
djangorestframework==3.14.0
drf-yasg==1.21.7

View file

@ -9,29 +9,11 @@ import uvicorn
django.setup()
from core.globals import init_loop
from helper import init_loop
from mail.protocol import LMTPHandler
from mail.socket import UnixSocketLMTPController
# async def handle_echo(reader, writer):
# # session = Session()
# data = await reader.read(100)
# message = data.decode()
# addr = writer.get_extra_info('peername')
#
# print(f"Received {message!r} from {addr!r}")
#
# print(f"Send: {message!r}")
# writer.write(data)
# await writer.drain()
#
# print("Close the connection")
# writer.close()
# await writer.wait_closed()
class UvicornServer(uvicorn.Server):
def install_signal_handlers(self):
pass
@ -47,21 +29,6 @@ async def web(loop):
await server.serve()
# async def tcp(loop):
# log = logging.getLogger('test.log')
# log.addHandler(logging.FileHandler('test.log'))
# log.setLevel(logging.DEBUG)
# log.info("Starting TCP server")
# server = await asyncio.start_unix_server(handle_echo, path='test.sock')
#
# addrs = ', '.join(str(sock.getsockname()) for sock in server.sockets)
# log.info(f'Serving on {addrs}')
#
# async with server:
# await server.serve_forever()
# log.info("TCP done")
async def lmtp(loop):
import grp
log = logging.getLogger('mail.log')