Skip to content

Commit

Permalink
Add Support for Python3.12 & Django5.0
Browse files Browse the repository at this point in the history
Remove html templating feature
  • Loading branch information
pfouque authored Oct 29, 2023
1 parent fc1f2a9 commit 907522c
Show file tree
Hide file tree
Showing 19 changed files with 530 additions and 724 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
cache: poetry

- name: Install requirements
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
cache: poetry

- name: Build project
Expand Down
60 changes: 15 additions & 45 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,25 @@
name: Tests

on:
pull_request:
push:
branches:
- master
branches: [main]

jobs:
test:
name: Run tests
build:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
django-version: ["3.2", "4.1", "4.2"]
anymail-version: ["9.0", "9.1", "9.2"]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- name: Check out the repository
uses: actions/checkout@v4

- uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry


- name: Ensure Python version ${{ matrix.python-version }}
# https://github.com/actions/setup-python/issues/425
run: poetry env use ${{ matrix.python-version }}

- name: Install requirements
run: poetry install

- name: Install django ${{ matrix.django-version }}
run: poetry add "django@~=${{ matrix.django-version }}"

- name: Install anymail ${{ matrix.anymail-version }}
run: poetry add "django-anymail@~=${{ matrix.anymail-version }}"

- name: Django check
run: poetry run python manage.py check

- name: Run tests
run: poetry run pytest --verbose
env:
FORCE_COLOR: true
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox
26 changes: 0 additions & 26 deletions .github/workflows/upgrade_precommit.yml

This file was deleted.

39 changes: 14 additions & 25 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
args: ["--maxkb=700"]
Expand All @@ -10,35 +10,18 @@ repos:
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements

- repo: https://github.com/asottile/pyupgrade
rev: v3.4.0
hooks:
- id: pyupgrade
args:
- "--py38-plus"
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/adamchainz/django-upgrade
rev: 1.13.0
rev: 1.15.0
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]

- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.270"
hooks:
- id: ruff

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.6.1
hooks:
- id: mypy
args: []
Expand All @@ -47,8 +30,14 @@ repos:
- django-stubs

- repo: https://github.com/python-poetry/poetry
rev: "1.5.0"
rev: 1.6.0
hooks:
- id: poetry-check
- id: poetry-lock
args: ["--check"]
additional_dependencies:
- poetry-plugin-sort==0.2.0

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
hooks:
- id: ruff-format
- id: ruff
7 changes: 0 additions & 7 deletions anymail_history/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
from __future__ import annotations

from .utils import send_templated_email

__all__ = [
"send_templated_email",
]
3 changes: 2 additions & 1 deletion anymail_history/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from django.contrib import admin
from django.http import HttpRequest

from .models import MessageEvent, SentMessage
from .models import MessageEvent
from .models import SentMessage


class ReadonlyInline(admin.TabularInline):
Expand Down
4 changes: 3 additions & 1 deletion anymail_history/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Generated by Django 4.1.6 on 2023-02-12 16:46
from __future__ import annotations

import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):
Expand Down
10 changes: 7 additions & 3 deletions anymail_history/receivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@

from typing import Any

from anymail.message import AnymailMessage, AnymailStatus
from anymail.signals import AnymailTrackingEvent, post_send, tracking
from anymail.message import AnymailMessage
from anymail.message import AnymailStatus
from anymail.signals import AnymailTrackingEvent
from anymail.signals import post_send
from anymail.signals import tracking
from anymail.utils import get_anymail_setting
from django.db.models import Model
from django.dispatch import receiver

from .models import MessageEvent, SentMessage
from .models import MessageEvent
from .models import SentMessage


@receiver(post_send)
Expand Down
41 changes: 0 additions & 41 deletions anymail_history/utils.py

This file was deleted.

Loading

0 comments on commit 907522c

Please sign in to comment.