Skip to content

Commit bed0e32

Browse files
authored
Prep release + more pre-commit hooks (#467)
Signed-off-by: Asher Foa <[email protected]>
1 parent 5cda836 commit bed0e32

File tree

7 files changed

+108
-104
lines changed

7 files changed

+108
-104
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -41,40 +41,40 @@ jobs:
4141
ports:
4242
- 5432:5432
4343
steps:
44-
- name: Install OS Packages
45-
run: |
46-
sudo apt-get update
47-
sudo apt-get install binutils libproj-dev gdal-bin libmemcached-dev libsqlite3-mod-spatialite
48-
- uses: actions/checkout@v4
49-
with:
50-
fetch-depth: 0
51-
- name: Set up Python ${{ matrix.python-version }}
52-
uses: actions/setup-python@v5
53-
with:
54-
python-version: ${{ matrix.python-version }}
55-
- name: Install dependencies
56-
run: |
57-
pip install -U "pip>=23.1.1"
58-
pip install -U "tox-gh-actions==3.3.0" coverage
59-
- name: Log versions
60-
run: |
61-
python --version
62-
pip --version
63-
psql -V
64-
mysql -V
65-
- name: prep DB
66-
env:
67-
MYSQL_TCP_PORT: 3306
68-
MYSQL_HOST: localhost
69-
PGHOST: localhost
70-
PGPORT: 5432
71-
run: |
72-
psql -U postgres -c 'CREATE DATABASE postgis'
73-
psql -U postgres postgis -c 'CREATE EXTENSION IF NOT EXISTS postgis;'
74-
mysql --protocol=TCP --user=root -e 'create database django_prometheus_1;'
75-
- name: Run test and linters via Tox
76-
run: tox
77-
- name: Process code coverage
78-
run: |
79-
coverage combine .coverage django_prometheus/tests/end2end/.coverage
80-
coverage xml
44+
- name: Install OS Packages
45+
run: |
46+
sudo apt-get update
47+
sudo apt-get install binutils libproj-dev gdal-bin libmemcached-dev libsqlite3-mod-spatialite
48+
- uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0
51+
- name: Set up Python ${{ matrix.python-version }}
52+
uses: actions/setup-python@v5
53+
with:
54+
python-version: ${{ matrix.python-version }}
55+
- name: Install dependencies
56+
run: |
57+
pip install -U "pip>=23.1.1"
58+
pip install -U "tox-gh-actions==3.3.0" coverage
59+
- name: Log versions
60+
run: |
61+
python --version
62+
pip --version
63+
psql -V
64+
mysql -V
65+
- name: prep DB
66+
env:
67+
MYSQL_TCP_PORT: 3306
68+
MYSQL_HOST: localhost
69+
PGHOST: localhost
70+
PGPORT: 5432
71+
run: |
72+
psql -U postgres -c 'CREATE DATABASE postgis'
73+
psql -U postgres postgis -c 'CREATE EXTENSION IF NOT EXISTS postgis;'
74+
mysql --protocol=TCP --user=root -e 'create database django_prometheus_1;'
75+
- name: Run test and linters via Tox
76+
run: tox
77+
- name: Process code coverage
78+
run: |
79+
coverage combine .coverage django_prometheus/tests/end2end/.coverage
80+
coverage xml

.github/workflows/pre-release.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@ jobs:
1010
permissions:
1111
id-token: write
1212
steps:
13-
- uses: actions/checkout@v4
14-
with:
15-
fetch-depth: 0
16-
- name: Set up Python 3.9
17-
uses: actions/setup-python@v5
18-
with:
19-
python-version: 3.9
20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install wheel setuptools packaging twine build --upgrade
24-
- name: Set version number
25-
run: python update_version_from_git.py
26-
- name: Build
27-
run: python -m build
28-
- name: Publish to PyPI
29-
uses: pypa/[email protected]
30-
with:
31-
skip-existing: true
32-
verbose: true
33-
print-hash: true
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- name: Set up Python 3.9
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: 3.9
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install wheel setuptools packaging twine build --upgrade
24+
- name: Set version number
25+
run: python update_version_from_git.py
26+
- name: Build
27+
run: python -m build
28+
- name: Publish to PyPI
29+
uses: pypa/[email protected]
30+
with:
31+
skip-existing: true
32+
verbose: true
33+
print-hash: true

.github/workflows/release.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ jobs:
3838
permissions:
3939
id-token: write
4040
steps:
41-
- uses: actions/checkout@v4
42-
with:
43-
ref: ${{ needs.determine-tag.outputs.release-tag }}
44-
fetch-depth: 0
45-
- name: Set up Python 3.9
46-
uses: actions/setup-python@v5
47-
with:
48-
python-version: 3.9
49-
- name: Install dependencies
50-
run: |
51-
python -m pip install --upgrade pip
52-
pip install wheel setuptools packaging twine build --upgrade
53-
- name: Build
54-
run: python -m build
55-
- name: Publish to PyPI
56-
uses: pypa/[email protected]
57-
with:
58-
skip-existing: true
59-
verbose: true
60-
print-hash: true
41+
- uses: actions/checkout@v4
42+
with:
43+
ref: ${{ needs.determine-tag.outputs.release-tag }}
44+
fetch-depth: 0
45+
- name: Set up Python 3.9
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: 3.9
49+
- name: Install dependencies
50+
run: |
51+
python -m pip install --upgrade pip
52+
pip install wheel setuptools packaging twine build --upgrade
53+
- name: Build
54+
run: python -m build
55+
- name: Publish to PyPI
56+
uses: pypa/[email protected]
57+
with:
58+
skip-existing: true
59+
verbose: true
60+
print-hash: true

.pre-commit-config.yaml

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
repos:
2-
3-
- repo: https://github.com/pre-commit/pre-commit-hooks
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
43
rev: v5.0.0
54
hooks:
6-
- id: check-case-conflict
7-
- id: check-merge-conflict
8-
- id: check-yaml
9-
- id: end-of-file-fixer
10-
- id: trailing-whitespace
11-
12-
- repo: https://github.com/adamchainz/django-upgrade
13-
rev: "1.25.0"
5+
- id: check-case-conflict
6+
- id: check-merge-conflict
7+
- id: check-yaml
8+
- id: end-of-file-fixer
9+
- id: trailing-whitespace
10+
- repo: https://github.com/adamchainz/django-upgrade
11+
rev: '1.25.0'
1412
hooks:
15-
- id: django-upgrade
16-
args: [--target-version, "4.2"]
17-
18-
- repo: https://github.com/astral-sh/ruff-pre-commit
13+
- id: django-upgrade
14+
args: [--target-version, '4.2']
15+
- repo: https://github.com/astral-sh/ruff-pre-commit
1916
rev: v0.11.13
2017
hooks:
21-
- id: ruff-check
18+
- id: ruff-check
2219
name: ruff check
23-
args: ["--fix"]
24-
- id: ruff-format
20+
args: ['--fix']
21+
- id: ruff-format
2522
name: ruff format
23+
- repo: https://github.com/asottile/pyupgrade
24+
rev: v3.20.0
25+
hooks:
26+
- id: pyupgrade
27+
- repo: https://github.com/google/yamlfmt
28+
rev: v0.17.0
29+
hooks:
30+
- id: yamlfmt

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Changelog
22

3-
## v2.4.0 - UNPUBLISHED
3+
## v2.4.0 - January 8th, 2025
44

55
* Add support for Django 5.0 and Python 3.12.
66
* Replace black, flake8 and isort with Ruff
77
* Drop support for Django 3.2 (Python 3.7), 4.0 and 4.1
8+
* Project moved to the [Django Commons](https://github.com/django-commons) GitHub organization.
9+
* Add pyupgrade and yamlfmt pre-commit hooks
810

911
## v2.3.1 - May 2nd, 2023
1012

django_prometheus/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
__all__ = ["middleware", "models", "pip_prometheus"]
1212

13-
__version__ = "2.4.0.dev0"
13+
__version__ = "2.4.0"
1414

1515
# Import pip_prometheus to export the pip metrics automatically.
1616
try:

examples/prometheus/prometheus.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
global:
22
scrape_interval: 10s
33
evaluation_interval: 10s
4-
54
external_labels:
65
monitor: django-monitor
7-
86
rule_files:
9-
- "django.rules"
10-
7+
- "django.rules"
118
scrape_configs:
12-
- job_name: "django"
13-
static_configs:
14-
- targets: ["localhost:8000"]
9+
- job_name: "django"
10+
static_configs:
11+
- targets: ["localhost:8000"]

0 commit comments

Comments
 (0)