Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump template to 2024.24 #173

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .copier/package.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v2024.18
_commit: v2024.24
_src_path: gh:westerveltco/django-twc-package
author_email: [email protected]
author_name: Josh Thomas
current_version: 0.4.3
django_versions:
- '3.2'
- '4.2'
- '5.0'
docs_domain: westervelt.dev
Expand All @@ -21,5 +20,6 @@ python_versions:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
test_django_main: true
versioning_scheme: SemVer
19 changes: 0 additions & 19 deletions .github/workflows/labels.yml

This file was deleted.

45 changes: 12 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,32 @@ on:
release:
types: [released]

jobs:
check:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4

- name: Check most recent test run on `main`
id: latest-test-result
run: |
echo "result=$(gh run list \
--branch=main \
--workflow=test.yml \
--json headBranch,workflowName,conclusion \
--jq '.[] | select(.headBranch=="main" and .conclusion=="success") | .conclusion' \
| head -n 1)" >> $GITHUB_OUTPUT

- name: OK
if: ${{ (contains(steps.latest-test-result.outputs.result, 'success')) }}
run: exit 0
permissions:
contents: write

- name: Fail
if: ${{ !contains(steps.latest-test-result.outputs.result, 'success') }}
run: exit 1
jobs:
test:
uses: ./.github/workflows/test.yml

pypi:
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
needs: check
needs: test
environment: release
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: westerveltco/setup-ci-action@v0
- uses: actions/setup-python@v5
with:
python-version: 3.12
extra-python-dependencies: hatch
use-uv: true

- name: Install dependencies
run: |
python -m pip install -U pip uv
python -m uv pip install --system hatch

- name: Build package
run: |
Expand Down
50 changes: 28 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: test

on:
pull_request:
push:
branches: [main]
pull_request:
workflow_call:

concurrency:
group: test-${{ github.head_ref }}
Expand All @@ -20,14 +21,15 @@ jobs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: westerveltco/setup-ci-action@v0
- uses: actions/setup-python@v5
with:
python-version: 3.8
extra-python-dependencies: nox
use-uv: true

- name: Install dependencies
run: |
python -m pip install -U pip uv
python -m uv pip install --system nox

- id: set-matrix
run: |
Expand All @@ -42,14 +44,16 @@ jobs:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: westerveltco/setup-ci-action@v0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
extra-python-dependencies: nox
use-uv: true
allow-prereleases: true

- name: Install dependencies
run: |
python -m pip install -U pip uv
python -m uv pip install --system nox

- name: Run tests
run: |
Expand All @@ -71,14 +75,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: westerveltco/setup-ci-action@v0
- uses: actions/setup-python@v5
with:
python-version: 3.8
extra-python-dependencies: nox
use-uv: true
python-version: 3.12

- name: Install dependencies
run: |
python -m pip install -U pip uv
python -m uv pip install --system nox

- name: Run mypy
run: |
Expand All @@ -88,14 +93,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: westerveltco/setup-ci-action@v0
- uses: actions/setup-python@v5
with:
python-version: 3.8
extra-python-dependencies: nox
use-uv: true

- name: Install dependencies
run: |
python -m pip install -U pip uv
python -m uv pip install --system nox

