From ac9ed03290ea2882530e5dc0c0c51e7bae4bd342 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Wed, 17 Apr 2019 19:56:25 -0700 Subject: [PATCH 01/20] Move tests out of package --- {rest_auth/tests => tests}/__init__.py | 0 {rest_auth/tests => tests}/django_urls.py | 0 {rest_auth/tests => tests}/mixins.py | 0 {rest_auth/tests => tests}/requirements.pip | 0 {rest_auth/tests => tests}/settings.py | 0 {rest_auth/tests => tests}/test_api.py | 0 {rest_auth/tests => tests}/test_social.py | 0 {rest_auth/tests => tests}/urls.py | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename {rest_auth/tests => tests}/__init__.py (100%) rename {rest_auth/tests => tests}/django_urls.py (100%) rename {rest_auth/tests => tests}/mixins.py (100%) rename {rest_auth/tests => tests}/requirements.pip (100%) rename {rest_auth/tests => tests}/settings.py (100%) rename {rest_auth/tests => tests}/test_api.py (100%) rename {rest_auth/tests => tests}/test_social.py (100%) rename {rest_auth/tests => tests}/urls.py (100%) diff --git a/rest_auth/tests/__init__.py b/tests/__init__.py similarity index 100% rename from rest_auth/tests/__init__.py rename to tests/__init__.py diff --git a/rest_auth/tests/django_urls.py b/tests/django_urls.py similarity index 100% rename from rest_auth/tests/django_urls.py rename to tests/django_urls.py diff --git a/rest_auth/tests/mixins.py b/tests/mixins.py similarity index 100% rename from rest_auth/tests/mixins.py rename to tests/mixins.py diff --git a/rest_auth/tests/requirements.pip b/tests/requirements.pip similarity index 100% rename from rest_auth/tests/requirements.pip rename to tests/requirements.pip diff --git a/rest_auth/tests/settings.py b/tests/settings.py similarity index 100% rename from rest_auth/tests/settings.py rename to tests/settings.py diff --git a/rest_auth/tests/test_api.py b/tests/test_api.py similarity index 100% rename from rest_auth/tests/test_api.py rename to tests/test_api.py diff --git a/rest_auth/tests/test_social.py b/tests/test_social.py similarity index 100% rename from rest_auth/tests/test_social.py rename to tests/test_social.py diff --git a/rest_auth/tests/urls.py b/tests/urls.py similarity index 100% rename from rest_auth/tests/urls.py rename to tests/urls.py From 3aa39bfd30db01786167d7abc7358324dcea6a5f Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Wed, 17 Apr 2019 19:56:52 -0700 Subject: [PATCH 02/20] Remove old settings/compat --- tests/settings.py | 51 ++++++++++------------------------------------- 1 file changed, 11 insertions(+), 40 deletions(-) diff --git a/tests/settings.py b/tests/settings.py index e353fb0..4e6ee25 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -1,23 +1,3 @@ -import os -import sys - -PROJECT_ROOT = os.path.abspath(os.path.split(os.path.split(__file__)[0])[0]) - -ROOT_URLCONF = 'urls' -STATIC_URL = '/static/' -STATIC_ROOT = '%s/staticserve' % PROJECT_ROOT -STATICFILES_DIRS = ( - ('global', '%s/static' % PROJECT_ROOT), -) -UPLOADS_DIR_NAME = 'uploads' -MEDIA_URL = '/%s/' % UPLOADS_DIR_NAME -MEDIA_ROOT = os.path.join(PROJECT_ROOT, '%s' % UPLOADS_DIR_NAME) - -IS_DEV = False -IS_STAGING = False -IS_PROD = False -IS_TEST = 'test' in sys.argv or 'test_coverage' in sys.argv - DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', @@ -33,31 +13,22 @@ MIDDLEWARE = [ 'django.contrib.messages.middleware.MessageMiddleware' ] -# Adding for backwards compatibility for Django 1.8 tests -MIDDLEWARE_CLASSES = MIDDLEWARE - -TEMPLATE_CONTEXT_PROCESSORS = [ - 'django.contrib.auth.context_processors.auth', - 'django.core.context_processors.debug', - 'django.core.context_processors.media', - 'django.core.context_processors.request', - 'django.contrib.messages.context_processors.messages', - 'django.core.context_processors.static', - - "allauth.account.context_processors.account", - "allauth.socialaccount.context_processors.socialaccount", -] - -# avoid deprecation warnings during tests TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [ - # insert your TEMPLATE_DIRS here - ], 'APP_DIRS': True, 'OPTIONS': { - 'context_processors': TEMPLATE_CONTEXT_PROCESSORS, + 'context_processors': [ + 'django.contrib.auth.context_processors.auth', + 'django.core.context_processors.debug', + 'django.core.context_processors.media', + 'django.core.context_processors.request', + 'django.contrib.messages.context_processors.messages', + 'django.core.context_processors.static', + + "allauth.account.context_processors.account", + "allauth.socialaccount.context_processors.socialaccount", + ], }, }, ] From 737c0102ad56dbede67f0aced19b858e32fe0d66 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Wed, 17 Apr 2019 20:02:35 -0700 Subject: [PATCH 03/20] Use standard management file instead of runtests --- manage.py | 22 ++++++++++++++++++++++ runtests.py | 24 ------------------------ 2 files changed, 22 insertions(+), 24 deletions(-) create mode 100644 manage.py delete mode 100644 runtests.py diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..38a919f --- /dev/null +++ b/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings") + try: + from django.core.management import execute_from_command_line + except ImportError: + # The above import may fail for some other reason. Ensure that the + # issue is really that Django is missing to avoid masking other + # exceptions on Python 2. + try: + import django + except ImportError: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) + raise + execute_from_command_line(sys.argv) diff --git a/runtests.py b/runtests.py deleted file mode 100644 index 8b7ede2..0000000 --- a/runtests.py +++ /dev/null @@ -1,24 +0,0 @@ -# This file mainly exists to allow python setup.py test to work. -# flake8: noqa -import os -import sys - -os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' -test_dir = os.path.join(os.path.dirname(__file__), 'rest_auth') -sys.path.insert(0, test_dir) - -import django -from django.test.utils import get_runner -from django.conf import settings - - -def runtests(): - TestRunner = get_runner(settings) - test_runner = TestRunner(verbosity=1, interactive=True) - if hasattr(django, 'setup'): - django.setup() - failures = test_runner.run_tests(['rest_auth']) - sys.exit(bool(failures)) - -if __name__ == '__main__': - runtests() From 33c9bbd24db66ae16f1f59196f9cc261ee1ae52e Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Wed, 17 Apr 2019 20:18:29 -0700 Subject: [PATCH 04/20] Add tox config --- setup.py | 6 ------ tests/requirements.pip | 5 ----- tox.ini | 27 +++++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 11 deletions(-) delete mode 100644 tests/requirements.pip create mode 100644 tox.ini diff --git a/setup.py b/setup.py index 675b99d..30fbe9f 100644 --- a/setup.py +++ b/setup.py @@ -29,12 +29,6 @@ setup( extras_require={ 'with_social': ['django-allauth>=0.25.0'], }, - tests_require=[ - 'responses>=0.5.0', - 'django-allauth>=0.25.0', - 'djangorestframework-jwt>=1.9.0', - ], - test_suite='runtests.runtests', include_package_data=True, classifiers=[ 'Framework :: Django', diff --git a/tests/requirements.pip b/tests/requirements.pip deleted file mode 100644 index f48ee3c..0000000 --- a/tests/requirements.pip +++ /dev/null @@ -1,5 +0,0 @@ -django-allauth>=0.25.0 -responses>=0.3.0 -flake8==2.4.0 -djangorestframework-jwt>=1.7.2 -djangorestframework>=3.6.4 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..af016ab --- /dev/null +++ b/tox.ini @@ -0,0 +1,27 @@ +[tox] +envlist = + py{27,35,36}-django111-drf{38,39}, + py{35,36,37}-django20-drf{38,39}, + lint, + +[testenv] +commands = coverage run --parallel-mode manage.py test +usedevelop = True +setenv = + PYTHONDONTWRITEBYTECODE=1 +deps = + django111: Django ~= 1.11.0 + django20: Django ~= 2.0.0 + drf38: djangorestframework ~= 3.8.0 + drf39: djangorestframework ~= 3.9.0 + djangorestframework-jwt >= 1.9.0 + django-allauth >= 0.25.0 + responses >= 0.5.0 + coverage + +parallel_show_output = True + +[testenv:lint] +commands = flake8 rest_auth tests {posargs} +deps = + flake8 From ff84575827ab9013af6881f8f443e8e3e9f49aa5 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Wed, 17 Apr 2019 20:25:30 -0700 Subject: [PATCH 05/20] Remove 'six' dependency --- rest_auth/utils.py | 2 +- setup.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/rest_auth/utils.py b/rest_auth/utils.py index 800f184..764edb9 100644 --- a/rest_auth/utils.py +++ b/rest_auth/utils.py @@ -1,4 +1,4 @@ -from six import string_types +from django.utils.six import string_types from importlib import import_module diff --git a/setup.py b/setup.py index 30fbe9f..1e65a7d 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,6 @@ setup( install_requires=[ 'Django>=1.8.0', 'djangorestframework>=3.1.3', - 'six>=1.9.0', ], extras_require={ 'with_social': ['django-allauth>=0.25.0'], From 43d3fd6fbc6006efdf1e02a08224c5e895edccdc Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Wed, 17 Apr 2019 20:46:21 -0700 Subject: [PATCH 06/20] Update flake/coverage conf --- setup.cfg | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/setup.cfg b/setup.cfg index 8d915a7..714c8aa 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,33 +7,13 @@ license_file = LICENSE [flake8] -max-line-length = 120 -exclude = docs/*,demo/* -ignore = F403 +max_line_length = 120 +exclude = migrations [coverage:run] -omit=*site-packages*,*distutils*,*migrations* - -[coverage:report] -# Regexes for lines to exclude from consideration -exclude_lines = - # Have to re-enable the standard pragma - pragma: no cover - - # Don't complain about missing debug-only code: - def __repr__ - if self\.debug - - # Don't complain if tests don't hit defensive assertion code: - raise AssertionError - raise NotImplementedError - - # Don't complain if non-runnable code isn't run: - if 0: - if __name__ == .__main__.: - -ignore_errors = True - -[coverage:html] -directory = coverage_html +branch = true +source = rest_auth +omit = + *migrations* + tests From ca222d7f929dc05d46fa4249262f9c25b6989df3 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Wed, 17 Apr 2019 20:46:45 -0700 Subject: [PATCH 07/20] Add McCabe complexity checker --- rest_auth/registration/serializers.py | 2 +- rest_auth/serializers.py | 2 +- setup.cfg | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rest_auth/registration/serializers.py b/rest_auth/registration/serializers.py index 4f99c18..d62d701 100644 --- a/rest_auth/registration/serializers.py +++ b/rest_auth/registration/serializers.py @@ -58,7 +58,7 @@ class SocialLoginSerializer(serializers.Serializer): social_login.token = token return social_login - def validate(self, attrs): + def validate(self, attrs): # noqa: C901 view = self.context.get('view') request = self._get_request() diff --git a/rest_auth/serializers.py b/rest_auth/serializers.py index b645231..33bbfde 100644 --- a/rest_auth/serializers.py +++ b/rest_auth/serializers.py @@ -59,7 +59,7 @@ class LoginSerializer(serializers.Serializer): return user - def validate(self, attrs): + def validate(self, attrs): # noqa: C901 username = attrs.get('username') email = attrs.get('email') password = attrs.get('password') diff --git a/setup.cfg b/setup.cfg index 714c8aa..97b1620 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,6 +8,7 @@ license_file = LICENSE [flake8] max_line_length = 120 +max_complexity = 10 exclude = migrations From 555a510b58d37f9ccba3f3ef2ee80eda4a59b3c3 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Fri, 19 Apr 2019 10:45:46 -0700 Subject: [PATCH 08/20] Update trove classifiers --- setup.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/setup.py b/setup.py index 1e65a7d..fbb1d70 100644 --- a/setup.py +++ b/setup.py @@ -30,10 +30,21 @@ setup( }, include_package_data=True, classifiers=[ + 'Development Status :: 4 - Beta', 'Framework :: Django', + 'Framework :: Django :: 1.11', + 'Framework :: Django :: 2.0', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Topic :: Software Development' ], ) From 8e5390c6bb9e059646245ed325473db2dba944cc Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Fri, 19 Apr 2019 10:48:59 -0700 Subject: [PATCH 09/20] Move package metadata to setup.cfg --- setup.cfg | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---- setup.py | 49 ++----------------------------------------------- 2 files changed, 50 insertions(+), 51 deletions(-) diff --git a/setup.cfg b/setup.cfg index 97b1620..967603d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,10 +2,6 @@ universal = 1 -[metadata] -license_file = LICENSE - - [flake8] max_line_length = 120 max_complexity = 10 @@ -18,3 +14,51 @@ source = rest_auth omit = *migrations* tests + + +[metadata] +name = django-rest-auth +version = 0.9.5 +keywords = django, rest, auth, registration, rest-framework, django-registration, api +description = Create a set of REST API endpoints for Authentication and Registration +long_description = file: README.rst +license = MIT +license_file = LICENSE + +author = Sumit Chachra +author_email = chachra@tivix.com +url = http://github.com/Tivix/django-rest-auth + +classifiers = + Development Status :: 4 - Beta + Framework :: Django + Framework :: Django :: 1.11 + Framework :: Django :: 2.0 + Intended Audience :: Developers + Intended Audience :: System Administrators + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Topic :: Software Development + +[options] +zip_safe = False +include_package_data = True +packages = find: +install_requires = + Django >= 1.8.0 + djangorestframework >= 3.1.3 + +[options.extras_require] +with_social = + django-allauth >= 0.25.0 + +[options.packages.find] +exclude = + tests diff --git a/setup.py b/setup.py index fbb1d70..2598061 100644 --- a/setup.py +++ b/setup.py @@ -1,50 +1,5 @@ #!/usr/bin/env python - -import os -from setuptools import setup, find_packages +from setuptools import setup -here = os.path.dirname(os.path.abspath(__file__)) -f = open(os.path.join(here, 'README.rst')) -long_description = f.read().strip() -f.close() - - -setup( - name='django-rest-auth', - version='0.9.5', - author='Sumit Chachra', - author_email='chachra@tivix.com', - url='http://github.com/Tivix/django-rest-auth', - description='Create a set of REST API endpoints for Authentication and Registration', - packages=find_packages(), - long_description=long_description, - keywords='django rest auth registration rest-framework django-registration api', - zip_safe=False, - install_requires=[ - 'Django>=1.8.0', - 'djangorestframework>=3.1.3', - ], - extras_require={ - 'with_social': ['django-allauth>=0.25.0'], - }, - include_package_data=True, - classifiers=[ - 'Development Status :: 4 - Beta', - 'Framework :: Django', - 'Framework :: Django :: 1.11', - 'Framework :: Django :: 2.0', - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Topic :: Software Development' - ], -) +setup() From af11ed5337b549f6b80bcabc13d17d9957def2e3 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Fri, 19 Apr 2019 11:46:17 -0700 Subject: [PATCH 10/20] Update sdist file manifest --- MANIFEST.in | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 01a589f..1918442 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,11 @@ include AUTHORS include LICENSE -include MANIFEST.in -include README.md +include README.rst graft rest_auth + +include tox.ini +include manage.py +recursive-include tests *.py +recursive-include demo * +recursive-include docs * +prune docs/_build From 0b592d4072b0b254fb7a711133fd2152a4c057f1 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Fri, 19 Apr 2019 11:47:03 -0700 Subject: [PATCH 11/20] Add CircleCI conf, remote Travis CI conf --- .circleci/config.yml | 98 ++++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 26 ------------ 2 files changed, 98 insertions(+), 26 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 .travis.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..5392bb3 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,98 @@ +version: 2.1 + +aliases: + - &environ + run: + name: setup virtual environment + # The below ensures the venv is activated for every subsequent step + command: | + virtualenv venv + echo "source /home/circleci/project/venv/bin/activate" >> $BASH_ENV + + - &install + run: + name: install dependencies + command: | + pip install -U pip setuptools wheel tox tox-factor coveralls + + - &test-steps + steps: + - checkout + - *environ + - *install + - run: tox + - run: coverage combine + - run: coverage report + - run: coveralls + +jobs: + lint: + steps: + - checkout + - *environ + - *install + - run: tox -e lint + docker: + - image: circleci/python:3.7 + + test-py37: + <<: *test-steps + docker: + - image: circleci/python:3.7 + environment: + TOXFACTOR: py37 + + test-py36: + <<: *test-steps + docker: + - image: circleci/python:3.6 + environment: + TOXFACTOR: py36 + + test-py35: + <<: *test-steps + docker: + - image: circleci/python:3.5 + environment: + TOXFACTOR: py35 + + test-py27: + <<: *test-steps + docker: + - image: circleci/python:2.7 + environment: + TOXFACTOR: py27 + + +workflows: + version: 2 + commit: &test-workflow + jobs: + - lint + + - test-py37: + requires: + - lint + + - test-py36: + requires: + - lint + + - test-py35: + requires: + - lint + + - test-py27: + requires: + - lint + + weekly: + <<: *test-workflow + triggers: + - schedule: + # 8/9 AM PST/PDT every Monday + cron: "0 16 * * 1" + filters: + branches: + only: + - master diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b059c1e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: python -python: - - "2.7" - - "3.5" - - "3.6" -env: - - DJANGO=1.11.* DRF=3.7.* - - DJANGO=1.11.* DRF=3.8.* - - DJANGO=2.0.* DRF=3.7.* - - DJANGO=2.0.* DRF=3.8.* -install: - - pip install -q Django==$DJANGO djangorestframework==$DRF - - pip install coveralls - - pip install -r rest_auth/tests/requirements.pip -script: - - coverage run --source=rest_auth setup.py test -after_success: - - coveralls -before_script: - - flake8 . --config=flake8 -matrix: - exclude: - - python: "2.7" - env: DJANGO=2.0.* DRF=3.7.* - - python: "2.7" - env: DJANGO=2.0.* DRF=3.8.* From 0f8c2a851a94e27bcd734253cbc707f8fab4b8b0 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Fri, 19 Apr 2019 16:48:32 -0700 Subject: [PATCH 12/20] coveralls => codecov --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5392bb3..3b22d9b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,7 +13,7 @@ aliases: run: name: install dependencies command: | - pip install -U pip setuptools wheel tox tox-factor coveralls + pip install -U pip setuptools wheel tox tox-factor codecov - &test-steps steps: @@ -23,7 +23,7 @@ aliases: - run: tox - run: coverage combine - run: coverage report - - run: coveralls + - run: codecov jobs: lint: From 986ad2b1a19d25e603dd84191957e5224cbfe8dc Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Fri, 19 Apr 2019 16:56:51 -0700 Subject: [PATCH 13/20] Simplify codecov comment --- codecov.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..5de63f9 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,2 @@ +comment: + layout: "reach" From 33d7b5744bbd9f0ef999bab76f78ebfd20d0de11 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Fri, 19 Apr 2019 17:22:00 -0700 Subject: [PATCH 14/20] Maybe fix coverage reporting w/ codecov --- setup.cfg | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 967603d..bed685e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,7 +10,11 @@ exclude = migrations [coverage:run] branch = true -source = rest_auth +source = . +include = rest_auth/* + +[coverage:report] +include = rest_auth/* omit = *migrations* tests From d447c8a730c604717a7a29c54aa408f4644ca200 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Fri, 19 Apr 2019 17:48:10 -0700 Subject: [PATCH 15/20] Update CI, add PyPI version/license, badges --- README.rst | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index ac7f19e..176fc55 100644 --- a/README.rst +++ b/README.rst @@ -1,17 +1,22 @@ Welcome to django-rest-auth =========================== -.. image:: https://travis-ci.org/Tivix/django-rest-auth.svg - :target: https://travis-ci.org/Tivix/django-rest-auth +.. image:: https://circleci.com/gh/Tivix/django-rest-auth.svg?style=shield + :target: https://circleci.com/gh/Tivix/django-rest-auth -.. image:: https://coveralls.io/repos/Tivix/django-rest-auth/badge.svg - :target: https://coveralls.io/r/Tivix/django-rest-auth?branch=master +.. image:: https://codecov.io/gh/Tivix/django-rest-auth/branch/master/graph/badge.svg + :target: https://codecov.io/gh/Tivix/django-rest-auth .. image:: https://readthedocs.org/projects/django-rest-auth/badge/?version=latest - :target: https://readthedocs.org/projects/django-rest-auth/?badge=latest + :target: https://readthedocs.org/projects/django-rest-auth/?badge=latest +.. image:: https://img.shields.io/pypi/v/django-rest-auth.svg + :target: https://pypi.python.org/pypi/django-rest-auth + +.. image:: https://img.shields.io/pypi/l/django-rest-auth.svg + :target: https://pypi.python.org/pypi/django-rest-auth Django-rest-auth provides a set of REST API endpoints for Authentication and Registration From c7a35459296b7a37455dbece1b514c8a6a49a0f1 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Mon, 22 Apr 2019 13:27:09 -0700 Subject: [PATCH 16/20] Update auth views There are a few changes from FBVs to CBVs - Some of the redirect arguments are now `success_url` - `is_admin_site` looks like it's functionally a noop, with no replacement argument. --- tests/django_urls.py | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/tests/django_urls.py b/tests/django_urls.py index c1fb050..559c753 100644 --- a/tests/django_urls.py +++ b/tests/django_urls.py @@ -8,23 +8,21 @@ from django.contrib.auth.urls import urlpatterns # special urls for auth test cases urlpatterns += [ - url(r'^logout/custom_query/$', views.logout, dict(redirect_field_name='follow')), - url(r'^logout/next_page/$', views.logout, dict(next_page='/somewhere/')), - url(r'^logout/next_page/named/$', views.logout, dict(next_page='password_reset')), - url(r'^password_reset_from_email/$', views.password_reset, dict(from_email='staffmember@example.com')), - url(r'^password_reset/custom_redirect/$', views.password_reset, dict(post_reset_redirect='/custom/')), - url(r'^password_reset/custom_redirect/named/$', views.password_reset, dict(post_reset_redirect='password_reset')), - url(r'^password_reset/html_email_template/$', views.password_reset, - dict(html_email_template_name='registration/html_password_reset_email.html')), + url(r'^logout/custom_query/$', views.LogoutView.as_view(redirect_field_name='follow')), + url(r'^logout/next_page/$', views.LogoutView.as_view(next_page='/somewhere/')), + url(r'^logout/next_page/named/$', views.LogoutView.as_view(next_page='password_reset')), + url(r'^password_reset_from_email/$', views.PasswordResetView.as_view(from_email='staffmember@example.com')), + url(r'^password_reset/custom_redirect/$', views.PasswordResetView.as_view(success_url='/custom/')), + url(r'^password_reset/custom_redirect/named/$', views.PasswordResetView.as_view(success_url='password_reset')), + url(r'^password_reset/html_email_template/$', views.PasswordResetView.as_view( + html_email_template_name='registration/html_password_reset_email.html')), url(r'^reset/custom/(?P[0-9A-Za-z_\-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', - views.password_reset_confirm, - dict(post_reset_redirect='/custom/')), + views.PasswordResetConfirmView.as_view(success_url='/custom/')), url(r'^reset/custom/named/(?P[0-9A-Za-z_\-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', - views.password_reset_confirm, - dict(post_reset_redirect='password_reset')), - url(r'^password_change/custom/$', views.password_change, dict(post_change_redirect='/custom/')), - url(r'^password_change/custom/named/$', views.password_change, dict(post_change_redirect='password_reset')), - url(r'^admin_password_reset/$', views.password_reset, dict(is_admin_site=True)), - url(r'^login_required/$', login_required(views.password_reset)), - url(r'^login_required_login_url/$', login_required(views.password_reset, login_url='/somewhere/')), + views.PasswordResetConfirmView.as_view(success_url='password_reset')), + url(r'^password_change/custom/$', views.PasswordChangeView.as_view(success_url='/custom/')), + url(r'^password_change/custom/named/$', views.PasswordChangeView.as_view(success_url='password_reset')), + url(r'^admin_password_reset/$', views.PasswordResetView.as_view()), + url(r'^login_required/$', login_required(views.PasswordResetView.as_view())), + url(r'^login_required_login_url/$', login_required(views.PasswordResetView.as_view(), login_url='/somewhere/')), ] From 10edbba8b27ad317a4f0b3436a31ccc5b9068791 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Mon, 22 Apr 2019 13:34:12 -0700 Subject: [PATCH 17/20] Add Django 2.1 & 2.2 to test matrix --- tests/settings.py | 1 + tox.ini | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/tests/settings.py b/tests/settings.py index 4e6ee25..3f22fee 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -46,6 +46,7 @@ INSTALLED_APPS = [ 'django.contrib.humanize', 'django.contrib.contenttypes', 'django.contrib.sessions', + 'django.contrib.messages', 'django.contrib.sites', 'django.contrib.sitemaps', 'django.contrib.staticfiles', diff --git a/tox.ini b/tox.ini index af016ab..53d7a19 100644 --- a/tox.ini +++ b/tox.ini @@ -2,6 +2,8 @@ envlist = py{27,35,36}-django111-drf{38,39}, py{35,36,37}-django20-drf{38,39}, + py{35,36,37}-django21-drf{38,39}, + py{35,36,37}-django22-drf{38,39}, lint, [testenv] @@ -12,6 +14,8 @@ setenv = deps = django111: Django ~= 1.11.0 django20: Django ~= 2.0.0 + django21: Django ~= 2.1.0 + django22: Django ~= 2.2.0 drf38: djangorestframework ~= 3.8.0 drf39: djangorestframework ~= 3.9.0 djangorestframework-jwt >= 1.9.0 From a9a4fec607f98007c39798ca9a0b16165f1d7932 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Mon, 22 Apr 2019 13:34:28 -0700 Subject: [PATCH 18/20] Add positional args to test command --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 53d7a19..a212b74 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,7 @@ envlist = lint, [testenv] -commands = coverage run --parallel-mode manage.py test +commands = coverage run --parallel-mode manage.py test {posargs} usedevelop = True setenv = PYTHONDONTWRITEBYTECODE=1 From e77ff5cd3ef372eccac6f8a3bc1401acdd12287f Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Mon, 22 Apr 2019 13:35:38 -0700 Subject: [PATCH 19/20] Use verbose output in CI --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3b22d9b..e932ebc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,7 +20,7 @@ aliases: - checkout - *environ - *install - - run: tox + - run: tox -- -v 2 - run: coverage combine - run: coverage report - run: codecov From 1b6b0459b0804df07a9704bf7399e53078dab6d7 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Mon, 22 Apr 2019 13:42:07 -0700 Subject: [PATCH 20/20] Update PyPI trove classifiers --- setup.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.cfg b/setup.cfg index bed685e..90bb081 100644 --- a/setup.cfg +++ b/setup.cfg @@ -38,6 +38,8 @@ classifiers = Framework :: Django Framework :: Django :: 1.11 Framework :: Django :: 2.0 + Framework :: Django :: 2.1 + Framework :: Django :: 2.2 Intended Audience :: Developers Intended Audience :: System Administrators License :: OSI Approved :: BSD License