From bf37732b38b6d798f86fdf5c3d26b8e306e34655 Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Mon, 7 Jun 2021 20:46:58 +0100 Subject: [PATCH] Improved project structure --- pyproject.toml | 6 ++ setup.cfg | 36 ++++++++++++ setup.py | 58 +------------------ {engineio => src/engineio}/__init__.py | 0 .../engineio}/async_drivers/__init__.py | 0 .../engineio}/async_drivers/aiohttp.py | 0 .../engineio}/async_drivers/asgi.py | 0 .../engineio}/async_drivers/eventlet.py | 0 .../engineio}/async_drivers/gevent.py | 0 .../engineio}/async_drivers/gevent_uwsgi.py | 0 .../engineio}/async_drivers/sanic.py | 0 .../engineio}/async_drivers/threading.py | 0 .../engineio}/async_drivers/tornado.py | 0 {engineio => src/engineio}/asyncio_client.py | 0 {engineio => src/engineio}/asyncio_server.py | 0 {engineio => src/engineio}/asyncio_socket.py | 0 {engineio => src/engineio}/client.py | 0 {engineio => src/engineio}/exceptions.py | 0 {engineio => src/engineio}/json.py | 0 {engineio => src/engineio}/middleware.py | 0 {engineio => src/engineio}/packet.py | 0 {engineio => src/engineio}/payload.py | 0 {engineio => src/engineio}/server.py | 0 {engineio => src/engineio}/socket.py | 0 {engineio => src/engineio}/static_files.py | 0 tox.ini | 3 +- 26 files changed, 46 insertions(+), 57 deletions(-) create mode 100644 pyproject.toml create mode 100644 setup.cfg rename {engineio => src/engineio}/__init__.py (100%) rename {engineio => src/engineio}/async_drivers/__init__.py (100%) rename {engineio => src/engineio}/async_drivers/aiohttp.py (100%) rename {engineio => src/engineio}/async_drivers/asgi.py (100%) rename {engineio => src/engineio}/async_drivers/eventlet.py (100%) rename {engineio => src/engineio}/async_drivers/gevent.py (100%) rename {engineio => src/engineio}/async_drivers/gevent_uwsgi.py (100%) rename {engineio => src/engineio}/async_drivers/sanic.py (100%) rename {engineio => src/engineio}/async_drivers/threading.py (100%) rename {engineio => src/engineio}/async_drivers/tornado.py (100%) rename {engineio => src/engineio}/asyncio_client.py (100%) rename {engineio => src/engineio}/asyncio_server.py (100%) rename {engineio => src/engineio}/asyncio_socket.py (100%) rename {engineio => src/engineio}/client.py (100%) rename {engineio => src/engineio}/exceptions.py (100%) rename {engineio => src/engineio}/json.py (100%) rename {engineio => src/engineio}/middleware.py (100%) rename {engineio => src/engineio}/packet.py (100%) rename {engineio => src/engineio}/payload.py (100%) rename {engineio => src/engineio}/server.py (100%) rename {engineio => src/engineio}/socket.py (100%) rename {engineio => src/engineio}/static_files.py (100%) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..374b58cb --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + "setuptools>=42", + "wheel" +] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..8218fd8c --- /dev/null +++ b/setup.cfg @@ -0,0 +1,36 @@ +[metadata] +name = python-engineio +version = 4.2.1.dev0 +author = Miguel Grinberg +author_email = miguel.grinberg@gmail.com +description = Engine.IO server and client for Python +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/miguelgrinberg/python-engineio +project_urls = + Bug Tracker = https://github.com/miguelgrinberg/python-engineio/issues +classifiers = + Environment :: Web Environment + Intended Audience :: Developers + Programming Language :: Python :: 3 + License :: OSI Approved :: MIT License + Operating System :: OS Independent + +[options] +zip_safe = False +include_package_data = True +package_dir = + = src +packages = find: +python_requires = >=3.6 +install_requires = + +[options.packages.find] +where = src + +[options.extras_require] +client = + requests >= 2.21.0 + websocket-client >= 0.54.0 +asyncio_client = + aiohttp >= 3.4 diff --git a/setup.py b/setup.py index 8fd66777..b908cbe5 100755 --- a/setup.py +++ b/setup.py @@ -1,57 +1,3 @@ -""" -python-engineio ---------------- +import setuptools -Engine.IO server. -""" -import re -import sys -from setuptools import setup - - -with open('engineio/__init__.py', 'r') as f: - version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', - f.read(), re.MULTILINE).group(1) - -with open('README.md', 'r') as f: - long_description = f.read() - -setup( - name='python-engineio', - version=version, - url='http://github.com/miguelgrinberg/python-engineio/', - license='MIT', - author='Miguel Grinberg', - author_email='miguelgrinberg50@gmail.com', - description='Engine.IO server', - long_description=long_description, - long_description_content_type='text/markdown', - packages=['engineio', 'engineio.async_drivers'], - zip_safe=False, - include_package_data=True, - platforms='any', - install_requires=[], - extras_require={ - 'client': [ - 'requests>=2.21.0', - 'websocket-client>=0.54.0', - ], - 'asyncio_client': [ - 'aiohttp>=3.4', - ] - }, - tests_require=[ - 'eventlet', - ], - test_suite='tests', - classifiers=[ - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', - 'Topic :: Software Development :: Libraries :: Python Modules' - ] -) +setuptools.setup() diff --git a/engineio/__init__.py b/src/engineio/__init__.py similarity index 100% rename from engineio/__init__.py rename to src/engineio/__init__.py diff --git a/engineio/async_drivers/__init__.py b/src/engineio/async_drivers/__init__.py similarity index 100% rename from engineio/async_drivers/__init__.py rename to src/engineio/async_drivers/__init__.py diff --git a/engineio/async_drivers/aiohttp.py b/src/engineio/async_drivers/aiohttp.py similarity index 100% rename from engineio/async_drivers/aiohttp.py rename to src/engineio/async_drivers/aiohttp.py diff --git a/engineio/async_drivers/asgi.py b/src/engineio/async_drivers/asgi.py similarity index 100% rename from engineio/async_drivers/asgi.py rename to src/engineio/async_drivers/asgi.py diff --git a/engineio/async_drivers/eventlet.py b/src/engineio/async_drivers/eventlet.py similarity index 100% rename from engineio/async_drivers/eventlet.py rename to src/engineio/async_drivers/eventlet.py diff --git a/engineio/async_drivers/gevent.py b/src/engineio/async_drivers/gevent.py similarity index 100% rename from engineio/async_drivers/gevent.py rename to src/engineio/async_drivers/gevent.py diff --git a/engineio/async_drivers/gevent_uwsgi.py b/src/engineio/async_drivers/gevent_uwsgi.py similarity index 100% rename from engineio/async_drivers/gevent_uwsgi.py rename to src/engineio/async_drivers/gevent_uwsgi.py diff --git a/engineio/async_drivers/sanic.py b/src/engineio/async_drivers/sanic.py similarity index 100% rename from engineio/async_drivers/sanic.py rename to src/engineio/async_drivers/sanic.py diff --git a/engineio/async_drivers/threading.py b/src/engineio/async_drivers/threading.py similarity index 100% rename from engineio/async_drivers/threading.py rename to src/engineio/async_drivers/threading.py diff --git a/engineio/async_drivers/tornado.py b/src/engineio/async_drivers/tornado.py similarity index 100% rename from engineio/async_drivers/tornado.py rename to src/engineio/async_drivers/tornado.py diff --git a/engineio/asyncio_client.py b/src/engineio/asyncio_client.py similarity index 100% rename from engineio/asyncio_client.py rename to src/engineio/asyncio_client.py diff --git a/engineio/asyncio_server.py b/src/engineio/asyncio_server.py similarity index 100% rename from engineio/asyncio_server.py rename to src/engineio/asyncio_server.py diff --git a/engineio/asyncio_socket.py b/src/engineio/asyncio_socket.py similarity index 100% rename from engineio/asyncio_socket.py rename to src/engineio/asyncio_socket.py diff --git a/engineio/client.py b/src/engineio/client.py similarity index 100% rename from engineio/client.py rename to src/engineio/client.py diff --git a/engineio/exceptions.py b/src/engineio/exceptions.py similarity index 100% rename from engineio/exceptions.py rename to src/engineio/exceptions.py diff --git a/engineio/json.py b/src/engineio/json.py similarity index 100% rename from engineio/json.py rename to src/engineio/json.py diff --git a/engineio/middleware.py b/src/engineio/middleware.py similarity index 100% rename from engineio/middleware.py rename to src/engineio/middleware.py diff --git a/engineio/packet.py b/src/engineio/packet.py similarity index 100% rename from engineio/packet.py rename to src/engineio/packet.py diff --git a/engineio/payload.py b/src/engineio/payload.py similarity index 100% rename from engineio/payload.py rename to src/engineio/payload.py diff --git a/engineio/server.py b/src/engineio/server.py similarity index 100% rename from engineio/server.py rename to src/engineio/server.py diff --git a/engineio/socket.py b/src/engineio/socket.py similarity index 100% rename from engineio/socket.py rename to src/engineio/socket.py diff --git a/engineio/static_files.py b/src/engineio/static_files.py similarity index 100% rename from engineio/static_files.py rename to src/engineio/static_files.py diff --git a/tox.ini b/tox.ini index ee590727..16600fb3 100644 --- a/tox.ini +++ b/tox.ini @@ -12,6 +12,7 @@ python = [testenv] commands= + pip install -e . pytest -p no:logging --cov=engineio --cov-branch --cov-report=term-missing deps= pytest @@ -28,7 +29,7 @@ deps= deps= flake8 commands= - flake8 --exclude=".*" --ignore=W503,E402,E722 engineio tests + flake8 --exclude=".*" --ignore=W503,E402,E722 src/engineio tests [testenv:docs] changedir=docs