Browse Source

Merge pull request #482 from flaskbb/update-dependencies

Use lower bounding on dependencies instead of pinning in setup.py
Alec Nikolas Reiter 7 years ago
parent
commit
114f5a8955
5 changed files with 122 additions and 131 deletions
  1. 1 18
      flaskbb/__init__.py
  2. 8 50
      flaskbb/extensions.py
  3. 3 3
      requirements-test.txt
  4. 17 17
      requirements.txt
  5. 93 43
      setup.py

+ 1 - 18
flaskbb/__init__.py

@@ -12,24 +12,7 @@
 __version__ = "2.0.1"
 __version__ = "2.0.1"
 
 
 import logging
 import logging
+
 logger = logging.getLogger(__name__)
 logger = logging.getLogger(__name__)
 
 
 from flaskbb.app import create_app  # noqa
 from flaskbb.app import create_app  # noqa
-
-
-# monkeypatch for https://github.com/wtforms/wtforms/issues/373 Taken from
-# https://github.com/indico/indico/commit/c79c562866e5efdbeb5a3101cccc97df57906f76
-def _patch_wtforms_sqlalchemy():
-    from ._compat import text_type
-    from wtforms.ext.sqlalchemy import fields
-    from sqlalchemy.orm.util import identity_key
-
-    def get_pk_from_identity(obj):
-        key = identity_key(instance=obj)[1]
-        return u':'.join(map(text_type, key))
-
-    fields.get_pk_from_identity = get_pk_from_identity
-
-
-_patch_wtforms_sqlalchemy()
-del _patch_wtforms_sqlalchemy

+ 8 - 50
flaskbb/extensions.py

@@ -8,9 +8,9 @@
     :copyright: (c) 2014 by the FlaskBB Team.
     :copyright: (c) 2014 by the FlaskBB Team.
     :license: BSD, see LICENSE for more details.
     :license: BSD, see LICENSE for more details.
 """
 """
-from inspect import isclass
-
 from celery import Celery
 from celery import Celery
+from sqlalchemy import MetaData
+
 from flask_alembic import Alembic
 from flask_alembic import Alembic
 from flask_allows import Allows
 from flask_allows import Allows
 from flask_babelplus import Babel
 from flask_babelplus import Babel
@@ -21,54 +21,12 @@ from flask_limiter.util import get_remote_address
 from flask_login import LoginManager
 from flask_login import LoginManager
 from flask_mail import Mail
 from flask_mail import Mail
 from flask_redis import FlaskRedis
 from flask_redis import FlaskRedis
-from flask_sqlalchemy import BaseQuery, SQLAlchemy
+from flask_sqlalchemy import SQLAlchemy
 from flask_themes2 import Themes
 from flask_themes2 import Themes
-from flask_whooshee import (DELETE_KWD, INSERT_KWD, UPDATE_KWD, Whooshee,
-                            WhoosheeQuery)
+from flask_whooshee import Whooshee
 from flask_wtf.csrf import CSRFProtect
 from flask_wtf.csrf import CSRFProtect
+
 from flaskbb.exceptions import AuthorizationRequired
 from flaskbb.exceptions import AuthorizationRequired
-from sqlalchemy import MetaData, event
-from sqlalchemy.orm import Query as SQLAQuery
-
-
-class FlaskBBWhooshee(Whooshee):
-
-    def register_whoosheer(self, wh):
-        """This will register the given whoosher on `whoosheers`, create the
-        neccessary SQLAlchemy event listeners, replace the `query_class` with
-        our own query class which will provide the search functionality
-        and store the app on the whoosheer, so that we can always work
-        with that.
-        :param wh: The whoosher which should be registered.
-        """
-        self.whoosheers.append(wh)
-        for model in wh.models:
-            event.listen(model, 'after_{0}'.format(INSERT_KWD), self.after_insert)  # noqa
-            event.listen(model, 'after_{0}'.format(UPDATE_KWD), self.after_update)  # noqa
-            event.listen(model, 'after_{0}'.format(DELETE_KWD), self.after_delete)  # noqa
-            query_class = getattr(model, 'query_class', None)
-
-            if query_class is not None and isclass(query_class):
-                # already a subclass, ignore it
-                if issubclass(query_class, self.query):
-                    pass
-
-                # ensure there can be a stable MRO
-                elif query_class not in (BaseQuery, SQLAQuery, WhoosheeQuery):
-                    query_class_name = query_class.__name__
-                    model.query_class = type(
-                        "Whooshee{}".format(query_class_name),
-                        (query_class, self.query),
-                        {}
-                    )
-                else:
-                    model.query_class = self.query
-            else:
-                model.query_class = self.query
-
-        if self.app:
-            wh.app = self.app
-        return wh
 
 
 
 
 # Permissions Manager
 # Permissions Manager
