From 98c7ac23f231b64cc8b8c51104b792d0cd5cf361 Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Mon, 7 Jun 2021 20:37:22 +0100 Subject: [PATCH] Improved project structure --- pyproject.toml | 6 ++ setup.cfg | 39 ++++++++++++ setup.py | 61 +------------------ {socketio => src/socketio}/__init__.py | 4 +- {socketio => src/socketio}/asgi.py | 0 .../socketio}/asyncio_aiopika_manager.py | 0 {socketio => src/socketio}/asyncio_client.py | 0 {socketio => src/socketio}/asyncio_manager.py | 0 .../socketio}/asyncio_namespace.py | 0 .../socketio}/asyncio_pubsub_manager.py | 0 .../socketio}/asyncio_redis_manager.py | 0 {socketio => src/socketio}/asyncio_server.py | 0 {socketio => src/socketio}/base_manager.py | 0 {socketio => src/socketio}/client.py | 0 {socketio => src/socketio}/exceptions.py | 0 {socketio => src/socketio}/kafka_manager.py | 0 {socketio => src/socketio}/kombu_manager.py | 0 {socketio => src/socketio}/middleware.py | 0 {socketio => src/socketio}/namespace.py | 0 {socketio => src/socketio}/packet.py | 0 {socketio => src/socketio}/pubsub_manager.py | 0 {socketio => src/socketio}/redis_manager.py | 0 {socketio => src/socketio}/server.py | 0 {socketio => src/socketio}/tornado.py | 0 {socketio => src/socketio}/zmq_manager.py | 0 tox.ini | 3 +- 26 files changed, 50 insertions(+), 63 deletions(-) create mode 100644 pyproject.toml create mode 100644 setup.cfg rename {socketio => src/socketio}/__init__.py (93%) rename {socketio => src/socketio}/asgi.py (100%) rename {socketio => src/socketio}/asyncio_aiopika_manager.py (100%) rename {socketio => src/socketio}/asyncio_client.py (100%) rename {socketio => src/socketio}/asyncio_manager.py (100%) rename {socketio => src/socketio}/asyncio_namespace.py (100%) rename {socketio => src/socketio}/asyncio_pubsub_manager.py (100%) rename {socketio => src/socketio}/asyncio_redis_manager.py (100%) rename {socketio => src/socketio}/asyncio_server.py (100%) rename {socketio => src/socketio}/base_manager.py (100%) rename {socketio => src/socketio}/client.py (100%) rename {socketio => src/socketio}/exceptions.py (100%) rename {socketio => src/socketio}/kafka_manager.py (100%) rename {socketio => src/socketio}/kombu_manager.py (100%) rename {socketio => src/socketio}/middleware.py (100%) rename {socketio => src/socketio}/namespace.py (100%) rename {socketio => src/socketio}/packet.py (100%) rename {socketio => src/socketio}/pubsub_manager.py (100%) rename {socketio => src/socketio}/redis_manager.py (100%) rename {socketio => src/socketio}/server.py (100%) rename {socketio => src/socketio}/tornado.py (100%) rename {socketio => src/socketio}/zmq_manager.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..d0c959a7 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,39 @@ +[metadata] +name = python-socketio +version = 5.3.1.dev0 +author = Miguel Grinberg +author_email = miguel.grinberg@gmail.com +description = Socket.IO server and client for Python +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/miguelgrinberg/python-socketio +project_urls = + Bug Tracker = https://github.com/miguelgrinberg/python-socketio/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 = + bidict >= 0.21.0 + python-engineio >= 4.1.0 + +[options.packages.find] +where = src + +[options.extras_require] +client = + requests >= 2.21.0 + websocket-client >= 0.54.0 +asyncio_client = + aiohttp >= 3.4 + websockets >= 7.0 diff --git a/setup.py b/setup.py index 9702b46e..b908cbe5 100755 --- a/setup.py +++ b/setup.py @@ -1,60 +1,3 @@ -""" -python-socketio ---------------- +import setuptools -Socket.IO server. -""" -import re -import sys -from setuptools import setup - -with open('socketio/__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-socketio', - version=version, - url='http://github.com/miguelgrinberg/python-socketio/', - license='MIT', - author='Miguel Grinberg', - author_email='miguelgrinberg50@gmail.com', - description='Socket.IO server', - long_description=long_description, - long_description_content_type='text/markdown', - packages=['socketio'], - zip_safe=False, - include_package_data=True, - platforms='any', - install_requires=[ - 'bidict>=0.21.0', - 'python-engineio>=4.1.0', - ], - extras_require={ - 'client': [ - 'requests>=2.21.0', - 'websocket-client>=0.54.0', - ], - 'asyncio_client': [ - 'aiohttp>=3.4', - 'websockets>=7.0', - ] - }, - tests_require=[ - 'mock', - ], - test_suite='tests' if sys.version_info >= (3, 0) else 'tests.common', - 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/socketio/__init__.py b/src/socketio/__init__.py similarity index 93% rename from socketio/__init__.py rename to src/socketio/__init__.py index 5bed736b..ad0a1c18 100644 --- a/socketio/__init__.py +++ b/src/socketio/__init__.py @@ -27,9 +27,7 @@ AsyncRedisManager = None AsyncAioPikaManager = None -__version__ = '5.3.1dev' - -__all__ = ['__version__', 'Client', 'Server', 'BaseManager', 'PubSubManager', +__all__ = ['Client', 'Server', 'BaseManager', 'PubSubManager', 'KombuManager', 'RedisManager', 'ZmqManager', 'KafkaManager', 'Namespace', 'ClientNamespace', 'WSGIApp', 'Middleware'] if AsyncServer is not None: # pragma: no cover diff --git a/socketio/asgi.py b/src/socketio/asgi.py similarity index 100% rename from socketio/asgi.py rename to src/socketio/asgi.py diff --git a/socketio/asyncio_aiopika_manager.py b/src/socketio/asyncio_aiopika_manager.py similarity index 100% rename from socketio/asyncio_aiopika_manager.py rename to src/socketio/asyncio_aiopika_manager.py diff --git a/socketio/asyncio_client.py b/src/socketio/asyncio_client.py similarity index 100% rename from socketio/asyncio_client.py rename to src/socketio/asyncio_client.py diff --git a/socketio/asyncio_manager.py b/src/socketio/asyncio_manager.py similarity index 100% rename from socketio/asyncio_manager.py rename to src/socketio/asyncio_manager.py diff --git a/socketio/asyncio_namespace.py b/src/socketio/asyncio_namespace.py similarity index 100% rename from socketio/asyncio_namespace.py rename to src/socketio/asyncio_namespace.py diff --git a/socketio/asyncio_pubsub_manager.py b/src/socketio/asyncio_pubsub_manager.py similarity index 100% rename from socketio/asyncio_pubsub_manager.py rename to src/socketio/asyncio_pubsub_manager.py diff --git a/socketio/asyncio_redis_manager.py b/src/socketio/asyncio_redis_manager.py similarity index 100% rename from socketio/asyncio_redis_manager.py rename to src/socketio/asyncio_redis_manager.py diff --git a/socketio/asyncio_server.py b/src/socketio/asyncio_server.py similarity index 100% rename from socketio/asyncio_server.py rename to src/socketio/asyncio_server.py diff --git a/socketio/base_manager.py b/src/socketio/base_manager.py similarity index 100% rename from socketio/base_manager.py rename to src/socketio/base_manager.py diff --git a/socketio/client.py b/src/socketio/client.py similarity index 100% rename from socketio/client.py rename to src/socketio/client.py diff --git a/socketio/exceptions.py b/src/socketio/exceptions.py similarity index 100% rename from socketio/exceptions.py rename to src/socketio/exceptions.py diff --git a/socketio/kafka_manager.py b/src/socketio/kafka_manager.py similarity index 100% rename from socketio/kafka_manager.py rename to src/socketio/kafka_manager.py diff --git a/socketio/kombu_manager.py b/src/socketio/kombu_manager.py similarity index 100% rename from socketio/kombu_manager.py rename to src/socketio/kombu_manager.py diff --git a/socketio/middleware.py b/src/socketio/middleware.py similarity index 100% rename from socketio/middleware.py rename to src/socketio/middleware.py diff --git a/socketio/namespace.py b/src/socketio/namespace.py similarity index 100% rename from socketio/namespace.py rename to src/socketio/namespace.py diff --git a/socketio/packet.py b/src/socketio/packet.py similarity index 100% rename from socketio/packet.py rename to src/socketio/packet.py diff --git a/socketio/pubsub_manager.py b/src/socketio/pubsub_manager.py similarity index 100% rename from socketio/pubsub_manager.py rename to src/socketio/pubsub_manager.py diff --git a/socketio/redis_manager.py b/src/socketio/redis_manager.py similarity index 100% rename from socketio/redis_manager.py rename to src/socketio/redis_manager.py diff --git a/socketio/server.py b/src/socketio/server.py similarity index 100% rename from socketio/server.py rename to src/socketio/server.py diff --git a/socketio/tornado.py b/src/socketio/tornado.py similarity index 100% rename from socketio/tornado.py rename to src/socketio/tornado.py diff --git a/socketio/zmq_manager.py b/src/socketio/zmq_manager.py similarity index 100% rename from socketio/zmq_manager.py rename to src/socketio/zmq_manager.py diff --git a/tox.ini b/tox.ini index 1730b43e..34c16acf 100644 --- a/tox.ini +++ b/tox.ini @@ -12,6 +12,7 @@ python = [testenv] commands= + pip install -e . pytest -p no:logging --cov=socketio --cov-branch --cov-report=term-missing deps= pytest @@ -21,7 +22,7 @@ deps= deps= flake8 commands= - flake8 --exclude=".*" --ignore=W503,E402,E722 socketio tests + flake8 --exclude=".*" --ignore=W503,E402,E722 src/socketio tests [testenv:docs] changedir=docs