Skip to content

Commit

Permalink
Merge pull request #287 from spookylukey/django-5.0
Browse files Browse the repository at this point in the history
Django 5.0 support
  • Loading branch information
spookylukey committed Apr 30, 2024
2 parents 0ccd55e + 55146a5 commit 2a32905
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 116 deletions.
51 changes: 5 additions & 46 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -51,51 +55,6 @@ jobs:
run: |
./runtests.py --use-tz=false
flake8:
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 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 .
check-manifest:
runs-on: ubuntu-latest
steps:
Expand Down
35 changes: 4 additions & 31 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://pre-commit.com/>`_ and set up
5. Strongly recommended: Install `pre-commit <https://pre-commit.com/>`_ 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
~~~~~~~~~~~~
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
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
* Fixed Django 5.0 support

Version 2.0 (2022-03-25)
------------------------

Expand Down
2 changes: 1 addition & 1 deletion paypal/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.0"
__version__ = "2.1"
2 changes: 1 addition & 1 deletion paypal/pro/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion paypal/standard/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 1 addition & 3 deletions paypal/standard/ipn/tests/test_ipn.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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'
Expand Down
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
flake8==3.8.4
isort==5.7.0
check-manifest
twine
ruff
tox
4 changes: 0 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
[flake8]
exclude = .tox,.git,docs,*/migrations/*,dist,build,.ropeproject
ignore = E123,E128,E731,W504,W503
max-line-length = 120
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ def read(*rnames):

setup(
name="django-paypal",
version="2.0",
version="2.1",
author="John Boxall",
author_email="john@handimobility.ca",
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",
Expand All @@ -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",
Expand Down
25 changes: 7 additions & 18 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,31 @@
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
py39-django40
py310-django40
checkmanifest, isort-check, flake8-check
py311-django42
py312-django50
checkmanifest

[testenv]
commands =
python --version
./runtests.py
./runtests.py --use-tz=false
allowlist_externals=./runtests.py
deps =
-r requirements-test.txt
django22: Django==2.2.19
django30: Django==3.0.13
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]
Expand All @@ -33,19 +38,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

0 comments on commit 2a32905

Please sign in to comment.