From 66366028b91295262f75e870cd961277b425e0d6 Mon Sep 17 00:00:00 2001 From: Mohammad Ahtasham ul Hassan <60315450+aht007@users.noreply.github.com> Date: Wed, 16 Feb 2022 15:04:21 +0500 Subject: [PATCH] chore: post django32 cleanup (#77) --- .github/workflows/ci.yml | 56 ++++++++++++++------------------ CHANGELOG.rst | 4 +++ Makefile | 2 ++ edx_name_affirmation/__init__.py | 2 +- edx_name_affirmation/signals.py | 2 +- edx_name_affirmation/urls.py | 29 +++++++---------- requirements/celery44.in | 1 + requirements/celery44.txt | 20 ++++++++++++ requirements/celery50.in | 1 + requirements/celery50.txt | 35 +++++++++++++++++++- test_urls.py | 4 +-- tox.ini | 44 ++++++++++++------------- 12 files changed, 124 insertions(+), 76 deletions(-) create mode 100644 requirements/celery44.in create mode 100644 requirements/celery44.txt create mode 100644 requirements/celery50.in diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 131f500..25f91e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,8 +5,6 @@ on: branches: - main pull_request: - branches: - - '**' jobs: run_tests: @@ -14,38 +12,32 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: - - ubuntu-20.04 - python-version: - - 3.8 - node-version: - - 10 - toxenv: - - django22 - - quality - - pii_check - - rst_validation + os: [ubuntu-20.04] + python-version: ["3.8"] + node-version: ["10"] + toxenv: [django32, django40, quality, pii_check, rst_validation] + steps: - - uses: actions/checkout@v1 - - name: Setup python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} + - uses: actions/checkout@v1 + - name: Setup python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} - - name: Install pip - run: pip install -r requirements/pip-tools.txt + - name: Install pip + run: pip install -r requirements/pip-tools.txt - - name: Install requirements - run: pip install -r requirements/ci.txt + - name: Install requirements + run: pip install -r requirements/ci.txt - - name: Run tests - env: - TOXENV: ${{ matrix.toxenv }} - run: tox + - name: Run tests + env: + TOXENV: ${{ matrix.toxenv }} + run: tox - - name: Run Coverage - if: matrix.toxenv == 'django22' - uses: codecov/codecov-action@v1 - with: - flags: unittests - fail_ci_if_error: true + - name: Run Coverage + if: matrix.toxenv == 'django32' + uses: codecov/codecov-action@v2 + with: + flags: unittests + fail_ci_if_error: true diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5f8a8e0..b39c647 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,6 +14,10 @@ Change Log Unreleased ~~~~~~~~~~ +[2.2.0] - 2022-02-14 +~~~~~~~~~~~~~~~~~~~~ +* Added Django40 testing and dropped Django22, 30 and 31 support + [2.1.0] - 2022-01-11 ~~~~~~~~~~~~~~~~~~~~ * Add optional `statuses_to_exclude` argument to `get_verified_name` in order to filter out one or diff --git a/Makefile b/Makefile index 2ac5b3d..64a949b 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,8 @@ upgrade: ## update the requirements/*.txt files with the latest packages satisfy $(PIP_COMPILE) -o requirements/quality.txt requirements/quality.in $(PIP_COMPILE) -o requirements/ci.txt requirements/ci.in $(PIP_COMPILE) -o requirements/dev.txt requirements/dev.in + $(PIP_COMPILE) -o requirements/celery44.txt requirements/celery44.in + $(PIP_COMPILE) -o requirements/celery50.txt requirements/celery50.in # Let tox control the Django version for tests sed '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp mv requirements/test.tmp requirements/test.txt diff --git a/edx_name_affirmation/__init__.py b/edx_name_affirmation/__init__.py index 5ae1f29..28b4bd5 100644 --- a/edx_name_affirmation/__init__.py +++ b/edx_name_affirmation/__init__.py @@ -2,6 +2,6 @@ Django app housing name affirmation logic. """ -__version__ = '2.1.0' +__version__ = '2.2.0' default_app_config = 'edx_name_affirmation.apps.EdxNameAffirmationConfig' # pylint: disable=invalid-name diff --git a/edx_name_affirmation/signals.py b/edx_name_affirmation/signals.py index 3b692fd..8b2bb38 100644 --- a/edx_name_affirmation/signals.py +++ b/edx_name_affirmation/signals.py @@ -4,4 +4,4 @@ from django.dispatch import Signal -VERIFIED_NAME_APPROVED = Signal(providing_args=['user_id', 'profile_name']) +VERIFIED_NAME_APPROVED = Signal() diff --git a/edx_name_affirmation/urls.py b/edx_name_affirmation/urls.py index 7bb5c78..6110365 100644 --- a/edx_name_affirmation/urls.py +++ b/edx_name_affirmation/urls.py @@ -1,30 +1,25 @@ """ URLs for edx_name_affirmation. """ -from django.conf.urls import include, url + +from django.urls import include, path from edx_name_affirmation import views app_name = 'edx_name_affirmation' urlpatterns = [ - url( - r'edx_name_affirmation/v1/verified_name$', - views.VerifiedNameView.as_view(), - name='verified_name' - ), + path('edx_name_affirmation/v1/verified_name', views.VerifiedNameView.as_view(), + name='verified_name' + ), - url( - r'edx_name_affirmation/v1/verified_name/history$', - views.VerifiedNameHistoryView.as_view(), - name='verified_name_history' - ), + path('edx_name_affirmation/v1/verified_name/history', views.VerifiedNameHistoryView.as_view(), + name='verified_name_history' + ), - url( - r'edx_name_affirmation/v1/verified_name/config$', - views.VerifiedNameConfigView.as_view(), - name='verified_name_config' - ), + path('edx_name_affirmation/v1/verified_name/config', views.VerifiedNameConfigView.as_view(), + name='verified_name_config' + ), - url(r'^', include('rest_framework.urls', namespace='rest_framework')), + path('', include('rest_framework.urls', namespace='rest_framework')), ] diff --git a/requirements/celery44.in b/requirements/celery44.in new file mode 100644 index 0000000..033b967 --- /dev/null +++ b/requirements/celery44.in @@ -0,0 +1 @@ +celery>=4.4,<4.5 diff --git a/requirements/celery44.txt b/requirements/celery44.txt new file mode 100644 index 0000000..c99cb5a --- /dev/null +++ b/requirements/celery44.txt @@ -0,0 +1,20 @@ +# +# This file is autogenerated by pip-compile with python 3.8 +# To update, run: +# +# pip-compile --output-file=requirements/celery44.txt requirements/celery44.in +# +amqp==2.6.1 + # via kombu +billiard==3.6.4.0 + # via celery +celery==4.4.7 + # via -r requirements/celery44.in +kombu==4.6.11 + # via celery +pytz==2021.3 + # via celery +vine==1.3.0 + # via + # amqp + # celery diff --git a/requirements/celery50.in b/requirements/celery50.in new file mode 100644 index 0000000..f971eab --- /dev/null +++ b/requirements/celery50.in @@ -0,0 +1 @@ +celery>=5.0,<6.0 diff --git a/requirements/celery50.txt b/requirements/celery50.txt index 7292ee6..d82aba7 100644 --- a/requirements/celery50.txt +++ b/requirements/celery50.txt @@ -1,9 +1,42 @@ +# +# This file is autogenerated by pip-compile with python 3.8 +# To update, run: +# +# pip-compile --output-file=requirements/celery50.txt requirements/celery50.in +# amqp==5.0.9 + # via kombu billiard==3.6.4.0 + # via celery celery==5.2.3 + # via -r requirements/celery50.in click==8.0.3 + # via + # celery + # click-didyoumean + # click-plugins + # click-repl click-didyoumean==0.3.0 + # via celery +click-plugins==1.1.1 + # via celery click-repl==0.2.0 + # via celery kombu==5.2.3 -prompt-toolkit==3.0.26 + # via celery +prompt-toolkit==3.0.28 + # via click-repl +pytz==2021.3 + # via celery +six==1.16.0 + # via click-repl vine==5.0.0 + # via + # amqp + # celery + # kombu +wcwidth==0.2.5 + # via prompt-toolkit + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/test_urls.py b/test_urls.py index 2f25d72..d0613c3 100644 --- a/test_urls.py +++ b/test_urls.py @@ -1,5 +1,5 @@ -from django.conf.urls import include, url +from django.urls import path, include urlpatterns = [ - url(r'^', include('edx_name_affirmation.urls', namespace='edx_name_affirmation')), + path('', include('edx_name_affirmation.urls', namespace='edx_name_affirmation')), ] diff --git a/tox.ini b/tox.ini index edfea0d..bdb7878 100644 --- a/tox.ini +++ b/tox.ini @@ -1,9 +1,8 @@ [tox] -envlist = py38-django{22,30}-celery{44,50}, quality, rst_validation, docs, pii_check +envlist = py38-django{32,40}-celery{44,50}, quality, rst_validation, docs, pii_check [doc8] -; D001 = Line too long -ignore=D001 +ignore = D001 [pycodestyle] exclude = .git,.tox,migrations @@ -35,34 +34,34 @@ addopts = --cov edx_name_affirmation --cov-report term-missing --cov-report xml norecursedirs = .* docs requirements site-packages [testenv] -deps = - django22: Django>=2.2,<2.3 - django30: Django>=3.0,<3.1 +deps = + django32: Django>=3.2,<4.0 + django40: Django>=4.0,<4.1 -r{toxinidir}/requirements/test.txt - celery44: celery>=4.0,<5.0 - celery50: -r{toxinidir}/requirements/celery50.txt -commands = + celery44: -r{toxinidir}/requirements/celery44.txt + celery50: -r{toxinidir}/requirements/celery50.txt +commands = python manage.py check pytest {posargs} [testenv:rst_validation] -whitelist_externals = +whitelist_externals = make -deps = +deps = -r{toxinidir}/requirements/quality.txt -commands = +commands = make quality-rst [testenv:docs] -setenv = +setenv = DJANGO_SETTINGS_MODULE = test_settings PYTHONPATH = {toxinidir} -whitelist_externals = +whitelist_externals = make rm -deps = +deps = -r{toxinidir}/requirements/doc.txt -commands = +commands = doc8 --ignore-path docs/_build README.rst docs rm -f docs/edx_name_affirmation.rst rm -f docs/modules.rst @@ -71,18 +70,19 @@ commands = python setup.py check --restructuredtext --strict [testenv:quality] -deps = +deps = -r{toxinidir}/requirements/quality.txt -r{toxinidir}/requirements/test.txt -commands = +commands = pylint edx_name_affirmation pycodestyle edx_name_affirmation - isort --check-only --diff --recursive edx_name_affirmation manage.py setup.py + isort --check-only --diff edx_name_affirmation manage.py setup.py [testenv:pii_check] -setenv = +setenv = DJANGO_SETTINGS_MODULE = test_settings -deps = +deps = -r{toxinidir}/requirements/quality.txt -commands = +commands = code_annotations django_find_annotations --config_file .pii_annotations.yml --lint --report --coverage +