Skip to content

Commit d1c8445

Browse files
authored
Drop python3.8 / Add python 3.13 (#314)
* drop python3.8, add python 3.13 * limit django <5.1 because code is broken * use debian bookworm in dockerfile because there is bug in ubuntu spatialite < 5.0
1 parent 9eff3ca commit d1c8445

File tree

8 files changed

+56
-57
lines changed

8 files changed

+56
-57
lines changed

.github/workflows/python-ci.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Set up Python ${{ matrix.python-version }}
2525
uses: actions/setup-python@v5
2626
with:
27-
python-version: 3.8 # check pylint with minimal supported python version
27+
python-version: "3.10"
2828

2929
- name: Install flake8
3030
run: |
@@ -35,13 +35,18 @@ jobs:
3535
flake8 mapentity test_project test_app
3636
3737
test:
38-
runs-on: ubuntu-20.04 # wait for spatialite fix
38+
runs-on: ubuntu-latest
39+
container:
40+
image: python:${{ matrix.python-version }}-bookworm
41+
env:
42+
LANG: C.UTF-8
43+
3944
strategy:
4045
matrix:
41-
python-version: [ '3.8', '3.10', '3.12' ]
46+
python-version: [ '3.9', '3.10', '3.13' ]
4247
django-version: [ '4.2.*', '5.0.*' ]
4348
exclude:
44-
- python-version: '3.8'
49+
- python-version: '3.9'
4550
django-version: '5.0.*'
4651

4752
env:
@@ -53,19 +58,14 @@ jobs:
5358

5459
- name: Install system dependencies
5560
run: |
56-
sudo apt-get -qq update
57-
sudo apt-get -y install gettext libproj-dev binutils gdal-bin libgdal-dev libsqlite3-mod-spatialite libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info libpangoft2-1.0-0 libjpeg-dev libopenjp2-7-dev libsasl2-dev python3-dev libldap2-dev libssl-dev
58-
59-
- name: Set up Python ${{ matrix.python-version }}
60-
uses: actions/setup-python@v5
61-
with:
62-
python-version: ${{ matrix.python-version }}
61+
apt-get -qq update
62+
apt-get -y install gettext libproj-dev binutils gdal-bin libgdal-dev libsqlite3-mod-spatialite libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info libpangoft2-1.0-0 libjpeg-dev libopenjp2-7-dev libsasl2-dev python3-dev libldap2-dev libssl-dev
6363
6464
- name: Install python dependencies
6565
run: |
66-
python -m pip install --upgrade pip setuptools wheel
67-
pip install .[dev]
68-
pip install Django==${{ matrix.django-version }} -U
66+
python3 -m pip install --upgrade pip setuptools wheel
67+
pip3 install .[dev]
68+
pip3 install Django==${{ matrix.django-version }} -U
6969
7070
- name: Compile messages
7171
run: |
@@ -99,7 +99,7 @@ jobs:
9999
- name: Set up Python
100100
uses: actions/setup-python@v5
101101
with:
102-
python-version: 3.8
102+
python-version: "3.10"
103103

104104
- name: Compile messages
105105
run: |

.github/workflows/sphinx.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ env:
1616
jobs:
1717
doc:
1818
name: Documentation
19-
runs-on: ubuntu-20.04
19+
runs-on: ubuntu-latest
2020
container:
21-
image: python:3.8
21+
image: python:3.10
2222
env:
2323
LANG: C.UTF-8
2424
steps:

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ CHANGELOG
55
8.11.0+dev (XXXX-XX-XX)
66
-----------------------
77

8+
**Improvements**
9+
10+
- Add python 3.13 test suite
11+
- Drop python 3.8 test suite
812

913

1014
8.11.0 (2025-01-09)

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM makinacorpus/geodjango:bionic-3.8
1+
FROM python:3.9-bookworm
22

33
RUN apt-get update -qq && apt-get install -y -qq \
4-
libsqlite3-mod-spatialite \
5-
libjpeg62 libjpeg62-dev zlib1g-dev libcairo2 libpango-1.0-0 \
4+
binutils libproj-dev gdal-bin libsqlite3-mod-spatialite \
5+
libjpeg62 zlib1g-dev libcairo2 libpango-1.0-0 \
66
libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info \
77
libldap2-dev libsasl2-dev && \
88
apt-get clean all && rm -rf /var/apt/lists/* && rm -rf /var/cache/apt/*
@@ -14,7 +14,7 @@ RUN chown -R django:django /code
1414
COPY --chown=django:django . /code/src
1515

1616
USER django
17-
RUN python3.8 -m venv /code/venv
17+
RUN python3.9 -m venv /code/venv
1818

1919
WORKDIR /code/src
2020

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ that powers
77
- `Georiviere <https://github.com/Georiviere/Georiviere-admin>`_.
88

99

10-
Works with Python 3.8+ and Django 3.2+
10+
Works with Python 3.9+ and Django 4.2+
1111

1212
.. image:: https://img.shields.io/pypi/v/mapentity.svg
1313
:target: https://pypi.python.org/pypi/mapentity

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
install_requires=[
3232
'BeautifulSoup4',
3333
'cairocffi',
34-
'Django',
34+
'Django<5.1',
3535
'tzdata',
3636
'django-appypod',
3737
'django-compressor',
@@ -40,7 +40,7 @@
4040
'django-embed-video',
4141
'django-filter',
4242
'django-leaflet>=0.19,<0.20', # leaflet 0.7.x
43-
'django-modeltranslation<0.19.5', # does not support python 3.8
43+
'django-modeltranslation',
4444
'django-tinymce>=3',
4545
'django-weasyprint',
4646
'djangorestframework',
@@ -57,14 +57,14 @@
5757
tests_require=tests_require,
5858
extras_require={
5959
'dev': tests_require + [
60-
'django-debug-toolbar<3.3', # 3.3.0 is not compatible with Django 2.2
60+
'django-debug-toolbar',
6161
'flake8'
6262
]
6363
},
6464
packages=find_packages(),
6565
include_package_data=True,
6666
zip_safe=False,
67-
python_requires='>=3.8',
67+
python_requires='>=3.9',
6868
classifiers=['Topic :: Utilities',
6969
'Natural Language :: English',
7070
'Operating System :: OS Independent',

test_app/tests/test_serializers.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from io import StringIO
33
from unittest.mock import patch
44

5-
from django import VERSION
65
from django.conf import settings
76
from django.contrib.gis import gdal
87
from django.contrib.gis.db.models import GeometryField
@@ -13,7 +12,7 @@
1312

1413
from mapentity.registry import app_settings
1514
from mapentity.serializers import ZipShapeSerializer, CSVSerializer
16-
from ..models import MushroomSpot, Tag, Supermarket
15+
from test_app.models import MushroomSpot, Tag, Supermarket
1716

1817

1918
class CommonShapefileSerializerMixin(object):
@@ -28,19 +27,21 @@ def getShapefileLayers(self):
2827

2928
class MushroomShapefileSerializerTest(CommonShapefileSerializerMixin, TestCase):
3029
def setUp(self):
31-
self.point1 = MushroomSpot.objects.create(serialized='SRID=%s;POINT(0 0)' % settings.SRID)
30+
self.point1 = MushroomSpot.objects.create(serialized=f'SRID={settings.SRID};POINT(0 0)')
3231
self.point1.tags.add(Tag.objects.create(label="Tag1"))
3332
self.point1.tags.add(Tag.objects.create(label="Tag2"))
34-
self.line1 = MushroomSpot.objects.create(serialized='SRID=%s;LINESTRING(0 0, 10 0)' % settings.SRID)
35-
self.multipoint = MushroomSpot.objects.create(serialized='SRID=%s;MULTIPOINT((1 1), (2 2))' % settings.SRID)
36-
self.multiline = MushroomSpot.objects.create(serialized='SRID=%s;MULTILINESTRING((1 1, 2 2), '
37-
'(3 3, 4 4))' % settings.SRID)
38-
self.polygon = MushroomSpot.objects.create(serialized='SRID=%s;POLYGON((1 1, 2 2, '
39-
'1 2, 1 1))' % settings.SRID)
40-
self.multipolygon = MushroomSpot.objects.create(serialized='SRID=%s;MULTIPOLYGON(((1 1, 2 2, '
41-
'1 2, 1 1)))' % settings.SRID)
33+
self.line1 = MushroomSpot.objects.create(serialized=f'SRID={settings.SRID};LINESTRING(0 0, 10 0)')
34+
self.multipoint = MushroomSpot.objects.create(serialized=f'SRID={settings.SRID};MULTIPOINT((1 1), (2 2))')
35+
self.multiline = MushroomSpot.objects.create(
36+
serialized=f'SRID={settings.SRID};MULTILINESTRING((1 1, 2 2), (3 3, 4 4))'
37+
)
38+
self.polygon = MushroomSpot.objects.create(serialized=f'SRID={settings.SRID};POLYGON((1 1, 2 2, 1 2, 1 1))')
39+
self.multipolygon = MushroomSpot.objects.create(
40+
serialized=f'SRID={settings.SRID};MULTIPOLYGON(((1 1, 2 2, 1 2, 1 1)))'
41+
)
4242
self.geometrycollection = MushroomSpot.objects.create(
43-
serialized='SRID=%s;GEOMETRYCOLLECTION(POINT(0 0), POLYGON((1 1, 2 2, 1 2, 1 1))))' % settings.SRID)
43+
serialized=f'SRID={settings.SRID};GEOMETRYCOLLECTION(POINT(0 0), POLYGON((1 1, 2 2, 1 2, 1 1))))'
44+
)
4445
MushroomSpot.geomfield = GeometryField(name='geom', srid=settings.SRID)
4546

4647
self.serializer = ZipShapeSerializer()
@@ -188,10 +189,7 @@ def test_serializer_foreign_key(self):
188189
layers = self.getShapefileLayers()
189190
layer = layers['Polygon.shp']
190191
feature = layer[0]
191-
if VERSION[0] >= 3:
192-
self.assertEqual(feature['tag'].value, None)
193-
else:
194-
self.assertEqual(feature['tag'].value, "")
192+
self.assertEqual(feature['tag'].value, None)
195193

196194
self.serializer = ZipShapeSerializer()
197195
tag = Tag.objects.create(label="Tag")

test_app/tests/test_templatetags.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1+
import json
2+
import os
3+
from datetime import datetime
4+
15
from django.conf import settings
6+
from django.contrib.staticfiles.storage import staticfiles_storage
27
from django.core.exceptions import FieldDoesNotExist
38
from django.template import Template, Context
49
from django.template.exceptions import TemplateSyntaxError
510
from django.test import TestCase
6-
from django.test.utils import override_settings
711
from django.utils.timezone import make_aware
12+
from freezegun import freeze_time
813

9-
from ..models import DummyModel
1014
from .factories import DummyModelFactory
11-
12-
from datetime import datetime
13-
from freezegun import freeze_time
14-
import json
15-
import os
16-
from tempfile import TemporaryDirectory
15+
from ..models import DummyModel
1716

1817

1918
class ValueListTest(TestCase):
@@ -224,14 +223,12 @@ def test_few_seconds_ago(self):
224223

225224
class MediaStaticFallbackPathTest(TestCase):
226225
def test_media_static_fallback_path(self):
227-
d = TemporaryDirectory()
228-
with override_settings(STATIC_ROOT=d.name):
229-
out = Template(
230-
'{% load mapentity_tags %}'
231-
'{% media_static_fallback_path "doesnotexist.png" "foo.png" %}'
232-
).render(Context({}))
226+
out = Template(
227+
'{% load mapentity_tags %}'
228+
'{% media_static_fallback_path "doesnotexist.png" "foo.png" %}'
229+
).render(Context({}))
233230

234-
self.assertEqual(os.path.join(d.name, 'foo.png'), out)
231+
self.assertEqual(staticfiles_storage.path("foo.png"), out)
235232

236233
def test_media_static_find_path(self):
237234
with open(os.path.join(settings.MEDIA_ROOT, 'exist.png'), mode='wb') as f:

0 commit comments

Comments
 (0)