Skip to content

Commit

Permalink
v1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronny Vedrilla committed Oct 20, 2023
1 parent 8a9f57d commit 6f3ee57
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 27 deletions.
9 changes: 8 additions & 1 deletion .ambient-package-update/metadata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from ambient_package_update.metadata.author import PackageAuthor
from ambient_package_update.metadata.constants import DEV_DEPENDENCIES, LICENSE_GPL
from ambient_package_update.metadata.constants import (
DEV_DEPENDENCIES,
LICENSE_GPL,
SUPPORTED_DJANGO_VERSIONS,
SUPPORTED_PYTHON_VERSIONS,
)
from ambient_package_update.metadata.package import PackageMetadata
from ambient_package_update.metadata.readme import ReadmeContent
from ambient_package_update.metadata.ruff_ignored_inspection import RuffIgnoredInspection
Expand Down Expand Up @@ -46,6 +51,8 @@
'Django>=3.2',
'html2text>=2020.1.16',
],
supported_django_versions=SUPPORTED_DJANGO_VERSIONS,
supported_python_versions=SUPPORTED_PYTHON_VERSIONS,
optional_dependencies={
'dev': [
*DEV_DEPENDENCIES,
Expand Down
51 changes: 44 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
linting:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.12"

Expand All @@ -21,13 +21,13 @@ jobs:
- name: Run pre-commit hooks
run: pre-commit run --all-files --hook-stage push

build:
tests:
name: Python ${{ matrix.python-version }}, django ${{ matrix.django-version }}
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
django-version: [32, 41, 42]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', ]
django-version: ['32', '41', '42', ]

exclude:
- python-version: '3.12'
Expand All @@ -38,9 +38,9 @@ jobs:
django-version: 32

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
Expand All @@ -49,3 +49,40 @@ jobs:
env:
TOXENV: django${{ matrix.django-version }}
run: tox
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: '.coverage*'

coverage:
name: Coverage
runs-on: ubuntu-22.04
needs: tests
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install dependencies
run: python -m pip install --upgrade coverage[toml]

- name: Download data
uses: actions/download-artifact@v3
with:
name: coverage-data

- name: Combine coverage and fail if it's <100%
run: |
# python -m coverage combine
python -m coverage html --skip-covered --skip-empty
python -m coverage report --fail-under=100
- name: Upload HTML report
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: html-report
path: htmlcov
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@

repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
rev: 23.10.0
hooks:
- id: black
args: [ --check, --diff, --config, ./pyproject.toml ]
stages: [ push ]

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.292'
rev: 'v0.1.1'
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
args: [ --fix, --unsafe-fixes, --exit-non-zero-on-fix ]

- repo: https://github.com/asottile/pyupgrade
rev: v3.14.0
rev: v3.15.0
hooks:
- id: pyupgrade
args: [ --py38-plus ]
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

* *1.2.3** (2023-10-20)
* Linter updaters including code adjustments
* Updates from ambient updater

* *1.2.2** (2023-10-04)
* Dependency to ambient updater updated

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![PyPI release](https://img.shields.io/pypi/v/django-pony-express.svg)](https://pypi.org/project/django-pony-express/)
[![Downloads](https://static.pepy.tech/badge/django-pony-express)](https://pepy.tech/project/django-pony-express)
[![Coverage](https://img.shields.io/badge/Coverage-100%25-success)](https://github.com/ambient-innovation/django-pony-express/actions?workflow=CI)
[![Linting](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Coding Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)
[![Documentation Status](https://readthedocs.org/projects/django-pony-express/badge/?version=latest)](https://django-pony-express.readthedocs.io/en/latest/?badge=latest)
Expand Down Expand Up @@ -80,6 +81,12 @@ Ingenious, right?
pytest --ds settings tests
````
- Check coverage
````
coverage run -m pytest --ds settings tests
coverage report -m
````
### Git hooks (via pre-commit)
We use pre-push hooks to ensure that only linted code reaches our remote repository and pipelines aren't triggered in
Expand Down
2 changes: 1 addition & 1 deletion django_pony_express/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Class-based emails including a test suite for Django"""

__version__ = '1.2.2'
__version__ = '1.2.3'
7 changes: 6 additions & 1 deletion django_pony_express/services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,13 @@ def get_translation(self) -> Union[str, None]:
"""
Tries to fetch the current translation from the django settings.
"""
language_str_length = 2
try:
return settings.LANGUAGE_CODE[:2] if settings.LANGUAGE_CODE and len(settings.LANGUAGE_CODE) >= 2 else None
return (
settings.LANGUAGE_CODE[:2]
if settings.LANGUAGE_CODE and len(settings.LANGUAGE_CODE) >= language_str_length
else None
)
except TypeError:
return None

Expand Down
4 changes: 1 addition & 3 deletions django_pony_express/services/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ def all(self):
self.reload()

# Load data to matching list
match_list = []
for email in self._outbox:
match_list.append(email)
match_list = list(self._outbox)

return EmailTestServiceQuerySet(matching_list=match_list)

Expand Down
22 changes: 12 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ dev = [
'freezegun~=1.2',
'pytest-django~=4.5',
'pytest-mock~=3.10',
'pre-commit~=3.2',
'black~=23.3',
'Django~=3.2',
'coverage~=7.3',
'pre-commit~=3.5',
'black~=23.10',
'sphinx==4.2.0',
'sphinx-rtd-theme==1.0.0',
'm2r2==0.3.1',
'mistune<2.0.0',
'ambient-package-update~=23.10.1',
'ambient-package-update~=23.10.2',
]

[tool.flit.module]
Expand Down Expand Up @@ -88,8 +88,9 @@ select = [
"PIE", # Bunch of useful rules
# "SIM", # Simplifies your code
"INT", # Validates your gettext translation strings
"PERF", # PerfLint
"PGH", # No all-purpose "# noqa" and eval validation
# "UP", # PyUpgrade
"PL", # PyLint
]
ignore = [
'N999', # Project name contains underscore, not fixable
Expand All @@ -116,8 +117,9 @@ fixable = [
"PIE", # Bunch of useful rules
# "SIM", # Simplifies your code
"INT", # Validates your gettext translation strings
"PERF", # PerfLint
"PGH", # No all-purpose "# noqa" and eval validation
# "UP", # PyUpgrade
"PL", # PyLint
]
unfixable = []

Expand Down Expand Up @@ -163,12 +165,12 @@ isolated_build = True
[testenv]
# Django deprecation overview: https://www.djangoproject.com/download/
deps =
django32: Django>=3.2,<3.3
django41: Django>=4.1,<4.2
django42: Django>=4.2,<4.3
django32: Django==3.2.*
django41: Django==4.1.*
django42: Django==4.2.*
extras = dev,
commands =
pytest --ds settings tests
coverage run -m pytest --ds settings tests
[gh-actions]
python =
Expand Down
3 changes: 3 additions & 0 deletions scripts/unix/install_requirements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pip install -U pip-tools
pip-compile --extra dev, -o requirements.txt pyproject.toml --resolver=backtracking
pip-sync
3 changes: 3 additions & 0 deletions scripts/windows/install_requirements.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pip install -U pip-tools
pip-compile --extra dev, -o requirements.txt pyproject.toml --resolver=backtracking
pip-sync
15 changes: 15 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
[metadata]
description-file = README.md
license-file = LICENSE.md

[coverage:run]
branch = True
parallel = True
source =
django_pony_express
tests

[coverage:paths]
source =
django_pony_express
.tox/**/site-packages

[coverage:report]
show_missing = True

0 comments on commit 6f3ee57

Please sign in to comment.