From 8e6325a7b3296b001b2e977edc59cf35fe9d3175 Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Tue, 30 Apr 2024 20:25:26 +0100 Subject: [PATCH 1/8] Dropped support for Python 3.6 --- .github/workflows/build.yml | 2 +- docs/release_notes.rst | 7 +++++++ setup.py | 3 +-- tox.ini | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5805ed2..05c009a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: matrix: # Sync with tox.ini include: - - python-version: 3.6 + - python-version: 3.7 django-version: 2.2.19 - python-version: 3.7 django-version: 3.0.13 diff --git a/docs/release_notes.rst b/docs/release_notes.rst index 82461c7..e3d1347 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -2,6 +2,13 @@ Release notes =============== +Version 2.1 (2024-04-30) +------------------------ +* Added easier method to customise the submit button via + ``get_html_submit_element``, thanks @fabiocaccamo +* Added pay now button #266, thanks @ohidurbappy +* Dropped support for Python 3.6 + Version 2.0 (2022-03-25) ------------------------ diff --git a/setup.py b/setup.py index 92bad21..b367ebf 100755 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ def read(*rnames): maintainer="Luke Plant", maintainer_email="L.Plant.98@cantab.net", url=URL, - python_requires=">=3.6", + python_requires=">=3.7", install_requires=[ "Django>=2.2", "requests>=2.5.3", @@ -42,7 +42,6 @@ def read(*rnames): "Intended Audience :: System Administrators", "Operating System :: OS Independent", "Topic :: Software Development", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", diff --git a/tox.ini b/tox.ini index ffb43dc..5d8b85c 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,7 @@ envlist = # We don't really need to test all combinations, we pick a few # representatives - py36-django22 + py37-django22 py37-django30 py38-django31 py39-django32 From a8b8cdcc5ab8e42dc2e3ea72b0177a1a40b9d789 Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Tue, 30 Apr 2024 20:30:01 +0100 Subject: [PATCH 2/8] Test on more recent Django/Python --- .github/workflows/build.yml | 4 ++++ tox.ini | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 05c009a..a8ef362 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,6 +27,10 @@ jobs: django-version: 4.0.3 - python-version: "3.10" django-version: 4.0.3 + - python-version: "3.11" + django-version: 4.2.11 + - python-version: "3.12" + django-version: 5.0.4 steps: - uses: actions/checkout@v2 diff --git a/tox.ini b/tox.ini index 5d8b85c..195cca2 100644 --- a/tox.ini +++ b/tox.ini @@ -11,6 +11,8 @@ envlist = py39-django32 py39-django40 py310-django40 + py311-django42 + py312-django50 checkmanifest, isort-check, flake8-check [testenv] @@ -25,6 +27,8 @@ deps = django31: Django==3.1.7 django32: Django==3.2.9 django40: Django==4.0.3 + django42: Django==4.2.11 + django50: Django==5.0.4 usetztrue: pytz [testenv:checkmanifest] From a14b1e40d074c4ec7dd329a2ebfb75409933619d Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Sat, 10 Feb 2024 20:23:43 +0000 Subject: [PATCH 3/8] Switched linters to ruff --- .github/workflows/build.yml | 46 ++++--------------------------------- .pre-commit-config.yaml | 35 ++++------------------------ CONTRIBUTING.rst | 6 ++--- pyproject.toml | 15 ++++++++++++ requirements-dev.txt | 4 ++-- setup.cfg | 4 ---- tox.ini | 18 +-------------- 7 files changed, 30 insertions(+), 98 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a8ef362..b1ce2dc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,50 +55,14 @@ jobs: run: | ./runtests.py --use-tz=false - flake8: + pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - uses: actions/cache@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ '3.9' }}-${{ hashFiles('requirements*.txt') }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -e . - pip install -r requirements-dev.txt - - name: Lint with flake8 - run: | - flake8 --version - flake8 . - - isort: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ '3.9' }}-${{ hashFiles('requirements*.txt') }} - - name: Install deps - run: | - python -m pip install --upgrade pip - pip install -e . - pip install -r requirements-dev.txt - - name: Run isort - run: | - isort --version - isort -c . + python-version: "3.10" + - uses: pre-commit/action@v3.0.0 check-manifest: runs-on: ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1351666..c204059 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,44 +4,17 @@ repos: hooks: - id: trailing-whitespace - id: end-of-file-fixer - - repo: 'https://github.com/pycqa/flake8' - rev: 3.9.2 + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.4.2 hooks: - - id: flake8 - - repo: 'https://github.com/pre-commit/mirrors-isort' - rev: v5.10.1 - hooks: - - id: isort + - id: ruff + args: [ --fix, --exit-non-zero-on-fix ] - repo: 'https://github.com/mgedmin/check-manifest' rev: '0.48' hooks: - id: check-manifest - - repo: 'https://github.com/myint/autoflake' - rev: v2.0.0 - hooks: - - id: autoflake - args: - - '--remove-all-unused-imports' - - '-i' - language_version: python3.9 - - repo: 'https://github.com/pre-commit/mirrors-autopep8' - rev: v2.0.0 - hooks: - - id: autopep8 - language_version: python3.9 - repo: https://github.com/psf/black rev: 22.10.0 hooks: - id: black language_version: python3.9 - - repo: https://github.com/ikamensh/flynt/ - rev: '0.77' - hooks: - - id: flynt - language_version: python3.9 - - repo: https://github.com/asottile/pyupgrade - rev: v3.2.2 - hooks: - - id: pyupgrade - entry: pyupgrade --py3-plus --py36-plus --keep-runtime-typing - language_version: python3.9 diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 0963da4..114afb6 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -47,14 +47,14 @@ Development environment 4. Install development tools:: - pip install tox isort flake8 + pip install -r requirements-test.txt -r requirements-dev.txt -5. Recommended: Install `pre-commit `_ and set up +5. Strongly recommended: Install `pre-commit `_ and set up the hooks:: pre-commit install - This will run flake8/isort automatically when you commit. + This will run linters automatically when you commit. Code quality ~~~~~~~~~~~~ diff --git a/pyproject.toml b/pyproject.toml index f09dd27..c60c3ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,3 +11,18 @@ default_section= "THIRDPARTY" forced_separate = ["paypal.pro.tests", "paypal.standard.ipn.tests", "paypal.standard.pdt.tests"] skip = [".tox", "dist", "build", ".git"] skip_glob = ["**/migrations/*.py"] + +[tool.ruff] +line-length = 120 +target-version = 'py37' + +[tool.ruff.lint] +extend-select = [ + "UP", # enable pyupgrade + "I", # enable isort + "FLY", # enable flynt +] +ignore = [ + "E731", + "UP031", +] diff --git a/requirements-dev.txt b/requirements-dev.txt index a9060e5..e7d32b4 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,4 @@ -flake8==3.8.4 -isort==5.7.0 check-manifest twine +ruff +tox diff --git a/setup.cfg b/setup.cfg index 8b5b947..e69de29 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,4 +0,0 @@ -[flake8] -exclude = .tox,.git,docs,*/migrations/*,dist,build,.ropeproject -ignore = E123,E128,E731,W504,W503 -max-line-length = 120 diff --git a/tox.ini b/tox.ini index 195cca2..b96d4b1 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,7 @@ envlist = py310-django40 py311-django42 py312-django50 - checkmanifest, isort-check, flake8-check + checkmanifest [testenv] commands = @@ -37,19 +37,3 @@ deps = check-manifest Django commands = check-manifest - -[testenv:isort-check] -# isort configurations are located in setup.cfg -basepython = python3.9 -deps = - -r requirements-dev.txt - Django -commands = isort -rc -c {toxinidir} - -[testenv:flake8-check] -# flake8 configurations are located in setup.cfg -basepython = python3.9 -deps = - -r requirements-dev.txt - Django -commands = flake8 From 1de7a7d5f938236db380122cf8287903e9a97c55 Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Sat, 10 Feb 2024 20:24:55 +0000 Subject: [PATCH 4/8] Test on more recent Python/Django --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index b96d4b1..f8530de 100644 --- a/tox.ini +++ b/tox.ini @@ -20,6 +20,7 @@ commands = python --version ./runtests.py ./runtests.py --use-tz=false +allowlist_externals=./runtests.py deps = -r requirements-test.txt django22: Django==2.2.19 From 670bb96a55ad02b3ea27d2a5ca6b2c5840c85dff Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Sat, 10 Feb 2024 20:40:15 +0000 Subject: [PATCH 5/8] Fixed crasher with Django 5.0 --- docs/release_notes.rst | 1 + paypal/pro/helpers.py | 2 +- paypal/standard/forms.py | 2 +- paypal/standard/ipn/tests/test_ipn.py | 4 +--- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/release_notes.rst b/docs/release_notes.rst index e3d1347..1d3ac2a 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -8,6 +8,7 @@ Version 2.1 (2024-04-30) ``get_html_submit_element``, thanks @fabiocaccamo * Added pay now button #266, thanks @ohidurbappy * Dropped support for Python 3.6 +* Fixed Django 5.0 support Version 2.0 (2022-03-25) ------------------------ diff --git a/paypal/pro/helpers.py b/paypal/pro/helpers.py index 02a5ec5..f60a6dc 100644 --- a/paypal/pro/helpers.py +++ b/paypal/pro/helpers.py @@ -47,7 +47,7 @@ def paypaltime2datetime(s): return naive else: # TIMESTAMP_FORMAT is UTC - return timezone.make_aware(naive, timezone.utc) + return timezone.make_aware(naive, timezone.timezone.utc) class PayPalError(TypeError): diff --git a/paypal/standard/forms.py b/paypal/standard/forms.py index 7e90712..b60eb61 100644 --- a/paypal/standard/forms.py +++ b/paypal/standard/forms.py @@ -89,7 +89,7 @@ def to_python(self, value): # PST/PDT is 'US/Pacific' dt = pytz.timezone("US/Pacific").localize(dt, is_dst=zone_part == "PDT") if not settings.USE_TZ: - dt = timezone.make_naive(dt, timezone=timezone.utc) + dt = timezone.make_naive(dt, timezone=timezone.timezone.utc) return dt diff --git a/paypal/standard/ipn/tests/test_ipn.py b/paypal/standard/ipn/tests/test_ipn.py index 7a9bbb3..bdf4705 100644 --- a/paypal/standard/ipn/tests/test_ipn.py +++ b/paypal/standard/ipn/tests/test_ipn.py @@ -1,13 +1,12 @@ import locale import unittest -from datetime import datetime +from datetime import datetime, timezone from decimal import Decimal from urllib.parse import urlencode from django.conf import settings from django.test import TestCase from django.test.utils import override_settings -from django.utils import timezone from paypal.standard.ipn.models import PayPalIPN from paypal.standard.ipn.signals import invalid_ipn_received, valid_ipn_received @@ -384,7 +383,6 @@ def test_postback(self): @override_settings(ROOT_URLCONF="paypal.standard.ipn.tests.test_urls") class IPNSimulatorTests(TestCase): - # Some requests, as sent by the simulator. # The simulator itself has bugs. For example, it doesn't send the 'charset' From b574642ef89213dad3480faa4567501d6dce7638 Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Tue, 30 Apr 2024 20:42:46 +0100 Subject: [PATCH 6/8] Removed broken pre-commit job We're using pre-commit.ci now --- .github/workflows/build.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b1ce2dc..59d71d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,15 +55,6 @@ jobs: run: | ./runtests.py --use-tz=false - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - uses: pre-commit/action@v3.0.0 - check-manifest: runs-on: ubuntu-latest steps: From c705ac279c68b8b5901b2f09457afc8b01cf7444 Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Tue, 30 Apr 2024 20:45:30 +0100 Subject: [PATCH 7/8] Docs fix for installing latest django-paypal --- docs/install.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/install.rst b/docs/install.rst index cea919c..d35d143 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -8,7 +8,7 @@ Install into a virtualenv using pip:: Or using the latest version from GitHub:: - pip install git://github.com/spookylukey/django-paypal.git#egg=django-paypal + pip install git+https://github.com/spookylukey/django-paypal.git#egg=django-paypal If you are using Django < 1.11, you should use django-paypal 0.5.x and refer to its documentation. From 55146a5fe5c482d57d5c380a3d08cb2bb27f6e00 Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Tue, 30 Apr 2024 20:22:37 +0100 Subject: [PATCH 8/8] Version bump - 2.1 --- docs/conf.py | 4 ++-- paypal/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 98e5277..ee0578b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -47,9 +47,9 @@ # built documents. # # The short X.Y version. -version = "2.0" +version = "2.1" # The full version, including alpha/beta/rc tags. -release = "2.0" +release = "2.1" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/paypal/__init__.py b/paypal/__init__.py index f2dc0e4..ab02866 100644 --- a/paypal/__init__.py +++ b/paypal/__init__.py @@ -1 +1 @@ -__version__ = "2.0" +__version__ = "2.1" diff --git a/setup.py b/setup.py index b367ebf..3e8ab7e 100755 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ def read(*rnames): setup( name="django-paypal", - version="2.0", + version="2.1", author="John Boxall", author_email="john@handimobility.ca", maintainer="Luke Plant",