diff --git a/README.md b/README.md index 31e7e17..1ee8ceb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Flask-SocketIO ============== -[![Build status](https://github.com/miguelgrinberg/flask-socketio/workflows/build/badge.svg)](https://github.com/miguelgrinberg/Flask-SocketIO/actions) [![codecov](https://codecov.io/gh/miguelgrinberg/flask-socketio/branch/master/graph/badge.svg)](https://codecov.io/gh/miguelgrinberg/flask-socketio) +[![Build status](https://github.com/miguelgrinberg/flask-socketio/workflows/build/badge.svg)](https://github.com/miguelgrinberg/Flask-SocketIO/actions) [![codecov](https://codecov.io/gh/miguelgrinberg/flask-socketio/branch/main/graph/badge.svg)](https://codecov.io/gh/miguelgrinberg/flask-socketio) Socket.IO integration for Flask applications. @@ -51,6 +51,6 @@ Resources - [Tutorial](http://blog.miguelgrinberg.com/post/easy-websockets-with-flask-and-gevent) - [Documentation](http://flask-socketio.readthedocs.io/en/latest/) - [PyPI](https://pypi.python.org/pypi/Flask-SocketIO) -- [Change Log](https://github.com/miguelgrinberg/Flask-SocketIO/blob/master/CHANGES.md) +- [Change Log](https://github.com/miguelgrinberg/Flask-SocketIO/blob/main/CHANGES.md) - Questions? See the [questions](https://stackoverflow.com/questions/tagged/flask-socketio) others have asked on Stack Overflow, or [ask](https://stackoverflow.com/questions/ask?tags=python+flask-socketio+python-socketio) your own question. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..374b58c --- /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 0000000..df0b210 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,31 @@ +[metadata] +name = Flask-SocketIO +version = 5.1.1.dev0 +author = Miguel Grinberg +author_email = miguel.grinberg@gmail.com +description = Socket.IO integration for Flask applications +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/miguelgrinberg/flask-socketio +project_urls = + Bug Tracker = https://github.com/miguelgrinberg/flask-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 = + Flask >= 0.9 + python-socketio >= 5.0.2 + +[options.packages.find] +where = src diff --git a/setup.py b/setup.py index f589244..b908cbe 100755 --- a/setup.py +++ b/setup.py @@ -1,45 +1,3 @@ -""" -Flask-SocketIO --------------- +import setuptools -Socket.IO integration for Flask applications. -""" -import re -from setuptools import setup - -with open('flask_socketio/__init__.py', 'r') as f: - version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', - f.read(), re.MULTILINE).group(1) - -setup( - name='Flask-SocketIO', - version=version, - url='http://github.com/miguelgrinberg/Flask-SocketIO/', - license='MIT', - author='Miguel Grinberg', - author_email='miguelgrinberg50@gmail.com', - description='Socket.IO integration for Flask applications', - long_description=__doc__, - packages=['flask_socketio'], - zip_safe=False, - include_package_data=True, - platforms='any', - install_requires=[ - 'Flask>=0.9', - 'python-socketio>=5.0.2' - ], - tests_require=[ - 'coverage' - ], - test_suite='test_socketio', - 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/flask_socketio/__init__.py b/src/flask_socketio/__init__.py similarity index 99% rename from flask_socketio/__init__.py rename to src/flask_socketio/__init__.py index e97697c..830ea48 100644 --- a/flask_socketio/__init__.py +++ b/src/flask_socketio/__init__.py @@ -26,8 +26,6 @@ from werkzeug._reloader import run_with_reloader from .namespace import Namespace from .test_client import SocketIOTestClient -__version__ = '5.1.1dev' - class _SocketIOMiddleware(socketio.WSGIApp): """This WSGI middleware simply exposes the Flask application in the WSGI diff --git a/flask_socketio/namespace.py b/src/flask_socketio/namespace.py similarity index 100% rename from flask_socketio/namespace.py rename to src/flask_socketio/namespace.py diff --git a/flask_socketio/test_client.py b/src/flask_socketio/test_client.py similarity index 100% rename from flask_socketio/test_client.py rename to src/flask_socketio/test_client.py diff --git a/test_socketio.py b/test_socketio.py index d58c59a..2194e8b 100755 --- a/test_socketio.py +++ b/test_socketio.py @@ -1,9 +1,5 @@ import json import unittest -import coverage - -cov = coverage.coverage(branch=True) -cov.start() from flask import Flask, session, request, json as flask_json from flask_socketio import SocketIO, send, emit, join_room, leave_room, \ @@ -270,8 +266,7 @@ class TestSocketIO(unittest.TestCase): @classmethod def tearDownClass(cls): - cov.stop() - cov.report(include='flask_socketio/*', show_missing=True) + pass def setUp(self): pass diff --git a/tox.ini b/tox.ini index c396556..48ab25d 100644 --- a/tox.ini +++ b/tox.ini @@ -12,14 +12,17 @@ python = [testenv] commands= - python setup.py test + pip install -e . + pytest -p no:logging --cov=flask_socketio --cov-branch --cov-report=term-missing +deps= + pytest + pytest-cov [testenv:flake8] -deps= - six - flake8 commands= - flake8 --exclude=".*" --ignore=W503,E402,E722 flask_socketio test_socketio.py + flake8 --exclude=".*" --ignore=W503,E402,E722 src/flask_socketio test_socketio.py +deps= + flake8 [testenv:docs] changedir=docs