@@ -77,16 +35,16 @@ allows = Allows(throws=AuthorizationRequired)
 # Database
 # Database
 metadata = MetaData(
 metadata = MetaData(
     naming_convention={
     naming_convention={
-        "ix": 'ix_%(column_0_label)s',
+        "ix": "ix_%(column_0_label)s",
         "uq": "uq_%(table_name)s_%(column_0_name)s",
         "uq": "uq_%(table_name)s_%(column_0_name)s",
         "fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
         "fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
-        "pk": "pk_%(table_name)s"
+        "pk": "pk_%(table_name)s",
     }
     }
 )
 )
 db = SQLAlchemy(metadata=metadata)
 db = SQLAlchemy(metadata=metadata)
 
 
 # Whooshee (Full Text Search)
 # Whooshee (Full Text Search)
-whooshee = FlaskBBWhooshee()
+whooshee = Whooshee()
 
 
 # Login
 # Login
 login_manager = LoginManager()
 login_manager = LoginManager()

+ 3 - 3
requirements-test.txt

@@ -1,7 +1,7 @@
 -rrequirements.txt
 -rrequirements.txt
 -rrequirements-cov.txt
 -rrequirements-cov.txt
 flake8==3.5.0
 flake8==3.5.0
-pytest==3.5.0
-pytest-flake8==1.0.0
-pytest-mock==1.9.0
+pytest==3.6.2
+pytest-flake8==1.0.1
+pytest-mock==1.10.0
 freezegun==0.3.10
 freezegun==0.3.10

+ 17 - 17
requirements.txt

@@ -1,14 +1,14 @@
 alembic==0.9.9
 alembic==0.9.9
-amqp==2.1.4
-attrs==17.4.0
-Babel==2.5.3
-billiard==3.5.0.2
+amqp==2.3.2
+attrs==18.1.0
+Babel==2.6.0
+billiard==3.5.0.3
 blinker==1.4
 blinker==1.4
-celery==4.0.2
+celery==4.2.0
 certifi==2018.4.16
 certifi==2018.4.16
 chardet==3.0.4
 chardet==3.0.4
 click==6.7
 click==6.7
-click-log==0.2.1
+click-log==0.3.2
 enum34==1.1.6
 enum34==1.1.6
 Flask==1.0.2
 Flask==1.0.2
 Flask-Alembic==2.0.1
 Flask-Alembic==2.0.1
@@ -16,21 +16,21 @@ flask-allows==0.6.0
 Flask-BabelPlus==2.1.1
 Flask-BabelPlus==2.1.1
 Flask-Caching==1.4.0
 Flask-Caching==1.4.0
 Flask-DebugToolbar==0.10.1
 Flask-DebugToolbar==0.10.1
-flask-debugtoolbar-warnings>=0.1.0
+flask-debugtoolbar-warnings==0.1.0
 Flask-Limiter==1.0.1
 Flask-Limiter==1.0.1
 Flask-Login==0.4.1
 Flask-Login==0.4.1
 Flask-Mail==0.9.1
 Flask-Mail==0.9.1
 Flask-Redis==0.3.0
 Flask-Redis==0.3.0
 Flask-SQLAlchemy==2.3.2
 Flask-SQLAlchemy==2.3.2
 Flask-Themes2==0.1.4
 Flask-Themes2==0.1.4
-flask-whooshee==0.5.0
+flask-whooshee==0.6.0
 Flask-WTF==0.14.2
 Flask-WTF==0.14.2
-flaskbb-plugin-conversations==1.0.2
+flaskbb-plugin-conversations==1.0.3
 flaskbb-plugin-portal==1.1.1
 flaskbb-plugin-portal==1.1.1
-idna==2.6
+idna==2.7
 itsdangerous==0.24
 itsdangerous==0.24
 Jinja2==2.10
 Jinja2==2.10
