Skip to content

Commit 66dcd48

Browse files
authored
Django 4.2 support (graphite-project#2846)
* Adding django-upgrade pre-commit * Submitting django upgrade result * Include test suite in release (fixing graphite-project#2830) * Fix pyparsing dep version (fixing graphite-project#2834) * Upgrade Django and python version in reqs and tox * adding dependabot * adding new python in tests * Comment out broken tests * fix attime tests for python 3.12 * fix more tests for python 3.12 * simplify tox * fix self.assertRegex test * fix self.assertRegex test * fix self.assertEquals test * pleasing linter * more pleasing linter * trying to fix events test * let's keep doc on py310 * more event test fixes * moving doc to 3.10 * ok, moving back
1 parent 31f92f2 commit 66dcd48

35 files changed

+266
-232
lines changed

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: monthly
7+
- package-ecosystem: pip
8+
directory: "/"
9+
schedule:
10+
interval: weekly
11+
time: '10:00'
12+
open-pull-requests-limit: 10

.github/workflows/tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737

3838
strategy:
3939
matrix:
40-
python-version: ['3.7', '3.8', '3.9', '3.10']
40+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
4141

4242
steps:
4343
- uses: actions/checkout@v4
@@ -81,24 +81,24 @@ jobs:
8181
run: |
8282
tox
8383
- name: Linting
84-
if: ${{ matrix.python-version==3.10 }}
84+
if: ${{ matrix.python-version==3.12 }}
8585
env:
8686
TOXENV: lint
8787
run: |
8888
tox
8989
- name: Testing documentation
90-
if: ${{ matrix.python-version==3.10 }}
90+
if: ${{ matrix.python-version==3.12 }}
9191
env:
9292
TOXENV: docs
9393
run: |
9494
tox
9595
- name: Run Codecov
96-
if: ${{ matrix.python-version==3.10 }}
96+
if: ${{ matrix.python-version==3.12 }}
9797
env:
9898
TOXENV: lint
9999
run: |
100100
pip install codecov
101101
codecov
102102
- name: Upload coverage to Codecov
103-
if: ${{ matrix.python-version==3.10 }}
103+
if: ${{ matrix.python-version==3.12 }}
104104
uses: codecov/codecov-action@v3

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
default_language_version:
2+
python: python3.12
3+
4+
repos:
5+
- repo: https://github.com/adamchainz/django-upgrade
6+
rev: "1.20.0"
7+
hooks:
8+
- id: django-upgrade
9+
args: [ --target-version, "4.2" ]

.pre-commit-hooks.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
- id: django-upgrade
2+
name: django-upgrade
3+
description: Automatically upgrade your Django project code.
4+
entry: django-upgrade
5+
language: python
6+
types: [python]
7+
# for backward compatibility
8+
files: ''
9+
minimum_pre_commit_version: 0.15.0

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ include webapp/graphite/local_settings.py.example
88
recursive-include distro/ *
99
recursive-include webapp/graphite/ *.html
1010
recursive-include webapp/content/ *
11+
recursive-include webapp/tests/ *
1112
exclude webapp/graphite/local_settings.py
1213
exclude conf/*.conf

check-dependencies.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
optional = 0
1212

1313

14+
def versiontuple(v):
15+
return tuple(map(int, (v.split("."))))
16+
17+
1418
# Test for whisper
1519
try:
1620
import whisper
@@ -92,6 +96,10 @@
9296
sys.stderr.write("[REQUIRED] Unable to import the 'pyparsing' module, "
9397
"do you have pyparsing module installed for python %s?\n" % sys.version_info.major)
9498
required += 1
99+
if versiontuple(pyparsing.__version__) < versiontuple("2.3.0"):
100+
sys.stderr.write("[REQUIRED] You have pyparsing version %s installed, "
101+
"but version 2.3.0 or greater is required\n" % pyparsing.__version__)
102+
required += 1
95103

96104

97105
# Test for django-tagging
@@ -103,9 +111,9 @@
103111
required += 1
104112

105113

106-
if django and django.VERSION[:2] < (1,8):
114+
if django and django.VERSION[:2] < (4,2):
107115
sys.stderr.write("[REQUIRED] You have django version %s installed, "
108-
"but version 1.8 or greater is required\n" % django.get_version())
116+
"but version 4.2 or greater is required\n" % django.get_version())
109117
required += 1
110118

111119

docs/install.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ been met or not.
3333
Basic Graphite requirements:
3434

3535
* a UNIX-like Operating System
36-
* Python 2.7 or greater (including experimental Python3 support)
36+
* Python 3.8 or greater
3737
* `cairocffi`_
38-
* `Django`_ 1.8 - 2.2 (for Python3 - 1.11 and newer), 1.11.19 or newer is recommended
39-
* `django-tagging`_ 0.4.6 (not `django-taggit` yet)
38+
* `Django`_ 4.2+
39+
* `django-tagging`_ 0.4.6 (not `django-taggit`, unfortunately)
4040
* `pytz`_
41-
* `scandir`_ (for Python older than 3.5)
41+
* `pyparsing` 2.3.0+
4242
* `fontconfig`_ and at least one font package (a system package usually)
4343
* A WSGI server and web server. Popular choices are:
4444

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Requirements for documentation
22
cairocffi
3-
django-tagging==0.4.6
3+
django-tagging
44
pytz
55
git+https://github.com/graphite-project/whisper.git#egg=whisper
66
git+https://github.com/graphite-project/ceres.git#egg=ceres

requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
# deactivate
3636
#
3737

38-
Django>=3.2,<5
39-
python-memcached==1.58
40-
txAMQP==0.8
41-
django-tagging==0.4.6
38+
Django>=4.2,<5
39+
python-memcached>=1.58
40+
txAMQP>=0.8.2,<0.9
41+
django-tagging
4242
gunicorn
4343
pytz
4444
pyparsing>=2.3.0

tox.ini

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[gh-actions]
22
python =
3-
3.7: py37
43
3.8: py38
54
3.9: py39
65
3.10: py310
6+
3.11: py311
7+
3.12: py312
78

89
[tox]
910
envlist =
10-
py{37,38,39,310}-django32-pyparsing3{,-msgpack},
11-
lint, docs
11+
py{38,39,310,311,312},lint, docs
1212

1313
[testenv]
1414
whitelist_externals =
@@ -31,16 +31,16 @@ deps =
3131
django-tagging
3232
pytz
3333
mock
34+
msgpack-python
3435
git+https://github.com/graphite-project/whisper.git#egg=whisper
3536
git+https://github.com/graphite-project/ceres.git#egg=ceres
36-
pyparsing3: pyparsing>=3.0.6
37-
django32: Django>=3.2,<5
37+
pyparsing>=3.0.6
38+
Django>=4.2,<5
3839
urllib3
3940
redis
4041
rrdtool
4142
mysql: mysqlclient
4243
postgresql: psycopg2
43-
msgpack: msgpack-python
4444
pyhash: pyhash
4545

4646
[testenv:docs]
@@ -64,7 +64,7 @@ commands =
6464
sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
6565

6666
[testenv:lint]
67-
basepython = python3.10
67+
basepython = python3.12
6868
changedir = {toxinidir}
6969
deps =
7070
flake8==3.7.9

0 commit comments

Comments
 (0)