Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .changes/unreleased/added-20261026-120000.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: added
body: Added support for Django 6.1
time: 2026-10-26T12:00:00.000000+01:00
4 changes: 2 additions & 2 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Validate changie fragments
uses: miniscruff/changie-action@11bcad388e7973948cbcecb10863baf024d5f607 # v3.0.0
uses: miniscruff/changie-action@3223cb29b92a0972dedc864ace3da01e04780ae4 # v3.0.1
with:
version: latest
args: batch patch --dry-run
8 changes: 4 additions & 4 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Batch changelog fragments
uses: miniscruff/changie-action@11bcad388e7973948cbcecb10863baf024d5f607 # v3.0.0
uses: miniscruff/changie-action@3223cb29b92a0972dedc864ace3da01e04780ae4 # v3.0.1
with:
version: latest
args: batch ${{ inputs.version }} --allow-no-changes=false

- name: Merge changelog
uses: miniscruff/changie-action@11bcad388e7973948cbcecb10863baf024d5f607 # v3.0.0
uses: miniscruff/changie-action@3223cb29b92a0972dedc864ace3da01e04780ae4 # v3.0.1
with:
version: latest
args: merge

- name: Read release version
id: latest
uses: miniscruff/changie-action@11bcad388e7973948cbcecb10863baf024d5f607 # v3.0.0
uses: miniscruff/changie-action@3223cb29b92a0972dedc864ace3da01e04780ae4 # v3.0.1
with:
version: latest
args: latest
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,27 @@ permissions: {}
jobs:
release:
runs-on: ubuntu-latest
environment: pypi
permissions:
contents: write # create the GitHub release and attach assets
id-token: write # PyPI trusted publishing (OIDC)
outputs:
version: ${{ steps.release.outputs.version }}
released: ${{ steps.published.outputs.released }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.13"

- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
with:
enable-cache: false

Expand Down Expand Up @@ -129,9 +131,6 @@ jobs:
- name: Publish package
if: steps.version-changed.outputs.changed == 'true' && steps.existing-release.outputs.exists == 'false'
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
with:
user: __token__
password: ${{ secrets.pypi_password }}

- name: Create GitHub release
if: steps.version-changed.outputs.changed == 'true' && steps.existing-release.outputs.exists == 'false'
Expand All @@ -150,7 +149,7 @@ jobs:
if: steps.version-changed.outputs.changed == 'true' && steps.existing-release.outputs.exists == 'false'
run: echo "released=true" >> "$GITHUB_OUTPUT"

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: steps.published.outputs.released == 'true'
with:
name: sbom-cyclonedx
Expand All @@ -166,7 +165,7 @@ jobs:
runs-on: ubuntu-latest
permissions: {}
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: sbom-cyclonedx

Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,25 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
django-version: ["4.2.*", "5.2.*", "6.0.*"]
django-version: ["4.2.*", "5.2.*", "6.0.*", "6.1.*"]
exclude:
- python-version: "3.11"
django-version: "6.0.*"
- python-version: "3.11"
django-version: "6.1.*"
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0

- name: Install dependencies
run: uv sync --group test
Expand All @@ -42,6 +44,9 @@ jobs:
DJANGO_VERSION: ${{ matrix.django-version }}
run: uv pip install "Django==${DJANGO_VERSION}"

- name: Check formatting
run: uv run --group test ruff format --check

- name: Run lint
run: uv run --group test ruff check

Expand Down
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ TEST_MATRIX ?= \
'3.12:4.2.*' \
'3.12:5.2.*' \
'3.12:6.0.*' \
'3.12:6.1.*' \
'3.13:5.2.*' \
'3.13:6.0.*' \
'3.13:6.1.*' \
'3.14:5.2.*' \
'3.14:6.0.*'
'3.14:6.0.*' \
'3.14:6.1.*'


install:
Expand All @@ -30,15 +33,11 @@ test-all:
done

lint:
uv run --group test ruff format --check
uv run --group test ruff check

retest:
uv run --group test pytest -vvv --lf

coverage:
uv run --group test pytest --cov=django_postcode_lookup --cov-report=term-missing --cov-report=html

release:
rm -rf dist/*
uv build
twine upload dist/*
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# django-postcode-lookup

[![PyPI](https://img.shields.io/pypi/v/django-postcode-lookup)](https://pypi.org/project/django-postcode-lookup/)
[![Tests](https://github.com/labd/django-postcode-lookup/actions/workflows/test.yml/badge.svg)](https://github.com/labd/django-postcode-lookup/actions/workflows/test.yml)

This Django app provides a pluggable postcode Django REST Framework endpoint. It
currently only works for postcodes in The Netherlands.

Expand All @@ -9,10 +12,6 @@ Currently supports the following services:
- Webservices.nl
- postcodeapi.nu

## Status

[![PyPI](https://img.shields.io/pypi/v/django-postcode-lookup.svg)](https://pypi.python.org/pypi/django-postcode-lookup/)

## Installation

```shell
Expand Down
12 changes: 7 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ classifiers = [
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.2",
"Framework :: Django :: 6.0",
"Framework :: Django :: 6.1",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
Expand All @@ -45,11 +46,11 @@ test = [
"freezegun==1.5.5",
"pretend==1.0.9",
"pytest-cov==7.1.0",
"pytest-django==4.12.0",
"pytest==9.0.3",
"pytest-django==4.14.0",
"pytest==9.1.1",
"requests-mock==1.12.1",
"coverage==7.14.0",
"ruff==0.14.6",
"coverage==7.17.0",
"ruff==0.17.2",
]

[tool.hatch.build.targets.wheel]
Expand All @@ -60,7 +61,8 @@ testpaths = ["tests"]

[tool.ruff]
line-length = 99
target-version = "py314"
target-version = "py311"
extend-exclude = ["*.md"]

[tool.ruff.lint]
select = [
Expand Down
43 changes: 21 additions & 22 deletions sandbox/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'qk1t#3&b0@vntk9r($_i1^6%9-9_jonad@clifp4htm$$_lj36'
SECRET_KEY = "qk1t#3&b0@vntk9r($_i1^6%9-9_jonad@clifp4htm$$_lj36"

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
Expand All @@ -35,8 +35,7 @@
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.staticfiles",

'rest_framework',
"rest_framework",
]

MIDDLEWARE_CLASSES = [
Expand All @@ -50,12 +49,12 @@
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = 'urls'
ROOT_URLCONF = "urls"

TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
'DIRS': [],
"DIRS": [],
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
Expand All @@ -67,15 +66,15 @@
},
]

WSGI_APPLICATION = 'wsgi.application'
WSGI_APPLICATION = "wsgi.application"

# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
}

Expand All @@ -84,25 +83,25 @@

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]

# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/

LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = "en-us"

TIME_ZONE = 'UTC'
TIME_ZONE = "UTC"

USE_I18N = True

Expand All @@ -113,14 +112,14 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/

STATIC_URL = '/static/'
STATIC_URL = "/static/"

POSTCODE_LOOKUP = {
'default': {
'backend': 'django_postcode_lookup.backends.Webservices',
'OPTIONS': {
'username': 'someuser',
'password': 'somepassword',
}
"default": {
"backend": "django_postcode_lookup.backends.Webservices",
"OPTIONS": {
"username": "someuser",
"password": "somepassword",
},
}
}
2 changes: 1 addition & 1 deletion sandbox/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.urls import include, path

urlpatterns = [
path('postcode-lookup/', include('django_postcode_lookup.urls')),
path("postcode-lookup/", include("django_postcode_lookup.urls")),
]
Loading
Loading