-kombu==4.0.2
+kombu==4.2.1
 limits==1.3
 limits==1.3
 Mako==1.0.7
 Mako==1.0.7
 MarkupSafe==1.0
 MarkupSafe==1.0
@@ -39,20 +39,20 @@ olefile==0.45.1
 Pillow==5.1.0
 Pillow==5.1.0
 pluggy==0.6.0
 pluggy==0.6.0
 Pygments==2.2.0
 Pygments==2.2.0
-python-dateutil==2.7.2
+python-dateutil==2.7.3
 python-editor==1.0.3
 python-editor==1.0.3
 pytz==2018.4
 pytz==2018.4
 redis==2.10.6
 redis==2.10.6
-requests==2.18.4
-simplejson==3.14.0
+requests==2.19.1
+simplejson==3.15.0
 six==1.11.0
 six==1.11.0
 speaklater==1.3
 speaklater==1.3
-SQLAlchemy==1.2.7
+SQLAlchemy==1.2.8
 SQLAlchemy-Utils==0.33.3
 SQLAlchemy-Utils==0.33.3
 Unidecode==1.0.22
 Unidecode==1.0.22
-urllib3==1.22
+urllib3==1.23
 vine==1.1.4
 vine==1.1.4
 Werkzeug==0.14.1
 Werkzeug==0.14.1
 Whoosh==2.7.4
 Whoosh==2.7.4
-WTForms==2.1
+WTForms==2.2.1
 -e .
 -e .

+ 93 - 43
setup.py

@@ -9,7 +9,7 @@ from setuptools.command.test import test as TestCommand
 
 
 
 
 class PyTestCommand(TestCommand):
 class PyTestCommand(TestCommand):
-    user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]
+    user_options = [("pytest-args=", "a", "Arguments to pass to py.test")]
 
 
     def initialize_options(self):
     def initialize_options(self):
         TestCommand.initialize_options(self)
         TestCommand.initialize_options(self)
@@ -22,71 +22,121 @@ class PyTestCommand(TestCommand):
 
 
     def run_tests(self):
     def run_tests(self):
         import pytest  # noqa
         import pytest  # noqa
+
         errno = pytest.main(self.pytest_args)
         errno = pytest.main(self.pytest_args)
         sys.exit(errno)
         sys.exit(errno)
 
 
 
 
 def read(*parts):
 def read(*parts):
     here = os.path.abspath(os.path.dirname(__file__))
     here = os.path.abspath(os.path.dirname(__file__))
-    with open(os.path.join(here, *parts), 'r') as fp:
+    with open(os.path.join(here, *parts), "r") as fp:
         return fp.read()
         return fp.read()
 
 
 
 
-def get_requirements(e=None):
-    rf = "requirements.txt" if e is None else 'requirements-{}.txt'.format(e)
-    r = read(rf)
-    return [x.strip() for x in r.split('\n')
-            if not x.startswith('#') and not x.startswith("-e")]
-
-
 long_description = read("README.md")
 long_description = read("README.md")
