Skip to content

Commit

Permalink
Add Django 5.0 support and update with a blank test (#32)
Browse files Browse the repository at this point in the history
* Poetry updates

* Update to test locally with tox

* Add tox tests to CI

* Separate dependencies into groups

* Update makefile command

* Remove deprecated warning

* Update CI task

* Add an empty test

* Add a TODO
  • Loading branch information
CamLamb authored Dec 5, 2023
1 parent b4aa46d commit e2d2199
Show file tree
Hide file tree
Showing 11 changed files with 928 additions and 594 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Python package

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install poetry
run: |
pip install -U pip
pip install poetry
poetry install --with testing
env:
POETRY_VIRTUALENVS_CREATE: false
- name: Run Tox
run: poetry run tox
2 changes: 1 addition & 1 deletion example_project/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SHELL := /bin/bash
manage = poetry run python manage.py

build:
poetry install
poetry install --with dev --with docs --with testing

init:
$(manage) loaddata example/fixtures/test_users.json
Expand Down
154 changes: 79 additions & 75 deletions example_project/poetry.lock

Large diffs are not rendered by default.

Empty file.
3 changes: 3 additions & 0 deletions govuk_frontend_django/tests/test_templatetags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TODO: Add some tests
def test_empty():
assert True
7 changes: 6 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@ mypy:
poetry run mypy govuk_frontend_django

djlint:
poetry run djlint example_project --reformat
poetry run djlint example_project --reformat

# Testing

tox:
poetry run tox
1,292 changes: 784 additions & 508 deletions poetry.lock

Large diffs are not rendered by default.

27 changes: 20 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ homepage = "https://uktrade.github.io/govuk-frontend-django/"
repository = "https://github.com/uktrade/govuk-frontend-django/"
documentation = "https://uktrade.github.io/govuk-frontend-django/"
packages = [
{include = "govuk_frontend_django"},
{include = "govuk_frontend_django/py.typed"},
{ include = "govuk_frontend_django" },
{ include = "govuk_frontend_django/py.typed" },
]

[tool.poetry.dependencies]
Expand All @@ -27,6 +27,16 @@ Django = "^4.1.9"
jinja2 = "^3.1.2"
govuk-frontend-jinja = "2.7.0"

[tool.poetry.group.testing]
optional = true

[tool.poetry.group.testing.dependencies]
tox = "^4.11.4"
pytest = "^7.4.3"

[tool.poetry.group.dev]
optional = true

[tool.poetry.group.dev.dependencies]
black = "^23.3.0"
pyyaml = "^6.0"
Expand All @@ -36,6 +46,9 @@ mypy = "^1.2.0"
django-stubs = "^1.16.0"
djlint = "^1.28.0"

[tool.poetry.group.docs]
optional = true

[tool.poetry.group.docs.dependencies]
mkdocs-material = "^9.1.5"
mkdocs-minify-plugin = "^0.6.4"
Expand All @@ -56,8 +69,8 @@ plugins = ["mypy_django_plugin.main"]
django_settings_module = "settings"

[tool.djlint]
profile="django"
indent="4"
ignore="H021,H006"
exclude="node_modules,staticfiles,static"
custom_blocks="gds_accordion,gds_accordion_item,gds_breadcrumbs,gds_checkboxes,gds_checkbox_conditional,gds_cookie_banner,gds_cookie_banner_message,gds_error_summary,gds_error_summary_error_list_item,gds_footer,gds_footer_nav,gds_footer_meta,gds_header,gds_header_nav_item,gds_phase_banner,gds_summary_list,gds_summary_list_row,gds_summary_list_row_key,gds_summary_list_row_value,gds_summary_list_row_actions,gds_summary_list_row_actions_item,gds_summary_list_card,gds_summary_list_card_actions,gds_summary_list_card_actions_item,gds_tabs,gds_tabs_tab"
profile = "django"
indent = "4"
ignore = "H021,H006"
exclude = "node_modules,staticfiles,static"
custom_blocks = "gds_accordion,gds_accordion_item,gds_breadcrumbs,gds_checkboxes,gds_checkbox_conditional,gds_cookie_banner,gds_cookie_banner_message,gds_error_summary,gds_error_summary_error_list_item,gds_footer,gds_footer_nav,gds_footer_meta,gds_header,gds_header_nav_item,gds_phase_banner,gds_summary_list,gds_summary_list_row,gds_summary_list_row_key,gds_summary_list_row_value,gds_summary_list_row_actions,gds_summary_list_row_actions_item,gds_summary_list_card,gds_summary_list_card_actions,gds_summary_list_card_actions_item,gds_tabs,gds_tabs_tab"
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[pytest]

DJANGO_SETTINGS_MODULE=settings
norecursedirs=example_project
1 change: 0 additions & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@
LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
USE_I18N = True
USE_L10N = True
USE_TZ = True
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
9 changes: 8 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
[tox]
envlist =
dj{32,40,41,latest}
py{38,39,310,311}-dj{32}
py{38,39,310}-dj{40}
py{38,39,310,311}-dj{41}
py{38,39,310,311,312}-dj{42}
py{310,311,312}-dj{50,latest}
skip_missing_interpreters = True

[testenv]
deps=
Expand All @@ -10,6 +15,8 @@ deps=
dj32: Django>=3.2,<3.3
dj40: Django>=4.0,<4.1
dj41: Django>=4.1,<4.2
dj42: Django>=4.2,<5.0
dj50: Django>=5.0,<5.1
djlatest: Django

commands=
Expand Down

0 comments on commit e2d2199

Please sign in to comment.