- name: Run coverage
run: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
rev: 1.20.0
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]
args: [--target-version, "4.2"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.4
Expand Down
80 changes: 44 additions & 36 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,60 +18,68 @@ and this project attempts to adhere to [Semantic Versioning](https://semver.org/

## [Unreleased]

### Added

- Added support for Python 3.13.

### Changed

- Now using v2024.18 of `django-twc-package`.
- Now using v2024.24 of `django-twc-package`.

### Removed

- Dropped support for Django 3.2.

## [0.4.3]

### Fixed

- Added all documentation pages back to `toctree`.
- Added back missing copyright information from `django-mailer`. Sorry to all the maintainers and contributors of that package! It was a major oversight.
- Added back all missing extras: `hc`, `psycopg`, and `relay`.
- Added all documentation pages back to `toctree`.
- Added back missing copyright information from `django-mailer`. Sorry to all the maintainers and contributors of that package! It was a major oversight.
- Added back all missing extras: `hc`, `psycopg`, and `relay`.

## [0.4.2]

### Fixed

- Added `LICENSE` to `Dockerfile`.
- Added `LICENSE` to `Dockerfile`.

## [0.4.1]

### Fixed

- Added back Docker publishing to `release.yml` GitHub Actions workflow.
- Added back Docker publishing to `release.yml` GitHub Actions workflow.

## [0.4.0]

### Added

- A `_email_relay_version` field to `RelayEmailData` to track the version of the schema used to serialize the data. This should allow for future changes to the schema to be handled more gracefully.
- A `_email_relay_version` field to `RelayEmailData` to track the version of the schema used to serialize the data. This should allow for future changes to the schema to be handled more gracefully.

### Changed

- Now using [`django-twc-package`](https://github.com/westerveltco/django-twc-package) template for repository and package structure.
- This includes using `uv` internally for managing Python dependencies.
- Now using [`django-twc-package`](https://github.com/westerveltco/django-twc-package) template for repository and package structure.
- This includes using `uv` internally for managing Python dependencies.

### Fixed

- Resolved a type mismatch error in from_email_message method when encoding attachments to base64. Added type checking to confirm that the payload extracted from a MIMEBase object is of type bytes before passing it to base64.b64encode.
- Resolved a type mismatch error in from_email_message method when encoding attachments to base64. Added type checking to confirm that the payload extracted from a MIMEBase object is of type bytes before passing it to base64.b64encode.

## [0.3.0]

### Added

- Support for Django 5.0.
- Support for Django 5.0.

### Removed

- Support for Django 4.1.
- Support for Django 4.1.

## [0.2.1]

### Fixed

- Migration 0002 was not being applied to the `default` database, which is the norm when running the relay in Docker.
- Migration 0002 was not being applied to the `default` database, which is the norm when running the relay in Docker.

## [0.2.0] - **YANKED**

Expand All @@ -81,50 +89,50 @@ This release has been yanked from PyPI due to a bug in the migration that was no

### Added

- A `RelayEmailData` dataclass for representing the `Message.data` field.
- Documentation in the package's deprecation policy about the road to 1.0.0.
- Complete test coverage for all of the public ways of sending emails that Django provides.
- A `RelayEmailData` dataclass for representing the `Message.data` field.
- Documentation in the package's deprecation policy about the road to 1.0.0.
- Complete test coverage for all of the public ways of sending emails that Django provides.

### Changed

- **Breaking**: The internal JSON schema for the `Message.data` field has been updated to bring it more in line with all of the possible fields provided by Django's `EmailMessage` and `EmailMultiAlternatives`. This change involves a migration to update the `Message.data` field to the new schema. This is a one-way update and cannot be rolled back. Please take care when updating to this version and ensure that all projects using `django-email-relay` are updated at the same time. See the [updating](https://django-email-relay.westervelt.dev/en/latest/updating.html) documentation for more information.
- The internal `AppSettings` dataclass is now a `frozen=True` dataclass.
- **Breaking**: The internal JSON schema for the `Message.data` field has been updated to bring it more in line with all of the possible fields provided by Django's `EmailMessage` and `EmailMultiAlternatives`. This change involves a migration to update the `Message.data` field to the new schema. This is a one-way update and cannot be rolled back. Please take care when updating to this version and ensure that all projects using `django-email-relay` are updated at the same time. See the [updating](https://django-email-relay.westervelt.dev/en/latest/updating.html) documentation for more information.
- The internal `AppSettings` dataclass is now a `frozen=True` dataclass.

## [0.1.1]

### Added

- Moved a handful of common `Message` queries and actions from the `runrelay` management command to methods on the `MessageManager` class.
- Moved a handful of common `Message` queries and actions from the `runrelay` management command to methods on the `MessageManager` class.

### Fixed

- The relay service would crash if requests raised an `Exception` during the healthcheck ping. Now it will log the exception and continue processing the queue.
- The relay service would crash if requests raised an `Exception` during the healthcheck ping. Now it will log the exception and continue processing the queue.

## [0.1.0]

Initial release!

### Added

- An email backend that stores emails in a database ala a Message model rather than sending them via SMTP or other means.
- Designed to work seamlessly with Django's built-in ways of sending emails.
- A database backend that routes writes to the Message model to a separate database.
- A Message model that stores the contents of an email.
- The Message model stores the contents of the email as a JSONField.
- Attachments are stored in the database, under the 'attachments' key in the JSONField.
- Should be able to handle anything that Django can by default.
- A relay service intended to be run separately, either as a standalone Docker image or as a management command within a Django project.
- A Docker image is provided for the relay service. Currently only PostgreSQL is supported as a database backend.
- A management command is provided for the relay service. Any database backend supported by Django should work (minus SQLite which doesn't make sense for a relay service).
- The relay service can be configured with a healthcheck url to ensure it is running.
- Initial documentation.
- Initial tests.
- Initial CI/CD (GitHub Actions).
- An email backend that stores emails in a database ala a Message model rather than sending them via SMTP or other means.
- Designed to work seamlessly with Django's built-in ways of sending emails.
- A database backend that routes writes to the Message model to a separate database.
- A Message model that stores the contents of an email.
- The Message model stores the contents of the email as a JSONField.
- Attachments are stored in the database, under the 'attachments' key in the JSONField.
- Should be able to handle anything that Django can by default.
- A relay service intended to be run separately, either as a standalone Docker image or as a management command within a Django project.
- A Docker image is provided for the relay service. Currently only PostgreSQL is supported as a database backend.
- A management command is provided for the relay service. Any database backend supported by Django should work (minus SQLite which doesn't make sense for a relay service).
- The relay service can be configured with a healthcheck url to ensure it is running.
- Initial documentation.
- Initial tests.
- Initial CI/CD (GitHub Actions).

### New Contributors

- Josh Thomas <[email protected]> (maintainer)
- Jeff Triplett [@jefftriplett](https://github.com/jefftriplett)
- Josh Thomas <[email protected]> (maintainer)
- Jeff Triplett [@jefftriplett](https://github.com/jefftriplett)

### Thanks ❤️

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

[![PyPI](https://img.shields.io/pypi/v/django-email-relay)](https://pypi.org/project/django-email-relay/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-email-relay)
![Django Version](https://img.shields.io/badge/django-3.2%20%7C%204.2%20%7C%205.0-%2344B78B?labelColor=%23092E20)
![Django Version](https://img.shields.io/badge/django-4.2%20%7C%205.0-%2344B78B?labelColor=%23092E20)
<!-- https://shields.io/badges -->
<!-- django-3.2 | 4.2 | 5.0-#44B78B -->
<!-- django-4.2 | 5.0-#44B78B -->
<!-- labelColor=%23092E20 -->

`django-email-relay` enables Django projects without direct access to a preferred SMTP server to use that server for email dispatch.
Expand All @@ -19,8 +19,8 @@ It consists of two parts:

## Requirements

- Python 3.8, 3.9, 3.10, 3.11, 3.12
- Django 3.2, 4.2, 5.0
- Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13
- Django 4.2, 5.0

## Getting Started

Expand Down
Loading
Loading