-install_requires = get_requirements()
+install_requires = [
+    "alembic>=0.9.9",
+    "amqp>=2.3.2",
+    "attrs>=18.1.0",
+    "Babel>=2.6.0",
+    "billiard>=3.5.0.3",
+    "blinker>=1.4",
+    "celery>=4.2.0",
+    "certifi>=2018.4.16",
+    "chardet>=3.0.4",
+    "click>=6.7",
+    "click-log>=0.3.2",
+    "enum34>=1.1.6",
+    "Flask>=1.0.2",
+    "Flask-Alembic>=2.0.1",
+    "flask-allows>=0.6.0",
+    "Flask-BabelPlus>=2.1.1",
+    "Flask-Caching>=1.4.0",
+    "Flask-DebugToolbar>=0.10.1",
+    "flask-debugtoolbar-warnings>=0.1.0",
+    "Flask-Limiter>=1.0.1",
+    "Flask-Login>=0.4.1",
+    "Flask-Mail>=0.9.1",
+    "Flask-Redis>=0.3.0",
+    "Flask-SQLAlchemy>=2.3.2",
+    "Flask-Themes2>=0.1.4",
+    "flask-whooshee>=0.6.0",
+    "Flask-WTF>=0.14.2",
+    "flaskbb-plugin-conversations>=1.0.3",
+    "flaskbb-plugin-portal>=1.1.1",
+    "idna>=2.7",
+    "itsdangerous>=0.24",
+    "Jinja2>=2.10",
+    "kombu>=4.2.1",
+    "limits>=1.3",
+    "Mako>=1.0.7",
+    "MarkupSafe>=1.0",
+    "mistune>=0.8.3",
+    "olefile>=0.45.1",
+    "Pillow>=5.1.0",
+    "pluggy>=0.6.0",
+    "Pygments>=2.2.0",
+    "python-dateutil>=2.7.3",
+    "python-editor>=1.0.3",
+    "pytz>=2018.4",
+    "redis>=2.10.6",
+    "requests>=2.19.1",
+    "simplejson>=3.15.0",
+    "six>=1.11.0",
+    "speaklater>=1.3",
+    "SQLAlchemy>=1.2.8",
+    "SQLAlchemy-Utils>=0.33.3",
+    "Unidecode>=1.0.22",
+    "urllib3>=1.23",
+    "vine>=1.1.4",
+    "Werkzeug>=0.14.1",
+    "Whoosh>=2.7.4",
+    "WTForms>=2.2.1",
+]
 
 
+extras_require = {"postgres": ["psycopg2-binary"]}
+
+tests_require = ["py", "pytest", "pytest-cov", "cov-core", "coverage"]
 
 
 setup(
 setup(
-    name='FlaskBB',
+    name="FlaskBB",
     version="2.0.1",
     version="2.0.1",
-    url='https://flaskbb.org',
+    url="https://flaskbb.org",
     project_urls={
     project_urls={
-        'Documentation': 'https://flaskbb.readthedocs.io/en/latest/',
-        'Code': 'https://github.com/flaskbb/flaskbb',
-        'Issue Tracker': 'https://github.com/flaskbb/flaskbb',
+        "Documentation": "https://flaskbb.readthedocs.io/en/latest/",
+        "Code": "https://github.com/flaskbb/flaskbb",
+        "Issue Tracker": "https://github.com/flaskbb/flaskbb",
     },
     },
-    license='BSD',
-    author='Peter Justin',
-    author_email='peter.justin@outlook.com',
-    description='A classic Forum Software in Python using Flask.',
+    license="BSD",
+    author="Peter Justin",
+    author_email="peter.justin@outlook.com",
+    description="A classic Forum Software in Python using Flask.",
     long_description=long_description,
     long_description=long_description,
-    long_description_content_type='text/markdown',
+    long_description_content_type="text/markdown",
     packages=find_packages(),
     packages=find_packages(),
     include_package_data=True,
     include_package_data=True,
     zip_safe=False,
     zip_safe=False,
-    platforms='any',
-    entry_points='''
+    platforms="any",
+    entry_points="""
         [console_scripts]
         [console_scripts]
         flaskbb=flaskbb.cli:flaskbb
         flaskbb=flaskbb.cli:flaskbb
-    ''',
-    python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
+    """,
+    python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
     install_requires=install_requires,
     install_requires=install_requires,
-    tests_require=[
-        'py',
-        'pytest',
-        'pytest-cov',
-        'cov-core',
-        'coverage'
-    ],
-    test_suite='tests',
+    extras_require=extras_require,
+    tests_require=tests_require,
+    test_suite="tests",
     classifiers=[
     classifiers=[
-        'Development Status :: 4 - Beta',
-        'Environment :: Web Environment',
-        'Intended Audience :: Developers',
-        'Intended Audience :: End Users/Desktop',
-        'License :: OSI Approved :: BSD License',
-        'Operating System :: OS Independent',
-        'Programming Language :: Python',
-        'Programming Language :: Python :: 3',
-        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
-        'Topic :: Software Development :: Libraries :: Python Modules'
+        "Development Status :: 4 - Beta",
+        "Environment :: Web Environment",
+        "Intended Audience :: Developers",
+        "Intended Audience :: End Users/Desktop",
+        "License :: OSI Approved :: BSD License",
+        "Operating System :: OS Independent",
+        "Programming Language :: Python",
+        "Programming Language :: Python :: 3",
+        "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
+        "Topic :: Software Development :: Libraries :: Python Modules",
     ],
     ],
-    cmdclass={'test': PyTestCommand}
+    cmdclass={"test": PyTestCommand},
 )
 )