diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 29662a4a..07dcbbf0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,6 +15,7 @@ repos: hooks: - id: black language_version: python3.6 + exclude: ^docs/ - repo: https://gitlab.com/pycqa/flake8 rev: 3.7.9 hooks: diff --git a/.travis.yml b/.travis.yml index 08e4e418..534258dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,25 +9,17 @@ python: - '3.8' - pypy3 -matrix: +jobs: include: - - name: "lint" - python: 3.7 - env: - - TEST_CMD="pre-commit run --all-files" - - name: "3.6" + - language: python python: 3.6 - - name: "3.7" - python: 3.7 - - name: "3.8" - python: 3.8 - - name: "pypy3" - python: pypy3 + name: "linting" + script: + - tox -e lint env: - MONGOENGINE=latest_pip - MONGOENGINE=dev - - TEST_CMD="tox -e $(echo py$TRAVIS_PYTHON_VERSION-me_$MONGOENGINE | tr -d . | sed -e 's/pypypy/pypy/') -- --with-coverage" services: - mongodb @@ -38,13 +30,12 @@ install: - travis_retry pip install flake8 - travis_retry pip install tox>=3.14 - travis_retry pip install virtualenv - - travis_retry pip install pre-commit # Cache dependencies installed via pip cache: pip script: - - $TEST_CMD + - tox -e $(echo py$TRAVIS_PYTHON_VERSION-me_$MONGOENGINE | tr -d . | sed -e 's/pypypy/pypy/') -- --with-coverage after_success: - coveralls --verbose @@ -75,5 +66,5 @@ deploy: on: tags: true condition: "$MONGOENGINE = dev" - python: 3.6 + python: 3.5 repo: MongoEngine/flask-mongoengine diff --git a/docs/changelog.rst b/docs/changelog.rst index be143c83..504d9561 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,12 +4,17 @@ Changelog Development =========== -- BREAKING CHANGE: Dropped Python v2.6, v2.7, v3.2, v3.3, v3.4 (#355) -- BREAKING CHANGE: Added tests support for python versions: v3.5, v3.6, v3.7, v3.8 (#355) +- BREAKING CHANGE: Dropped Python v2.6, v2.7, v3.2, v3.3, + v3.4, v3.5 (#355, #366) +- BREAKING CHANGE: Added tests support for python versions: + v3.6, v3.7, v3.8 (#355, #366) - BREAKING CHANGE: Minimum Flask version set to v1.1 (#355) - BREAKING CHANGE: Minimum Flask-WTF version set to v0.14 (#355) - BREAKING CHANGE: Minimum mongoengine version set to v0.19 (#355) - BREAKING CHANGE: Minimum mongodb version set to v4.0 (#355) +- CHANGED: Code reformatted with black, pre-commit implemented + in project and CI/CD (#366) +- CHANGED: Developers dependencies extracted to separate file (#367) - CHANGED: Internal test engine switched from nose to pytest (#357) - DROPPED: Internal check with flake8-import-order dropped, as not compatible with modern editors (#358) @@ -18,7 +23,8 @@ Development - UPDATED: `get_or_404` will raise 404 error only on `DoesNotExist` exception, other exceptions should be captured by user. (#360) -Tests and development for old packages versions dropped to minimize tests footprint. +Tests and development for old packages versions dropped to minimize tests +footprint. Use version 0.9.5 if old dependencies required. @@ -26,7 +32,8 @@ Changes in 0.9.1 ================ - Fixed setup.py for various platforms (#298). - Added Flask-WTF v0.14 support (#294). -- MongoEngine instance now holds a reference to a particular Flask app it was initialized with (#261). +- MongoEngine instance now holds a reference to a particular Flask app it was + initialized with (#261). Changes in 0.9.0 ================ @@ -65,7 +72,8 @@ Changes in 0.8 - Various bugfixes, code cleanup and documentation improvements - Move from deprecated flask.ext.* to flask_* syntax in imports - Added independent connection handler for FlaskMongoEngine -- All MongoEngine connection calls are proxied via FlaskMongoEngine connection handler +- All MongoEngine connection calls are proxied via FlaskMongoEngine connection + handler - Added backward compatibility for settings key names - Added support for MongoMock and temporary test DB - Fixed issue with multiple DB support diff --git a/pyproject.toml b/pyproject.toml index 46e6c7aa..0922d8b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,4 +14,4 @@ exclude = ''' | build | dist )/ -''' \ No newline at end of file +''' diff --git a/setup.py b/setup.py index 503c4dea..640b0577 100644 --- a/setup.py +++ b/setup.py @@ -3,16 +3,18 @@ from setuptools import setup -description = ('Flask-MongoEngine is a Flask extension ' - 'that provides integration with MongoEngine and WTF model forms.') +description = ( + "Flask-MongoEngine is a Flask extension " + "that provides integration with MongoEngine and WTF model forms." +) # Load index.rst as long_description doc_path = os.path.join(os.path.dirname(__file__), "docs", "index.rst") -long_description = io.open(doc_path, encoding='utf-8').read() +long_description = io.open(doc_path, encoding="utf-8").read() # Stops exit traceback on tests try: - import multiprocessing # noqa + import multiprocessing # noqa except ImportError: pass @@ -21,54 +23,47 @@ def get_version(version_tuple): """Return the version tuple as a string, e.g. for (0, 10, 7), return '0.10.7'. """ - return '.'.join(map(str, version_tuple)) + return ".".join(map(str, version_tuple)) # Dirty hack to get version number from flask_monogengine/__init__.py - we # can't import it as it depends on PyMongo and PyMongo isn't installed until # this file is read -init = os.path.join(os.path.dirname(__file__), 'flask_mongoengine', '__init__.py') -version_line = list(filter(lambda l: l.startswith('VERSION'), open(init)))[0] -version = get_version(eval(version_line.split('=')[-1])) +init = os.path.join(os.path.dirname(__file__), "flask_mongoengine", "__init__.py") +version_line = list(filter(lambda l: l.startswith("VERSION"), open(init)))[0] +version = get_version(eval(version_line.split("=")[-1])) -test_requirements = ['coverage', 'nose', 'rednose'] +test_requirements = ["coverage", "nose", "rednose"] setup( - name='flask-mongoengine', + name="flask-mongoengine", version=version, - url='https://github.com/mongoengine/flask-mongoengine', - license='BSD', - author='Ross Lawley', - author_email='ross.lawley@gmail.com', - test_suite='nose.collector', + url="https://github.com/mongoengine/flask-mongoengine", + license="BSD", + author="Ross Lawley", + author_email="ross.lawley@gmail.com", + test_suite="nose.collector", zip_safe=False, - platforms='any', - install_requires=[ - 'Flask>=1.1', - 'Flask-WTF>=0.14', - 'mongoengine>=0.19', - 'six', - ], - packages=['flask_mongoengine', - 'flask_mongoengine.wtf'], + platforms="any", + install_requires=["Flask>=1.1", "Flask-WTF>=0.14", "mongoengine>=0.19", "six"], + packages=["flask_mongoengine", "flask_mongoengine.wtf"], include_package_data=True, tests_require=test_requirements, setup_requires=test_requirements, # Allow proper nose usage with setuptools and tox description=description, long_description=long_description, classifiers=[ - 'Development Status :: 4 - Beta', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', - 'Topic :: Software Development :: Libraries :: Python Modules' + "Development Status :: 4 - Beta", + "Environment :: Web Environment", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Topic :: Internet :: WWW/HTTP :: Dynamic Content", + "Topic :: Software Development :: Libraries :: Python Modules", ], ) diff --git a/tox.ini b/tox.ini index 00da017a..dbfcea47 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = {py36,py37,py38,pypy3}-{me_latest_pip,me_dev},flake8 +envlist = {py36,py37,py38,pypy3}-{me_latest_pip,me_dev},lint [testenv] commands = @@ -12,7 +12,8 @@ deps = pytest-cov nose -[testenv:flake8] -deps = flake8 +[testenv:lint] +deps = + pre-commit commands = - flake8 + python -m pre_commit run {posargs:--all}